Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Assistance with a complex disk partitioning problem
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Mon Jul 03, 2017 2:42 am    Post subject: Assistance with a complex disk partitioning problem Reply with quote

I'm about to embark on a new Gentoo project on a Dell XPS15 9560 currently with Mint and Windows on it.

I destroyed the bootability of the Win10Pro system doing some linux distro experimentation and due to unfamiliarity with UEFI.

Could anyone look at the info below and tell me what more I could provide to see if the windows environment can be fixed prior to my Gentoo project or advise that it is likely to be broken beyond repair (I did plenty of multi boot stuff in BIOS days but with the state this UEFI disk is in I doubt I will be able to get the Windows partition back (let's just pretend for the moment that I DO have a reasonable excuse to NEED Win10Pro on the machine (for now;))

Here is the disk info - it is a 1T SDD.

Quote:

livecd will #
disktype /dev/nvme0n1

--- /dev/nvme0n1
Block device, size 953.9 GiB (1024209543168 bytes)
DOS/MBR partition map

Partition 1: 953.9 GiB (1024209542656 bytes, 2000409263 sectors from 1)
Type 0xEE (EFI GPT protective)
GPT partition map, 128 entries
Disk size 953.9 GiB (1024209543168 bytes, 2000409264 sectors)
Disk GUID 29746C75-D743-354B-9280-E176570E9F37

Partition 1: 513 MiB (537919488 bytes, 1050624 sectors from 1484722176)
Type EFI System (FAT) (GUID 28732AC1-1FF8-D211-BA4B-00A0C93EC93B)
Partition Name ""
Partition GUID 30CADE92-16D9-CA45-BB36-C759FD0A6649
FAT32 file system (hints score 5 of 5)
Volume size 512.0 MiB (536854528 bytes, 131068 clusters of 4 KiB)

Partition 2: 16 MiB (16777216 bytes, 32768 sectors from 206848)
Type MS Reserved (GUID 16E3C9E3-5C0B-B84D-817D-F92DF00215AE)
Partition Name "Microsoft reserved partition"
Partition GUID 80C88358-C199-0F4C-996E-CC15D9ED500E

Partition 3: 707.9 GiB (760055070720 bytes, 1484482560 sectors from 239616)
Type Basic Data (GUID A2A0D0EB-E5B9-3344-87C0-68B6B72699C7)
Partition Name "Basic data partition"
Partition GUID 0D4BA2D6-4B84-AC4B-8718-F2457BB9F39F
NTFS file system
Volume size 707.9 GiB (760055070208 bytes, 1484482559 sectors)

Partition 4: 27.94 GiB (29999759360 bytes, 58593280 sectors from 1485772800)
Type Linux Swap (GUID 6DFD5706-ABA4-C443-84E5-0933C84B4F4F)
Partition Name ""
Partition GUID 7ABE7AFC-9BE5-1C46-812B-2BFD6F61F253
Linux swap, version 2, subversion 1, 4 KiB pages, little-endian
Swap size 27.94 GiB (29999751168 bytes, 7324158 pages of 4 KiB)

Partition 5: 217.5 GiB (233493757952 bytes, 456042496 sectors from 1544366080)
Type Unknown (GUID AF3DC60F-8384-7247-8E79-3D69D8477DE4)
Partition Name ""
Partition GUID 1493AF67-FBDE-D445-BCE1-55EF7B725CE7
Ext3 file system
UUID 8539CE4C-8106-43EF-A02B-7AB7D151963E (DCE, v4)
Last mounted at "/"
Volume size 217.5 GiB (233493757952 bytes, 57005312 blocks of 4 KiB)

Partition 6: unused

The basics I know about the disk are:

1) the Working Linux Mint System is installed in Partition 5: 217.5 GiB in a single partition
2) the unbootable Windows System is installed on Partition 3: 707.9 GiB in a single partition
3) there is my Mint swap on Partition 4: 27.94

and various other partitions that I don't really know the purpose of, other than that with UEFI the use of GPT is still a bit of a complex mystery to me so I'm not surprised that there is an EFI partition space, probably a recovery space for Windows (which evidently doesn't work because even when pointed to the partition with Windows on it the bootable Windows USB fails to do a system recovery - I attempted this knowing I would probably have to reinstall Grub for Mint after, but it doesn't want to recover the windows system).

Here is the fdisk output for all the dev entries:

Code:

livecd dev # fdisk -t dos /dev/nvme0n1
/dev/nvme0n1    /dev/nvme0n1p1  /dev/nvme0n1p2  /dev/nvme0n1p3  /dev/nvme0n1p4  /dev/nvme0n1p5
livecd dev # fdisk -t dos /dev/nvme0n1p1

...

