technix
Posts: 121
Joined: Sat Jul 13, 2013 4:55 pm

Does the Pi support booting from GPT drives?

Mon Jun 03, 2019 5:25 am

If I want to USB boot my Pi from a 6TB external USB hard drive, or if in the future a 4TB microSD card appeared on the market (likely very soon given Moore's Law) the Pi will need GPT boot support in order to make full use of it. So, can Pi boot from GPT?

If not, does this seem like a good idea for a future GPT implementation:
  • When GPT booting, the device must have an EFI System Partition, and as the standard specifies this ESP partition must be formatted as FAT32.
  • The usual contents of the FAT32 partition on the MBR scheme should be found in the root of ESP.
  • The kernel should be compiled with internal GPT support.

User avatar
manawyrm
Posts: 34
Joined: Mon Apr 15, 2013 6:18 am
Location: Alfeld (Leine), Germany
Contact: Website Twitter YouTube

Re: Does the Pi support booting from GPT drives?

Mon Jun 03, 2019 8:42 pm

It's not a big problem.

The standard EFI / EFI System Partition stuff is way to complicated and cluttered for the Raspberry Pi.

Pi's need their FAT32 boot partition to load the Linux kernel and after that everything is fine.
Using Hybrid MBR/GPT, the ROM/GPU bootloader can fetch the kernel and configuration.
Linux has no problem with GPT whatsoever, it will just work.

User avatar
HawaiianPi
Posts: 5267
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Does the Pi support booting from GPT drives?

Mon Jun 03, 2019 11:08 pm

technix wrote:
Mon Jun 03, 2019 5:25 am
...or if in the future a 4TB microSD card appeared on the market (likely very soon given Moore's Law) the Pi will need GPT boot support in order to make full use of it.
The current Pi computers will never boot from a 4TB micro SD card, as those will be SDUC cards and the Pi only supports up to SDXC (2TB max).

EDIT: Fixed GB/TB typo (oops). :oops:
Last edited by HawaiianPi on Sat Mar 28, 2020 7:10 am, edited 2 times in total.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

technix
Posts: 121
Joined: Sat Jul 13, 2013 4:55 pm

Re: Does the Pi support booting from GPT drives?

Thu Jul 04, 2019 5:49 am

HawaiianPi wrote:
Mon Jun 03, 2019 11:08 pm
technix wrote:
Mon Jun 03, 2019 5:25 am
...or if in the future a 4TB microSD card appeared on the market (likely very soon given Moore's Law) the Pi will need GPT boot support in order to make full use of it.
The current Pi computers will never boot from a 4GB micro SD card, as those will be SDUC cards and the Pi only supports up to SDXC (2TB max).
There is still USB boot though, which can go beyond that - 3TB and 4TB HDD's are fairly cheap already, and we have even 12TB HDD.

technix
Posts: 121
Joined: Sat Jul 13, 2013 4:55 pm

Re: Does the Pi support booting from GPT drives?

Thu Jul 04, 2019 5:54 am

manawyrm wrote:
Mon Jun 03, 2019 8:42 pm
It's not a big problem.

The standard EFI / EFI System Partition stuff is way to complicated and cluttered for the Raspberry Pi.

Pi's need their FAT32 boot partition to load the Linux kernel and after that everything is fine.
Using Hybrid MBR/GPT, the ROM/GPU bootloader can fetch the kernel and configuration.
Linux has no problem with GPT whatsoever, it will just work.
The idea here is to use the EFI System Partition as the FAT32 partition for the Pi when GPT booting. The only thing to be changed is how to find the FAT32 partition - first partition for MBR or first EFI System Partition for GPT. EFI System Partition is supposed to be FAT32 formatted anyway, so this is where Pi boot process and UEFI standard converge. Once that partition is found it treats it as if it is the regular FAT32 partition for the Pi.

LTolledo
Posts: 2857
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Does the Pi support booting from GPT drives?

Thu Jul 04, 2019 5:59 am

"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

drgeoff
Posts: 10364
Joined: Wed Jan 25, 2012 6:39 pm

Re: Does the Pi support booting from GPT drives?

Thu Jul 04, 2019 3:29 pm

HawaiianPi wrote:
Mon Jun 03, 2019 11:08 pm
technix wrote:
Mon Jun 03, 2019 5:25 am
...or if in the future a 4TB microSD card appeared on the market (likely very soon given Moore's Law) the Pi will need GPT boot support in order to make full use of it.
The current Pi computers will never boot from a 4GB micro SD card, as those will be SDUC cards and the Pi only supports up to SDXC (2TB max).
All current RPis boot fine from 4Gbyte cards. HawaiianPi typed "GB" instead of "TB".

jameshilliard
Posts: 9
Joined: Thu Aug 01, 2019 12:50 am

Re: Does the Pi support booting from GPT drives?

Mon Mar 23, 2020 6:53 pm

I wrote a patch for genimage so that it can generate a raspberry pi compatible hybrid-mbr partition table, Linux can then boot using a GPT rootfs partition by uuid partlabel.

partuuid example for cmdline.txt:

Code: Select all

root=PARTUUID=c0932a41-44cf-463b-8152-d43188553ed4
Buildroot developer

cleverca22
Posts: 345
Joined: Sat Aug 18, 2012 2:33 pm

Re: Does the Pi support booting from GPT drives?

Tue Mar 24, 2020 6:56 pm

of note, the rpi4 loads the `bootcode.bin` stage from SPI flash, so it could potentially be upgraded to support finding `start4.elf` on a GPT partitioned anything

but, if the mask-rom doesnt support GPT, you have no way to use `recovery.bin` for re-flashing/upgrading/unbricking, which could be a problem

so it would depend on how far ahead broadcom/the-foundation planned with the maskrom, and if the foundation chooses to add GPT to the SPI image

i could see GPT only on USB boot as a viable option, since USB is much more likely to be that huge, and `recovery.bin` cant work on USB anyways so they dont risk any problems by recommending GPT there

emma1997
Posts: 602
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Does the Pi support booting from GPT drives?

Tue Mar 24, 2020 7:18 pm

The simplest solution is convert to MBR with Windows 8 or 10 diskpart utility.

Personally it's getting very old having to fire up that despised Win10 computer every time a new portable drive comes in so it works on my beloved XP and DOS machines. I wonder if there's a way to convert to MBR with Raspbian?

jameshilliard
Posts: 9
Joined: Thu Aug 01, 2019 12:50 am

Re: Does the Pi support booting from GPT drives?

Tue Mar 24, 2020 7:25 pm

emma1997 wrote:
Tue Mar 24, 2020 7:18 pm
The simplest solution is convert to MBR with Windows 8 or 10 diskpart utility.

Personally it's getting very old having to fire up that despised Win10 computer every time a new portable drive comes in so it works on my beloved XP and DOS machines. I wonder if there's a way to convert to MBR with Raspbian?
Raspbian is just a normal debian based Linux distro, formatting disks with a standard MBR partition scheme is pretty darn trivial with Linux in general. Not sure what issue you're having exactly though, you should just be able to use something like fdisk to create a MBR partition table.
Buildroot developer

epoch1970
Posts: 4512
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Does the Pi support booting from GPT drives?

Tue Mar 24, 2020 7:30 pm

jameshilliard wrote:
Mon Mar 23, 2020 6:53 pm
I wrote a patch for genimage so that it can generate a raspberry pi compatible hybrid-mbr partition table, Linux can then boot using a GPT rootfs partition by uuid partlabel.

partuuid example for cmdline.txt:

Code: Select all

root=PARTUUID=c0932a41-44cf-463b-8152-d43188553ed4
Very cool!
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

emma1997
Posts: 602
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Does the Pi support booting from GPT drives?

Tue Mar 24, 2020 7:42 pm

jameshilliard wrote:
Tue Mar 24, 2020 7:25 pm
Raspbian is just a normal debian based Linux distro, formatting disks with a standard MBR partition scheme is pretty darn trivial with Linux in general. Not sure what issue you're having exactly though, you should just be able to use something like fdisk to create a MBR partition table.
Thank you. I did try this:

https://support.hostway.com/hc/en-us/ar ... -Partition

Two problems:

It took couple hours to get through the hundreds of lines involved. So there's nothing even vaguely similar to the 2 line diskpart way (clean+convert)?

Also it didn't work. No surprise. It would be a miracle for me to get it right with all those steps. At least not on 1st (or 5th) try. lol

I hate that W10 machine but will have to grin and bear if Linux is so tough. Just wondering if somebody had put together a script like Ron's backup utils etc which made it super easy.

jameshilliard
Posts: 9
Joined: Thu Aug 01, 2019 12:50 am

Re: Does the Pi support booting from GPT drives?

Tue Mar 24, 2020 8:17 pm

emma1997 wrote:
Tue Mar 24, 2020 7:42 pm
Thank you. I did try this:

https://support.hostway.com/hc/en-us/ar ... -Partition

Two problems:

It took couple hours to get through the hundreds of lines involved. So there's nothing even vaguely similar to the 2 line diskpart way (clean+convert)?

Also it didn't work. No surprise. It would be a miracle for me to get it right with all those steps. At least not on 1st (or 5th) try. lol

I hate that W10 machine but will have to grin and bear if Linux is so tough. Just wondering if somebody had put together a script like Ron's backup utils etc which made it super easy.
If you're struggling with command line disk formatting utilities try gparted.
Buildroot developer

emma1997
Posts: 602
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Does the Pi support booting from GPT drives?

Tue Mar 24, 2020 8:47 pm

Yes, that may be the perfect solution. I used it to expand /boot partition before finding an even easier way via CLI but didn't recall an MBR option. Maybe that's what 'MSDOS' meant. Now if only it works. I'll give it a try as soon as I get access to my Pi. Thanks for the tip.

Maybe solves the OP problem too.

jameshilliard
Posts: 9
Joined: Thu Aug 01, 2019 12:50 am

Re: Does the Pi support booting from GPT drives?

Thu Mar 26, 2020 1:39 am

emma1997 wrote:
Tue Mar 24, 2020 8:47 pm
Maybe that's what 'MSDOS' meant.
Yeah, MSDOS is effectively the same as a MBR partition scheme.
Buildroot developer

RonR
Posts: 849
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Does the Pi support booting from GPT drives?

Fri Mar 27, 2020 2:11 am

emma1997 wrote:
Tue Mar 24, 2020 7:42 pm
Just wondering if somebody had put together a script like Ron's backup utils etc which made it super easy.

Try this (!!! BACKUP FIRST !!!):

Booting Raspbian on large (>2TB) USB devices : Made Easy

emma1997
Posts: 602
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Does the Pi support booting from GPT drives?

Fri Mar 27, 2020 7:21 pm

Thanks James and Ron. It looks like exactly the fix but I have one question you might be able to help with. I understand the theory behind Hybrid MBR/GPT but what are practical implications regarding compatibility?

I need it to work under DOS6.3, XP, and Raspbian as it does now with Diskpart convert. Will a hybrid partition be any different as far as you know? And will there be any issues reverting back if so?

PS I absolutely learned my lesson about backing up when experimenting with Pi cards. In fact at least half dozen copies every time which is why I took extreme steps to trim down the process. Image-utils and 4G partition were key components.

This is for new WD Elements portable HDs so thankfully no need to back those up. Just return to mfg if FUBB. Their fault for switching to such a dumb default mode. Originally that model was all MBR. I shouldn't complain because we get to cash in on the thousands or millions returned by customers who can't even handle Diskpart. lol

jameshilliard
Posts: 9
Joined: Thu Aug 01, 2019 12:50 am

Re: Does the Pi support booting from GPT drives?

Fri Mar 27, 2020 8:24 pm

emma1997 wrote:
Fri Mar 27, 2020 7:21 pm
I need it to work under DOS6.3, XP, and Raspbian as it does now with Diskpart convert. Will a hybrid partition be any different as far as you know? And will there be any issues reverting back if so?
What actually needs to work under DOS6.3 and XP? With a hybrid MBR they would generally be able to see any partitions present in the hybrid MBR partition table(in my genimage generated image this would be the boot partition that contains the firmware/kernel).

So I gather you are booting directly to the USB hard disk? I'm generating the entire disk image including the hybrid MBR partition with genimage, my operating system(generated by buildroot) is extremely heavily customized compared to Raspbian but that shouldn't really have much impact here as the hybrid MBR partition is only really used for initial bootstrapping of the firmware/kernel so it should in theory work on Raspbian as well, I don't think diskpart is capable of generating a hybrid MBR partition scheme.
emma1997 wrote:
Fri Mar 27, 2020 7:21 pm
This is for new WD Elements portable HDs so thankfully no need to back those up. Just return to mfg if FUBB. Their fault for switching to such a dumb default mode. Originally that model was all MBR. I shouldn't complain because we get to cash in on the thousands or millions returned by customers who can't even handle Diskpart. lol
I'm a bit confused what the issue is here, it's pretty hard to permanently mess up a HD unless you are doing stupid things with firmware updates. The partition scheme is trivial to change between MBR and GPT on basically any disk(although MBR doesn't work properly on disks over 2TB). In general I'd recommend avoiding windows for anything other than writing raw images as the formatting utilities it has are rather primitive. For example my build system just generates a raw disk image that includes the hybrid MBR partition scheme that I dd to the sdcard.

One simple solution for you may be to use a SD card with a MBR partition table for your boot partition and kernel and then have it run using a rootfs on your external disk(since the Linux kernel has no problem reading GPT disks you then wouldn't need a hybrid MBR table.

To do this you would just change your external rootfs in cmdline.txt to something like this where the PARTUUID is the uuid of the rootfs partition on your external disk:

Code: Select all

root=PARTUUID=c0932a41-44cf-463b-8152-d43188553ed4
Buildroot developer

RonR
Posts: 849
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Does the Pi support booting from GPT drives?

Fri Mar 27, 2020 8:30 pm

emma1997 wrote:
Fri Mar 27, 2020 7:21 pm
I understand the theory behind Hybrid MBR/GPT but what are practical implications regarding compatibility?

I need it to work under DOS6.3, XP, and Raspbian as it does now with Diskpart convert. Will a hybrid partition be any different as far as you know? And will there be any issues reverting back if so?

Anything that deals with physical partitions has a good chance of getting into trouble with Hybrid MBR/GPT partition tables, Fortunately, it's not common for things to be working down at that level,

GPT partition tables are required on a disk that exceeds 2TB in size. MBR partition tables simply can't store sector numbers that are beyond 2TB. Newer operating systems, including Raspbian, understand GPT partition tables once booted, but the Raspberry Pi bootloader doesn't, hence the problem with booting on devices larger then 2TB (we'll have see if new Raspberry Pi 4 bootloaders eliminate this limitation). DOS and XP don't understand GPT partition tables. You'd have to experiment on a USB flash drive or SD card to see if they'll tolerate Hybrid MBR/GPT partition tables (Windows 8.1 does not).

If your disks are less than 2TB, then MBR partition tables are your safest bet.

jameshilliard
Posts: 9
Joined: Thu Aug 01, 2019 12:50 am

Re: Does the Pi support booting from GPT drives?

Fri Mar 27, 2020 9:03 pm

RonR wrote:
Fri Mar 27, 2020 8:30 pm
You'd have to experiment on a USB flash drive or SD card to see if they'll tolerate Hybrid MBR/GPT partition tables (Windows 8.1 does not).
From my understanding Windows 8.1(at least the normal x86_64 version) should have no trouble running from or reading a Hybrid MBR/GPT partition table assuming you have the appropriate table entries it needs set up properly, this is probably tricky due to windows partitioning tools not being very good. I haven't really experimented with this though(I try and stay away from Windows in general) and there are many variants of Hybrid MBR partitioning schemes that are possible as it's not something very well standardized.
Buildroot developer

emma1997
Posts: 602
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Does the Pi support booting from GPT drives?

Fri Mar 27, 2020 9:55 pm

Thanks again for taking time to help.
jameshilliard wrote:
Fri Mar 27, 2020 8:24 pm
What actually needs to work under DOS6.3 and XP?
New WD Elements portable HDs. One secondary partition with a 32g and a 1900g logical. I have 30 some already in use for years now and plan to get many more in the near future. Just looking for a way to avoid firing up the win 8.1 machine just for that.
jameshilliard wrote:
Fri Mar 27, 2020 8:24 pm
So I gather you are booting directly to the USB hard disk?
No. Pi4 is not capable and I've never had the need anyway. This is for storing mostly images and media files. Sneakernet between Pi and PC is orders of magnitude faster than ethernet or WIFI in my setup.
jameshilliard wrote:
Fri Mar 27, 2020 8:24 pm
I don't think diskpart is capable of generating a hybrid MBR partition scheme.
Correct. Which is why I'm wondering if it will cause trouble.
jameshilliard wrote:
Fri Mar 27, 2020 8:24 pm
I'm a bit confused what the issue is here, it's pretty hard to permanently mess up a HD unless you are doing stupid things with firmware updates.
Quite easy if you are following instructions letter for letter from WD tech support. This has happened more than once which is why I don't bother anymore. Often they know less than me and I'm a complete idiot.
jameshilliard wrote:
Fri Mar 27, 2020 8:24 pm
One simple solution for you may be to use a SD card with a MBR partition table for your boot partition and kernel and then have it run using a rootfs on your external disk(since the Linux kernel has no problem reading GPT disks you then wouldn't need a hybrid MBR table.

To do this you would just change your external rootfs in cmdline.txt to something like this where the PARTUUID is the uuid of the rootfs partition on your external disk:

Code: Select all

root=PARTUUID=c0932a41-44cf-463b-8152-d43188553ed4
I start to get nervous hearing Linux instructions that start with "one simple solution". :)

No booting or hybrid either I guess. What I need is an easy way to change GPT to MBR for generic portable (USB) HD. If it's going to take half a day I'll just stick with my current method. It takes less than a minute but unfortunately involves firing up a separate computer which actually takes longer than that. Thought it would be great to do it on the Pi like I'm doing with images now.

emma1997
Posts: 602
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Does the Pi support booting from GPT drives?

Fri Mar 27, 2020 10:13 pm

RonR wrote:
Fri Mar 27, 2020 8:30 pm
GPT partition tables are required on a disk that exceeds 2TB in size.
I find this not to be the case. Files and partitions are but drives can be at least up to 16tb from personal experience with WD MyBook models. It's GPT on Elements 2t not recognized at all which is my basic problem.
RonR wrote:
Fri Mar 27, 2020 8:30 pm
DOS and XP don't understand GPT partition tables. You'd have to experiment on a USB flash drive or SD card to see if they'll tolerate Hybrid MBR/GPT partition tables (Windows 8.1 does not).
Exactly. This is why I've been converting to MBR.

If it's true 8.1 (which is what I've been using on a couple netbooks) don't work then certainly NG for DOS and XP so not an option.

I was hoping to avoid much more experimenting than already but will spend a bit more if I can get Windows out of this particular loop. Maybe, using the example above, I can put together a simple script to do it. Hopefully the dd trick doesn't involve any of that hybrid BS but simple actual real MBR.

Thanks again guys for getting me pointed in the right direction.

edit: tb not gb
Last edited by emma1997 on Fri Mar 27, 2020 11:54 pm, edited 1 time in total.

jameshilliard
Posts: 9
Joined: Thu Aug 01, 2019 12:50 am

Re: Does the Pi support booting from GPT drives?

Fri Mar 27, 2020 10:17 pm

emma1997 wrote:
Fri Mar 27, 2020 9:55 pm
Quite easy if you are following instructions letter for letter from WD tech support. This has happened more than once which is why I don't bother anymore. Often they know less than me and I'm a complete idiot.
Was it actually bricked or did you just not know how to restore it? Other than trashing the firmware somehow on the hard driver controller I'm not really sure how it could get permanently bricked, the partition tables can be deleted and restored quite easily.

Here's a trick if partitioning utilities aren't working right and you want to fully wipe/reset a drive.

Code: Select all

sudo dd if=/dev/zero of=/dev/hdddevpathgoeshere bs=1M
emma1997 wrote:
Fri Mar 27, 2020 9:55 pm
I start to get nervous hearing Linux instructions that start with "one simple solution". :)
Yeah, guess I was assuming you fairly familiar with how Linux and surrounding tooling works since you were posting under a topic for a fairly exotic configuration(using GPT on the boot disk).
emma1997 wrote:
Fri Mar 27, 2020 9:55 pm
No booting or hybrid either I guess. What I need is an easy way to change GPT to MBR for generic portable (USB) HD. If it's going to take half a day I'll just stick with my current method. It takes less than a minute but unfortunately involves firing up a separate computer which actually takes longer than that. Thought it would be great to do it on the Pi like I'm doing with images now.
What you're trying to do is actually super simple and not remotely exotic, just use a Linux re-partitioning utility like gdisk(command line), fdisk(command line) or gparted(gui app) to change the disk from GPT to MBR(called "dos" in some utilities).
Buildroot developer

RonR
Posts: 849
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Does the Pi support booting from GPT drives?

Fri Mar 27, 2020 10:38 pm

jameshilliard wrote:
Fri Mar 27, 2020 9:03 pm
From my understanding Windows 8.1(at least the normal x86_64 version) should have no trouble running from or reading a Hybrid MBR/GPT partition table assuming you have the appropriate table entries it needs set up properly, this is probably tricky due to windows partitioning tools not being very good.

I was very surprised to see that Windows 8.1 is unhappy with a Hybrid MBR/GPT partition table, The table generation is totally trivial using gdisk. Windows Disk Management looks normal, but if I put the 0xEE partition as the last partition in the MBR, windows refuses to assign a drive letter to the w95 (0x0c) partition. If I put the 0xEE partition as the first partition in the MBR, Windows assigns a drive letter but says it's an unrecognized file system. I wish I could think of another option to try.

After reading your exchanges with emma1997, I don't think Hybrid MBR's are actually needed at the moment for Raspbian use. As soon as I get done cutting the grass (it's springtime in Arkansas), I'm going to look at reworking boot-gpt to make Hybrid MBR generation an option. Then it's default will be to simply convert an MBR partition table to GPT, with the options of resizing, setting the SD card to boot it, and enabling SSH.

Return to “Advanced users”