rpi-imager icon indicating copy to clipboard operation
rpi-imager copied to clipboard

[FEATURE] Supporting Larger Drives (GPT)

Open Technologyman00 opened this issue 7 months ago • 16 comments

Is your feature request related to a problem? Please describe. Building a gpt file system is a frustrating task for drives that are larger than 2TB

Describe the solution you'd like I'd love to see rpi imager create a gpt partition tables to support larger 2TB partitions

Describe alternatives you've considered One can build the partitions themselves but it's difficult or impossible without a Linux environment

Additional context It's possible to boot a pi with GPT partition table https://forums.raspberrypi.com/viewtopic.php?t=319435

Technologyman00 avatar Dec 16 '23 22:12 Technologyman00

May need more than just GPT to make large drives work. E.g. chances are your drive has 4k sectors, which boot firmware.may not like. https://github.com/raspberrypi/rpi-imager/issues/505#issuecomment-1342261358

maxnet avatar Dec 16 '23 22:12 maxnet

My drives don't have 4k sectors. I'm just tired of doing it manually every time

Technologyman00 avatar Dec 16 '23 23:12 Technologyman00

RPi Imager simply copies whatever's in your disk-image-file directly onto your SD-card / HardDrive. So if your disk-image contains MBR partitions, then you'll get MBR partitions on your HardDrvie. If you want your HardDrive to use GPT partitions, then you need to ensure that your disk-image contains GPT partitions. I.e. the decision whether to use MBR or GPT isn't anything to do with Raspberry Pi Imager.

pi-gen is the tool that's used to build the Raspberry Pi OS images, and it creates MBR partitions for maximum compatibility. Perhaps you could patch pi-gen to create disk-images using GPT partitions instead?

impossible without a Linux environment

If you don't have a Linux environment, I guess an easy workaround is to boot your Raspberry Pi from SD-card, use that to setup the GPT partitions on your HardDrive, then remove the SD-card and reboot.

lurch avatar Dec 17 '23 13:12 lurch

If you want your HardDrive to use GPT partitions, then you need to ensure that your disk-image contains GPT partitions

Things are not always that simple...

The GPT backup table lives at end of drive... (That's why Imager already also zeroes out end of drive before write). So certainly it would need help from Imager if we want standard compliant GPT support. The only way someone could create a GPT disk image right now, that includes the backup GPT table as well, would be if the person creating the disk image is using the exact same size disk as the user.

But I still think it is a moot point to implement, as long as boot firmware is not properly rewritten first to support 4k sectors first. There may be large disks out there that still use 512 byte sectors as the TS mentioned. But the ones I have are 4k, and useless with Pi. And hard to explain to end-users that we would only support some large disks. With no easy way for them to tell which one they have, that is going to lead to support questions.

maxnet avatar Dec 17 '23 14:12 maxnet

The GPT backup table lives at end of drive... (That's why Imager already also zeroes out end of drive before write). So certainly it would need help from Imager if we want standard compliant GPT support

Ah good point, I'd forgotten about that! :laughing:

lurch avatar Dec 17 '23 14:12 lurch

Signal boosting this as I'm running a 4TB NVMe drive through the RPi 5 PCIe, and can only use 2TB as a boot drive using Imager. There doesn't seem to be any low-friction path for making anything larger than a 2TB a boot drive and using all the capacity. Sad Panda.

guru avatar Jan 09 '24 15:01 guru

@guru this is mostly because pi images come with a MBR partition table when you need GPT for higher than 2 TB. You also may run into block size issues for some larger drives. You can also try this, it's the easiest possible way https://forums.raspberrypi.com/viewtopic.php?f=29&t=196778

Technologyman00 avatar Jan 10 '24 04:01 Technologyman00

@Technologyman00 Thanks. Already went there and usb-boot rejected nvme* device as an invalid target. I got a solution for now, and it's only 20 simple steps ;)

As I say, signal boosting for a low-friction GPT (or glob forbid Hybrid) image available via Imager for a brighter future.

guru avatar Jan 10 '24 07:01 guru

Agreed here — I've been getting emails from people buying NVMe HATs and trying to use 4 TB (or even 8 TB!) drives with the Pi 5, and running into the 2 TB size limit.

Outside of those intimately familiar with Linux, I would never recommend someone try messing with partitions, so there's effectively no simple way to use drives larger than 2TB on the Pi 5 right now for boot.

As mentioned above, there are a few tweaks that would be required for Imager, but whatever internal process is used at Pi Towers to generate the OS images would also need to be changed to support GPT (not sure where an issue for that would need to be created).

geerlingguy avatar Jan 15 '24 16:01 geerlingguy

As mentioned above, there are a few tweaks that would be required for Imager, but whatever internal process is used at Pi Towers to generate the OS images would also need to be changed to support GPT (not sure where an issue for that would need to be created).

Technically, Imager could also add the GPT automagically on large disks, and it could work if the OS has an initramfs and is referring to its partitions by ext4 UUID. (PARTUUID would not do).

Problem that it will only work with 512 byte drives and not 4K sector drives would still exists though. That would need love from firmware folks to fix...

maxnet avatar Jan 15 '24 16:01 maxnet

Technically, Imager could also add the GPT automagically on large disks, and it could work if the OS is referring to its partitions by ext4 UUID.

This would be a big step forward. Getting a 4TB to work was a case of: partitioning via GPT, copying over the OS to each partition, updating the PARTUUIDs in the bootfs cmdline and rootfs fstab.

guru avatar Jan 15 '24 16:01 guru

Interestingly, https://www.google.com/search?q=nvme+4K+sector suggests that some SSDs can be switched between 512 byte sectors and 4KB sectors - I never knew that!

lurch avatar Jan 15 '24 16:01 lurch

I sent a message through the contact us on the raspberry pi website with a link to this GitHub issue. No idea if that will go anywhere but hopefully it helps something.

Technologyman00 avatar Jan 15 '24 19:01 Technologyman00

Signal boosting this as I'm running a 4TB NVMe drive through the RPi 5 PCIe, and can only use 2TB as a boot drive using Imager. There doesn't seem to be any low-friction path for making anything larger than a 2TB a boot drive and using all the capacity. Sad Panda.

So are you saying that the the other 2TB is lost in this case, can't be used? Or just not available as a boot drive? I just bought a Pi 5 8GB and I was planning to get a 4TB SSD using a Geekwork X1001 HAT for the SSD... I was going to partition the 4TB down into something like a 32GB partition for the RP system and then make a couple of other partitions that would be less than 2TB each. If this wouldn't work then my backup plan would be to use a 32GB micro SD for the OS and use the 4TB drive for the rest of the things I was going to do.

ralphwiles avatar Jan 19 '24 19:01 ralphwiles

So are you saying that the the other 2TB is lost in this case, can't be used?

Anything over 2TB can't be addressed using MBR formatting. The default RPi OS formats use MBR. So you have to format the drive as GPT or Hybrid MBR/GPT and install/transfer the OS yourself, which can be done. Or you format the drive as a GPT data drive, and boot from another drive.

guru avatar Jan 19 '24 19:01 guru