Disk /dev/nvme0n1p1: 513 MiB, 537919488 bytes, 1050624 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

...

Disk /dev/nvme0n1p2: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2033e08a

---

Disk /dev/nvme0n1p3: 707.9 GiB, 760055070720 bytes, 1484482560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x73736572

Device           Boot      Start        End    Sectors   Size Id Type
/dev/nvme0n1p3p1      1920221984 3736432267 1816210284   866G 72 unknown
/dev/nvme0n1p3p2      1936028192 3889681299 1953653108 931.6G 6c unknown
/dev/nvme0n1p3p3               0          0          0     0B  0 Empty
/dev/nvme0n1p3p4        27722122   27722568        447 223.5K  0 Empty

Partition table entries are not in disk order.

...

Device /dev/nvme0n1p4 already contains a swap signature.
The signature will be removed by a write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xb8a13690.

Disk /dev/nvme0n1p4: 28 GiB, 29999759360 bytes, 58593280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xb8a13690

...

Device /dev/nvme0n1p5 already contains a ext4 signature.
The signature will be removed by a write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xa10ce31f.

Disk /dev/nvme0n1p5: 217.5 GiB, 233493757952 bytes, 456042496 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa10ce31f



What more need I provide to find out if the Windows partition is lost for good? I have a backup of the User homes on it so it may be advisable to blow the whole partition away. But if I do that would it actually make even more sense to start the entire disk from scratch - ie is it all hopelessly out of order and managing to make a dogs breakfast of otherwise pristine media (given the system is only a month or two old!)

Best
Will

(returned after long service leave from working with Gentoo and Linux in general)
_________________
]8P


Last edited by stardotstar on Wed Jul 05, 2017 9:25 am; edited 2 times in total
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Mon Jul 03, 2017 3:41 am    Post subject: Reply with quote

In continuing to work through this myself I found that if I mounted the ESP partition and drilled down in the Temp directory I discovered a number of text files - one of which seems to have been written my Windows when I set it up?

Code:

livecd will # mount -t vfat /dev/nvme0
nvme0      nvme0n1    nvme0n1p1  nvme0n1p2  nvme0n1p3  nvme0n1p4  nvme0n1p5 

livecd will # mkdir /mnt/esp
livecd will # mount -t vfat /dev/nvme0n1p1 /mnt/esp

livecd will # cd /mnt/esp
livecd esp # ls
EFI  Temp

livecd esp # cd Temp/
livecd Temp # ls
SrtTrail.log  SrtTrail.txt  bcdinfo.txt  bootfailure.txt  disklayout.txt

livecd Temp # cat bcdinfo.txt
The boot configuration data store could not be opened.
The system cannot find the file specified.
livecd Temp # cat disklayout.txt

Microsoft DiskPart version 10.0.10586

Copyright (C) 1999-2013 Microsoft Corporation.
On computer: MININT-STPMBT7

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          953 GB   100 MB        *
  Disk 1    Online         7386 MB      0 B         

Disk 0 is now the selected disk.

NVMe PC300 NVMe SK hy
Disk ID: {756C7429-43D7-4B35-9280-E176570E9F37}
Type   : NVMe
Status : Online
Path   : 0
Target : 0
LUN ID : 0
Location Path : PCIROOT(0)#PCI(1D00)#PCI(0000)#NVME(P00T00L00)
Current Read-only State : No
Read-only  : No
Boot Disk  : No
Pagefile Disk  : No
Hibernation File Disk  : No
Crashdump Disk  : No
Clustered Disk  : No

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     C                NTFS   Partition    707 GB  Healthy           
  Volume 1                      FAT32  Partition    513 MB  Healthy    Hidden 

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     C                NTFS   Partition    707 GB  Healthy           
  Volume 1                      FAT32  Partition    513 MB  Healthy    Hidden 
  Volume 2     D                FAT32  Removable   7383 MB  Healthy           

Volume 1 is the selected volume.

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
* Disk 0    Online          953 GB   100 MB        *

Offline                : No

Disk 0 is now the selected disk.

NVMe PC300 NVMe SK hy
Disk ID: {756C7429-43D7-4B35-9280-E176570E9F37}
Type   : NVMe
Status : Online
Path   : 0
Target : 0
LUN ID : 0
Location Path : PCIROOT(0)#PCI(1D00)#PCI(0000)#NVME(P00T00L00)
Current Read-only State : No
Read-only  : No
Boot Disk  : No
Pagefile Disk  : No
Hibernation File Disk  : No
Crashdump Disk  : No
Clustered Disk  : No

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     C                NTFS   Partition    707 GB  Healthy           
  Volume 1                      FAT32  Partition    513 MB  Healthy    Hidden 

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 2    Reserved            16 MB   101 MB
  Partition 3    Primary            707 GB   117 MB
  Partition 1    System             513 MB   707 GB
  Partition 4    Unknown             27 GB   708 GB
  Partition 5    Unknown            217 GB   736 GB

