Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 520162 - handbook section 4.a. - instructions to set bootable flag on GPT's protective MBR need a tweak for util-linux-2.24 changes
Summary: handbook section 4.a. - instructions to set bootable flag on GPT's protective...
Status: RESOLVED FIXED
Alias: None
Product: [OLD] Docs on www.gentoo.org
Classification: Unclassified
Component: Installation Handbook (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sven Vermeulen (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-18 02:55 UTC by Ben Kohler
Modified: 2015-01-24 18:46 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Kohler gentoo-dev 2014-08-18 02:55:10 UTC
sys-apps/util-linux-2.24.1-r3 has gone stable, and this new version's fdisk supports GPT natively.  This is great news!  BUT it means that the instructions in section 4.a. code listing 1.1 don't work as expected.  

"fdisk /dev/sda" will actually read/modify the real GPT label now, it won't read the protective MBR.  This needs to be changed to "fdisk -t dos /dev/sda" to force it to look at the MBR, *then* you can set the bootable flag as instructed.

Alternatively, if we want to document the parted method (seems like we're preferring parted these days?), that would be:

# parted /dev/sda
(parted) disk_set pmbr_boot on

Let me know if any more info is needed, thanks!
Comment 1 Ben Kohler gentoo-dev 2014-08-23 22:17:41 UTC
The other way to set this flag for GPT with fdisk is:

# fdisk /dev/sda
x (extra functionality / expert mode)
A (toggle the legacy BIOS bootable flag)
w (write/quit)
#
Comment 2 Sven Vermeulen (RETIRED) gentoo-dev 2015-01-03 10:06:02 UTC
Thanks. I've updated the fdisk instructions accordingly.

I'm not certain about the parted "disk_set pmbr_boot on", is this the same as toggling the boot flag as through fdisk? If so, is this the fix for bug #507454?

Also, if fdisk uses GPT now, what is the result of the "a" option in it then? Does that still set the bootable flag as documented?
Comment 3 Panagiotis Christopoulos (RETIRED) gentoo-dev 2015-01-04 14:11:40 UTC
Sven, 

I'm doing a new gentoo installation today and hit the issue on this cause the disk I'm trying to partition is 3Tb. The thing is, you say in the handbook about fdisk + GPT, however, if someone does "fdisk /dev/sda", the default disklabel will be DOS. You have to explicitly add "-t gpt" and I'm still doing the partitioning so don't know how/if it works. Will tell you more later.

<snip>
(chroot) rescue portage # fdisk -l /dev/sdb

Disk /dev/sdb: 2.7 TiB, 3000592982016 bytes, 5860533168 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
(chroot) rescue portage # fdisk -t dos /dev/sda

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
The size of this disk is 2.7 TiB (3000592982016 bytes). DOS partition table format can not be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).

Created a new DOS disklabel with disk identifier 0xae470aa9.

Command (m for help): quit

(chroot) rescue portage # fdisk -t gpt /dev/sda

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.

Command (m for help):
</snip>
Comment 4 Panagiotis Christopoulos (RETIRED) gentoo-dev 2015-01-04 14:13:31 UTC
See also the default behaviour:

<snip>
(chroot) rescue portage # fdisk /dev/sda

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
The size of this disk is 2.7 TiB (3000592982016 bytes). DOS partition table format can not be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).

Created a new DOS disklabel with disk identifier 0xd5642529.

Command (m for help): quit

(chroot) rescue portage #
</snip>
Comment 5 Panagiotis Christopoulos (RETIRED) gentoo-dev 2015-01-04 14:23:56 UTC
Also, this is what happens on me, when I try to creat a GPT partitioning schema using the stable util-linux's fdisk: 

<snip>
(chroot) rescue util-linux # fdisk /dev/sdb

Welcome to fdisk (util-linux 2.24.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
The size of this disk is 2.7 TiB (3000592982016 bytes). DOS partition table format can not be used on drives for volumes larger than (2199023255040 bytes) for 512-byte sectors. Use GUID partition table format (GPT).

Created a new DOS disklabel with disk identifier 0x096c885c.

Command (m for help): quit

(chroot) rescue util-linux # fdisk -t gpt /dev/sda

Welcome to fdisk (util-linux 2.24.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.

Command (m for help): n
fdisk: /var/tmp/portage/sys-apps/util-linux-2.24.1-r3/work/util-linux-2.24.1/libfdisk/src/label.c:163: fdisk_add_partition: Assertion `cxt->label' failed.
Aborted
(chroot) rescue util-linux #
</snip>
Comment 6 Sven Vermeulen (RETIRED) gentoo-dev 2015-01-04 15:11:17 UTC
Thanks a lot for testing this out. I've updated the instructions so that we recommend fdisk for MBR and parted for GPT (again), and added in a note that although fdisk should support GPT it has shown to still have some issues with it. I also included its default behavior of using MBR as layout, but with a note to watch its output just in case future fdisk versions change this behavior.
Comment 7 Sven Vermeulen (RETIRED) gentoo-dev 2015-01-24 18:46:24 UTC
Ok, keeping parted for GPT and fdisk for msdos in the instructions, so I think this bug can then be closed.