Partition 1 is now the selected partition.

Partition 1
Type    : c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Hidden  : Yes
Required: No
Attrib  : 0000000000000000
Offset in Bytes: 760177754112

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 1                      FAT32  Partition    513 MB  Healthy    Hidden 
livecd Temp #


The ESP partition has the Dell BIOS recovery image and logs and the boot environment (Grub) for my Mint install.

So I go to look at the mystery small partition 2 and I can't mount it as vfat

Code:

livecd mnt # ls
aufs-rw-branch  cdrom  esp  gentoo  livecd

livecd mnt # mkdir dos

livecd mnt # mount -t vfat /dev/nvme0n1p2 /mnt/dos
mount: wrong fs type, bad option, bad superblock on /dev/nvme0n1p2,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.


an attempt without the fs type:

Code:
livecd mnt # mount  /dev/nvme0n1p2 /mnt/dos
mount: /dev/nvme0n1p2 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/nvme0n1p2,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.


So I'm thinking this must be some kind of MS Windows "special" place - like for the currently AWOL NTLOADER or something??

I'll continue to blog this as I do my research and await insight from the Gentoo Guru's :)
_________________
]8P
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Mon Jul 03, 2017 4:26 am    Post subject: Reply with quote

In the mean time I'm also preparing for all possibilities and I've mounted a local nfs volume and copying the entire mint environment off the disk so I can theoretically go back to scratch with this disk.

In which case I'm thinking I'll reverse the setup:

1) 250GiB for Windows 10 - a clean install with the bootable USB I got with the Dell.
2) The remainder of the disk for two Linux systems:
a) Gentoo, say 600GiB
b) Enough room for experimenting with another distro that I don't want to do in VM. remainder

I'm guessing that doing this in the order of putting Windows on first will play nice with adding the Gentoo build and another Linux down the track as they will install/add to Grub that will be able to accommodate the existing Win.
W
_________________
]8P
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43437
Location: 56N 3W

PostPosted: Mon Jul 03, 2017 11:48 am    Post subject: Reply with quote

stardotstar,

First some advice on using the forums. Until you have a response, edit your original post to add more information.
If you reply to yourself, your thread no longer appears in the View unanswered posts search and your query may bis missed.

You talk about UEFI and show
Code:
fdisk -t dos /dev/nvme0n1


Its not possible to use UEFI without a GPT partition table. Windows 10 enforces the use of GPT too.
With a GPT partition table, you still get a DOS partition table too but it only serves as a warning that GPT is in use.
It will contain a single partition of type ee.

Its quite possible to edit the DOS partition table and destroy things described by the GPT partition table.
With a modern fdisk, it won't harm the GPT partition table itself though.

So, before we try to fix things, what does
Code:
fdisk -t gpt /dev/nvme0n1
show?
It should show the GPT partition table contents, if it exists.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Mon Jul 03, 2017 12:22 pm    Post subject: Reply with quote

Sincerely, my apologies my dear Mr Seagoon; certainly, I should have known better than to reply to my own post :oops: . Indeed, I've since noted the sticky thread for partitioning problems so that's a double faux pas it seems.

As it happens, whilst I knew I was dealing with GPT and the need for a working ESP the command/s I used were based on educated guesswork and I thought that the 'dos' label was still valid as a means of accessing the partitions, for example:

Code:
Disk /dev/nvme0n1p4: 28 GiB, 29999759360 bytes, 58593280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xb8a13690


Even though I know (now) that this is in fact the Linux SWAP partition for my Mint system.

I expect this is because I have misused the fdisk command with the dos option but I am in way over my head at this stage what with everything having been broken to the point of starting from scratch so I guess I was clutching at straws :)

In keeping with my history of ceaseless meddling I have, on this occasion, made things better rather than worse.

Nothing I did with the GUI Tools of the Windows 10 Boot USB managed to "repair" the system.

I was getting messages about a missing disk partition - which I assume was a recognisable ESP for the Win boot loader.

However, my duck-duck efforts were rewarded with this URL which, after following the instructions exactly as listed from the DOS command prompt provided by the Win10 Boot Disk produced a working Win Boot loader in the UEFI Boot menu.

For the record, and in the hope that someone may search back here with a similar problem the site is:
http://www.disk-partition.com/windows-10/required-drive-partition-missing-windows-10-5740i.html

and the commands I entered in the dos prompt verbatim, with success being reported on each one.

Code:

BOOTREC /SCANOS

BOOTREC /FIXMBR

BOOTREC /FIXBOOT

BOOTREC /REBUILDBCD


However, upon selecting the Windows system failed to boot, it rather went to the Dell UEFI Hardware Test Suite.
I booted into the rescue disk again, ran the repair an existing system tool and this time it "saw" the existing Win10 system and upon selecting it successfully repaired it.

Finally, I have confirmed that my Mint environment boots fine and after starting Win10 I managed to shrink the Windows partition by 250G which will make emough room for me to put my Gentoo system in place with the recommendations of the Handbook. Once it's all up and running I'll make a decision about the space currently being hogged by Mint.

Once again, sorry for the self-indulgent posting and apologies for wasting your time in trying to help me get unstuck - I do very much appreciate it!

I'm jumping into Mint now prior to setting up for my Gentoo build to put the results of the command you suggest before I do anything else

Thanks again,
Will

[edit]
Here is the fdisk output for the correct partitioning context.

Code:
will-XPS-15-9560 will # fdisk -t gpt -l /dev/nvme0n1
Disk /dev/nvme0n1: 953.9 GiB, 1024209543168 bytes, 2000409264 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 756C7429-43D7-4B35-9280-E176570E9F37

Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1 1484722176 1485772799    1050624   513M EFI System
/dev/nvme0n1p2     206848     239615      32768    16M Microsoft reserved
/dev/nvme0n1p3     239616 1189881855 1189642240 567.3G Microsoft basic data
/dev/nvme0n1p4 1485772800 1544366079   58593280    28G Linux swap
/dev/nvme0n1p5 1544366080 2000408575  456042496 217.5G Linux filesystem

Partition table entries are not in disk order.


So this seems to make perfect sense - the 700+G Windows Partition has been shrunk to 567.3G, my 217G Mint system is unchanged, the swap shows as expected and there is the n1p1 that is 513M ESP (I think), the special 16M that Microsoft have to have reserved and properly pointed to from the n1p1 and the unpartitioned space shows up thusly:
Code:

Command (m for help): F
Unpartitioned space /dev/nvme0n1: 140.7 GiB, 151063101440 bytes, 295045120 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

     Start        End   Sectors   Size
      2048     206847    204800   100M
1189881856 1484722175 294840320 140.6G

Command (m for help):


So, my bad using the dos syntax, thank you for showing me the correct usage Neddy.
Will
_________________
]8P
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43437
Location: 56N 3W

PostPosted: Mon Jul 03, 2017 12:34 pm    Post subject: Reply with quote

stardotstar,

On a disk with a GPT disk label
Code:
 fdisk -t dos -l /dev/sda
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors  Size Id Type
/dev/sda1  *        1 3907029167 3907029167  1.8T ee GPT

Partition 1 does not start on physical sector boundary

Notice the ID of ee and type GPT. This is the warning that GPT is in use and that this partition table is a fake.

On the same disk
Code:
fdisk -t gpt -l /dev/sda
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: AC420C5F-F4BE-47A9-9CD4-F56645A1D63E

Device        Start        End    Sectors  Size Type
/dev/sda1      2048      63487      61440   30M Linux filesystem
/dev/sda2     63488   16001023   15937536  7.6G Linux filesystem
/dev/sda3  16001024 3907028991 3891027968  1.8T Linux filesystem

shows the 'real' partition table
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Mon Jul 03, 2017 1:28 pm    Post subject: Reply with quote

Got it! Thank you sir.
Best,
Will
_________________
]8P
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Wed Jul 05, 2017 9:39 am    Post subject: Reply with quote

Please sanity check the following before I find that I can't boot my newly built Gentoo:

I have the following UUIDs and made my fstab. I compared my fstab with the fstab that the LinuxMint environment boots with. I note that because I have Gentoo / on one partition the /boot is ext4 and mounts with / and the settings noauto and discard per the handbook for NVMe SDDs.

Code:
UUID=a11e1caf-d4c3-46a8-9813-ec477b532def      none      swap      sw      0 0
UUID=e2269c52-4a8a-4e0a-875b-2cba25880fbb      /      ext4      noatime,discard   0 1
UUID=fa50e7eb-eed9-4bcf-8ea3-4a66e97c0d3c      /home      ext4      noatime,discard 0 2
UUID=8539ce4c-8106-43ef-a02b-7ab7d151963e      /mnt/mint   ext4      noatime,discard 0 3


The blkid yields the following:

Code:
/dev/nvme0n1p1: UUID="D833-C435" TYPE="vfat" PARTUUID="92deca30-d916-45ca-bb36-c759fd0a6649"
/dev/nvme0n1p3: UUID="90DEC301DEC2DF1A" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="d6a24b0d-844b-4bac-8718-f2457bb9f39f"
/dev/nvme0n1p4: UUID="a11e1caf-d4c3-46a8-9813-ec477b532def" TYPE="swap" PARTUUID="fc7abe7a-e59b-461c-812b-2bfd6f61f253"
/dev/nvme0n1p5: UUID="8539ce4c-8106-43ef-a02b-7ab7d151963e" TYPE="ext4" PARTUUID="67af9314-defb-45d4-bce1-55ef7b725ce7"
/dev/nvme0n1p6: UUID="e2269c52-4a8a-4e0a-875b-2cba25880fbb" TYPE="ext4" PARTUUID="77d93d41-4384-4c12-b22a-74f0dbb417f5"
/dev/nvme0n1p7: UUID="fa50e7eb-eed9-4bcf-8ea3-4a66e97c0d3c" TYPE="ext4" PARTUUID="7ed06c8a-1a80-43bc-8bf5-8c22913b6740"
/dev/nvme0n1: PTUUID="756c7429-43d7-4b35-9280-e176570e9f37" PTTYPE="gpt"
/dev/nvme0n1p2: PARTLABEL="Microsoft reserved partition" PARTUUID="5883c880-99c1-4c0f-996e-cc15d9ed500e"


And I know that:

    n1p3 is win10pro (ntfs)
    n1p4 is swap (for both Gentoo and Mint (they should not cross-contaminate in how I want to use this machine)
    n1p5 is Mint (ext4)
    n1p6 is Gentoo / (ext4)
    n1p7 is Gentoo /home (ext4)

n1 itself is the gpt label which I am assuming is actually data read from
/dev/nvme0n1p1: UUID="D833-C435" TYPE="vfat" PARTUUID="92deca30-d916-45ca-bb36-c759fd0a6649"

vfat being what I read is the default for ESPs.

So here is the Mint fstab

Code:
livecd /boot # cat /mnt/mint/etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p5 during installation
UUID=8539ce4c-8106-43ef-a02b-7ab7d151963e /               ext4    noatime,errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=D833-C435  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/nvme0n1p4 during installation
UUID=415cdaef-7896-441d-98b0-031208ccf865 none            swap    sw              0       0


I note that curiously the UUID for the swap partition is different to what it is reported as under the Gentoo Live CD (chrooted) install environment I am in now, but the n1p5 partition is the same:


Code:

Mint n1p5: UUID=8539ce4c-8106-43ef-a02b-7ab7d151963e /               ext4    noatime,errors=remount-ro 0       1
Gentoo p5: UUID=8539ce4c-8106-43ef-a02b-7ab7d151963e      /mnt/mint   ext4      noatime,discard 0 3


Mint vs Gentoo swap (n1p4):
Code:

_MINT_: UUID=415cdaef-7896-441d-98b0-031208ccf865
GENTOO: UUID=a11e1caf-d4c3-46a8-9813-ec477b532def


So, aside from that I wonder if I need to mount the ESP/GPT partition to my Gentoo /boot/efi ?

The handbook seems to suggest this but I couldn't find anything in the earlier preping the disks section except to maybe create an efi vfat part - but since I have one do I need to mount it to /boot/efi or what?

TIA
Will


[edit]

Here is the n1p1 partition, which does include the boot "stuff" for e3verything else:

Code:
livecd /boot # mkdir /mnt/efi
livecd /boot # mount /dev/nvme0n1p1 /mnt/efi
livecd /boot # ls
'System Volume Information'  boot  efi
livecd /boot # cd /mnt/efi
livecd /mnt/efi # ls
EFI  Temp
livecd /mnt/efi # cd EFI/
livecd /mnt/efi/EFI # ls
Boot  Dell  Microsoft  ubuntu
livecd /mnt/efi/EFI # cd Boot/
livecd /mnt/efi/EFI/Boot # ls
bootx64.efi
livecd /mnt/efi/EFI/Boot # cd ..
livecd /mnt/efi/EFI # cd Dell/
livecd /mnt/efi/EFI/Dell # ls
Bios  logs
livecd /mnt/efi/EFI/Dell # cd ..
livecd /mnt/efi/EFI # cd Microsoft/
livecd /mnt/efi/EFI/Microsoft # ls
Boot  Recovery
livecd /mnt/efi/EFI/Microsoft # cd ..
livecd /mnt/efi/EFI # ls ubuntu/
fw  fwupx64.efi  grub.cfg  grubx64.efi  mmx64.efi  shimx64.efi
livecd /mnt/efi/EFI #

_________________
]8P
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2644

PostPosted: Wed Jul 05, 2017 10:09 am    Post subject: Reply with quote

stardotstar wrote:
So, aside from that I wonder if I need to mount the ESP/GPT partition to my Gentoo /boot/efi ?

The handbook seems to suggest this but I couldn't find anything in the earlier preping the disks section except to maybe create an efi vfat part - but since I have one do I need to mount it to /boot/efi or what?

That alternative mount point seems to be very popular and is very confusing, indeed. It's best explained in b1) grub and efi on different partitions:. I've tried to summarize ESP in this wiki article.
P.S.: There is no need to mount it unless you are updating the kernel or other efi applications. Even the entry in /etc/fstab is only for convenience. Root should be able to mount it without. Bootlmanagers like grub2 or refind do not read fstab for booting.


Last edited by charles17 on Wed Jul 05, 2017 10:23 am; edited 1 time in total
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Wed Jul 05, 2017 10:22 am    Post subject: Reply with quote

So, when I *install* grub will it automagically do the right thing with respect to the other containers in there - ie will it make its own gentoo one that the BIOS boot loader will see?

When I hit F12 on Dell logo POST I see the UEFI bootable options that the BIOS "sees" currently the ones in there - so I see Windows and Mint.

If I use the command the Handbook recommends:

Code:
grub-install --target=x86_64-efi --efi-directory=/boot


Then it will do its thing in the currently mounted partition (/) with /boot on it and yet that won't do a thing to make the system "seen" by BIOS.

what if I mount that GPT partition as /boot on my Gentoo system - will it then play nice with the others "in there"


--- Ah, but I've suddenly had a revelation... The current /boot is actually the USB Live CD in the chrooted environment:

Code:
livecd /mnt/efi/EFI # cd /boot
livecd /boot # ls
'System Volume Information'  boot  efi
livecd /boot # cd 'System Volume Information'/
livecd /boot/System Volume Information # ls
IndexerVolumeGuid
livecd /boot/System Volume Information # cat IndexerVolumeGuid
{243AB257-36DD-4861-B3BB-7F8CDE75C47A}livecd /boot/System Volume Information # cd ..
livecd /boot # ls
'System Volume Information'  boot  efi
livecd /boot # cd boot
livecd /boot/boot # ls
grub
livecd /boot/boot # cd grub/
livecd /boot/boot/grub # ls
fonts  grub.cfg  locale  themes


There's lots of stuff in there that, being on /dev/sda is of no relevance to my new system at all.

So I'm planning to umount /boot and making a fstab entry for boot for my new system that is the vfat GPT partition n1p1

Sound ok?


Code:
UUID=D833-C435                  /boot      vfat      noauto      0 4
UUID=a11e1caf-d4c3-46a8-9813-ec477b532def      none      swap      sw      0 0
UUID=e2269c52-4a8a-4e0a-875b-2cba25880fbb      /      ext4      noatime,discard   0 1
UUID=fa50e7eb-eed9-4bcf-8ea3-4a66e97c0d3c      /home      ext4      noatime,discard 0 2
UUID=8539ce4c-8106-43ef-a02b-7ab7d151963e      /mnt/mint   ext4      noatime,discard 0 3


and to hedge my bets I've made a copy of that whole partition with cp -a and then done the grub install to both /boot and /boot/EFI/gentoo

Code:
livecd ~ # grub-install --target=x86_64-efi --efi-directory=/boot
Installing for x86_64-efi platform.
Installation finished. No error reported.
livecd ~ # cd /boot
livecd /boot # ls
EFI  Temp  grub
livecd /boot # cd grub/
livecd /boot/grub # ls
fonts  grubenv  locale  themes  x86_64-efi
livecd /boot/grub # cd ..
livecd /boot # cd EFI
livecd /boot/EFI # ls
Boot  Dell  Microsoft  gentoo  ubuntu
livecd /boot/EFI # grub-install --target=x86_64-efi --efi-directory=/boot/EFI/gentoo
Installing for x86_64-efi platform.
Installation finished. No error reported.
livecd /boot/EFI #

_________________
]8P
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43437
Location: 56N 3W

PostPosted: Wed Jul 05, 2017 10:35 am    Post subject: Reply with quote

stardotstar,

Do not confuse BIOS and UEFI. You may not use both. Well, its not trivial anyway.
If you do manage to use both, you will have to switch the system firmware between BIOS and UEFI modes. That will become annoying.

With UEFI, you must use GPT. Windows 10 only works that way.
With BIOS you may be able to use GPT but its not a given. e.g. some Dells prevent it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2644

PostPosted: Wed Jul 05, 2017 10:41 am    Post subject: Reply with quote

stardotstar wrote:
So, when I *install* grub will it automagically do the right thing with respect to the other containers in there - ie will it make its own gentoo one that the BIOS boot loader will see?

When I hit F12 on Dell logo POST I see the UEFI bootable options that the BIOS "sees" currently the ones in there - so I see Windows and Mint.
To have your bootloaders or efi stub kernels in F8, F12, see efibootmgr.

stardotstar wrote:
If I use the command the Handbook recommends:

Code:
grub-install --target=x86_64-efi --efi-directory=/boot
For an EFI capable computer you might try refind instead of grub2.

stardotstar wrote:
Then it will do its thing in the currently mounted partition (/) with /boot on it and yet that won't do a thing to make the system "seen" by BIOS.

what if I mount that GPT partition as /boot on my Gentoo system - will it then play nice with the others "in there"
You only need to mount it before adding new kernel (and/or initramfs) images. And it is just only a path. Are you having /boot and EFI on different partitions?
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Wed Jul 05, 2017 10:47 am    Post subject: Reply with quote

NeddyS, I am confusing things by using the term BIOS for the processes and sequences that the system goes through during the UEFI initialisation and POST period.

I am aware of the distinction but still find it difficult to articulate exactly what I am seeing/doing. Whilst the system has Legacy Boot enabled I am focusing on using UEFI/GPT/ESP as my route into the system.

I am not sure what method the Mint system has created for me. But I know it appears to the machine in UEFI boot menu named "Linux Mint" under "Windows Boot Loader".

Charles, thanks for the tip on sifting through these options - it does look like I should investigate efibootmgr and refind (that's totally new ground to me so I'll do some reading).

I mounted that partition to /boot on my Gentoo system and did a genkernel all
This has, of course, put the grub directory and the kernels in /boot so if the system is diving deeper into the EFI subdirectory it won't be found.

Code:
livecd /boot/EFI # ls /boot
EFI  System.map-genkernel-x86_64-4.9.34-gentoo  Temp  grub  initramfs-genkernel-x86_64-4.9.34-gentoo  kernel-genkernel-x86_64-4.9.34-gentoo
livecd /boot/EFI #



edit

this looks promising

Code:

livecd /boot/EFI # efibootmgr -v
BootCurrent: 0009
Timeout: 2 seconds
BootOrder: 0007,0000,0008,0001,0004,0003,0005,0006,0002,0009
Boot0000* Windows Boot Manager   HD(1,GPT,92deca30-d916-45ca-bb36-c759fd0a6649,0x587f1000,0x100800)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................
Boot0001* Linux Mint   PciRoot(0x0)/Pci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,AC-E4-2E-71-80-00-21-E4)/HD(1,GPT,92deca30-d916-45ca-bb36-c759fd0a6649,0x587f1000,0x100800)/File(\EFI\ubuntu\grubx64.efi)
Boot0002  Diskette Drive   BBS(Floppy,Diskette Drive,0x0)..BO
Boot0003* M.2 PCIe SSD   BBS(HD,P0: PC300 NVMe SK hynix 1TB,0x0)..BO
Boot0004* USB Storage Device   BBS(USB,Seagate Expansion 0502,0x0)..BO
Boot0005  CD/DVD/CD-RW Drive   BBS(CDROM,CD/DVD/CD-RW Drive,0x0)..BO
Boot0006  Onboard NIC   BBS(Network,Onboard NIC,0x0)..BO
Boot0007* gentoo   HD(1,GPT,92deca30-d916-45ca-bb36-c759fd0a6649,0x587f1000,0x100800)/File(\EFI\gentoo\grubx64.efi)
Boot0008  ubuntu   HD(1,GPT,92deca30-d916-45ca-bb36-c759fd0a6649,0x587f1000,0x100800)/File(\EFI\ubuntu\shimx64.efi)
Boot0009* UEFI: Lexar USB Flash Drive 8.07, Partition 1   PciRoot(0x0)/Pci(0x14,0x0)/USB(0,0)/HD(1,MBR,0x2,0x1ef18,0x8800)..BO


and maybe some complications:

Code:
livecd /boot/EFI # refind-install
ShimSource is none
Installing rEFInd on Linux....
ESP was found at /boot using vfat
Copied rEFInd binary files

Copying sample configuration file as refind.conf; edit this file to configure
rEFInd.

Installing it!

ALERT: There were problems running the efibootmgr program! You may need to
rename the refind_x64.efi binary to the default name (EFI/BOOT/bootx64.efi
on x86-64 systems, EFI/BOOT/bootia32.efi on x86 systems, or
EFI/BOOT/bootaa64.efi on ARM64 systems) to have it run!

Creating //boot/refind_linux.conf; edit it to adjust kernel options.

ALERT:
Installation has completed, but problems were detected. Review the output for
error messages and take corrective measures as necessary. You may need to
re-run this script or install manually before rEFInd will work.


Well I rebooted and it saw a gentoo UEFI menu item but it goes straight to GRUB console.
I better do some work now and come back to tackle this fresh.
I will chroot and resume as soon as practical.
_________________
]8P


Last edited by stardotstar on Wed Jul 05, 2017 11:02 am; edited 1 time in total
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2644

PostPosted: Wed Jul 05, 2017 10:57 am    Post subject: Reply with quote

stardotstar wrote:
I mounted that partition to /boot on my Gentoo system and did a genkernel all
This has, of course, put the grub directory and the kernels in /boot so if the system is diving deeper into the EFI subdirectory it won't be found.

Code:
livecd /boot/EFI # ls /boot
EFI  System.map-genkernel-x86_64-4.9.34-gentoo  Temp  grub  initramfs-genkernel-x86_64-4.9.34-gentoo  kernel-genkernel-x86_64-4.9.34-gentoo
livecd /boot/EFI #
Please compare to the directory structure shown in https://wiki.gentoo.org/wiki/EFI_System_Partition.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2644

PostPosted: Wed Jul 05, 2017 11:04 am    Post subject: Reply with quote

stardotstar wrote:
this looks promising

Code:

livecd /boot/EFI # efibootmgr -v
BootCurrent: 0009
Timeout: 2 seconds
BootOrder: 0007,0000,0008,0001,0004,0003,0005,0006,0002,0009
Boot0000* Windows Boot Manager   HD(1,GPT,92deca30-d916-45ca-bb36-c759fd0a6649,0x587f1000,0x100800)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................
Boot0001* Linux Mint   PciRoot(0x0)/Pci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,AC-E4-2E-71-80-00-21-E4)/HD(1,GPT,92deca30-d916-45ca-bb36-c759fd0a6649,0x587f1000,0x100800)/File(\EFI\ubuntu\grubx64.efi)
Boot0002  Diskette Drive   BBS(Floppy,Diskette Drive,0x0)..BO
Boot0003* M.2 PCIe SSD   BBS(HD,P0: PC300 NVMe SK hynix 1TB,0x0)..BO
Boot0004* USB Storage Device   BBS(USB,Seagate Expansion 0502,0x0)..BO
Boot0005  CD/DVD/CD-RW Drive   BBS(CDROM,CD/DVD/CD-RW Drive,0x0)..BO
Boot0006  Onboard NIC   BBS(Network,Onboard NIC,0x0)..BO
Boot0007* gentoo   HD(1,GPT,92deca30-d916-45ca-bb36-c759fd0a6649,0x587f1000,0x100800)/File(\EFI\gentoo\grubx64.efi)
Boot0008  ubuntu   HD(1,GPT,92deca30-d916-45ca-bb36-c759fd0a6649,0x587f1000,0x100800)/File(\EFI\ubuntu\shimx64.efi)
Boot0009* UEFI: Lexar USB Flash Drive 8.07, Partition 1   PciRoot(0x0)/Pci(0x14,0x0)/USB(0,0)/HD(1,MBR,0x2,0x1ef18,0x8800)..BO

If these all were EFI stub kernels ... :-)
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Wed Jul 05, 2017 11:05 am    Post subject: Reply with quote

OK, that looks encouraging - I do indeed have the EFI directory and see Windows and ubuntu as expected, so that is where I created gentoo but clearly something has gone wrong and vmlinuz was not installed there correctly for the genkernel. I'll have to wait till I can restart and chroot etc to play again as I have some work to do in Mint.
I may even have a play with the grub console to see if I can force it somehow'
_________________
]8P
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2644

PostPosted: Wed Jul 05, 2017 11:14 am    Post subject: Reply with quote

stardotstar wrote:
... but clearly something has gone wrong and vmlinuz was not installed there correctly for the genkernel. '

You can always manually copy the kernel to the right place, see https://wiki.gentoo.org/wiki/Talk:EFI_stub_kernel#Replace_.22make_install.22.3F.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2644

PostPosted: Wed Jul 05, 2017 11:22 am    Post subject: Reply with quote

stardotstar wrote:
.. Whilst the system has Legacy Boot enabled ...

I've recently got this almost 5 years old Dell Latitude E6430 (CYRTRY1) and the very first I did when I got it was turning off Legacy Boot and switch partition table from msdos to gpt.
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Thu Jul 06, 2017 3:07 am    Post subject: Reply with quote

So, I turned legacy boot on when I found that I needed it for some USB Live Rescue CDs etc to boot. That is probably unnecessary now and I think your suggestion to turn it off will certainly reduce the complications :)
_________________
]8P
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43437
Location: 56N 3W

PostPosted: Thu Jul 06, 2017 8:45 am    Post subject: Reply with quote

stardotstar,

System Rescue CD will boot from UEFI.
Its even Gentoo based.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum