3

I have a 128GB SD card that I've partitioned into 4x30GB primary partitions and a 200MB EFI boot partition. I would like to be able to have four OS on this card, but can't find software that allows me to write to a partition on the SD card, just the whole card.

Is there a GUI driven tool that will allow me to select a partition on an SD card? I've tried Balena Etcher on macOS and Ubuntu, and YUMI on Windows, but none were able to to it.) Should I just use dd?

In addition, I will obviously need to provide a boot menu, for which I am planning to use rEFInd as I already use it on my MacBook Pro. Will the Pi4 boot off an EFI device?

1 Answer 1

1

An OS image is an abstract category that does not map 1:1 with filesystem or partition. Sometimes they are simply root filesystem images because that's all they have to be, in which case such an image is intended to be written to a singular partition and does map 1:1. We might more specifically call this a "filesystem image".

A Raspberry Pi OS image is not a filesystem image, it's a device image, meaning, it is a copy of a block storage device containing partitions, and not a copy of a single partition on a device. The device the image is intended to be written to is an SD card.

Because it is an entire device image, the SD card does not have to be prepared or formatted in any way first, and in fact if it is so prepared or otherwise has content of any sort, it is irrelevant because it will be overwritten by the image. The reason that instructions for creating the SD card sometimes include formatting it first is for the benefit of some high level tools that simply will not do anything with an unformatted device (except format it).

Will the Pi4 boot off a EFI device?

No. The requirements are very specific: The SD card must be DOS formatted (ie., contain an MBR). This doesn't contradict what I just said about how it doesn't matter how the card is or isn't formatted before you write the image to it, because the image itself contains that formatting.1 Which is why properly burning the image will simply overwrite whatever formatting is already in place.

Further, the first partition on the device must be vfat formatted and contain firmware files that are the first thing to load once the card is initialized. This is why Pi OS images usually contain two partitions: one small vfat one for the boot stuff (including the OS kernel) then one much bigger ext4 formatted one containing the root filesystem for the OS.

Should I just use dd?

You might as well, yes -- for the aforementioned reasons, nothing else is necessary -- but notice instructions for doing this indicate copying to a device, not a partition. Eg.

dd of=/dev/sdb

/dev/sdb is the device, whereas /dev/sdb1 would be the first partition on it, if any. Using the latter will not work, so using dd will not circumvent any issues re, how the card must be formatted.

NOOBS does allow for selecting between multiple OS's on a card, as does BerryBoot. They do not use bootloaders to do, though, I believe they boot a minimal system that allows you to choose, then that writes an appropriate config to the boot partition and reboots.


  1. In fact you can treat a Pi card image exactly as you would treat a DOS formatted device: You can examine the partition table and mount/modifiy/delete/create etc. the partitions in the image. Probably not all tools will do this, though, if they are restricted to devices that are presented by the operating system as system level devices.
2
  • Thanks for the explanation. I was always wondering why a device was being specified instead of a partition on it. The problem I have is that I have a huge amount of wasted space on the SD. I know I can reduce the partition size and recreate the others, but how can I put another OS onto one of the other partitions?
    – gone
    Commented Feb 9, 2020 at 6:32
  • You can upsize the primary partition to occupy the whole card if wasted space is the issue. Otherwise, if I was going to do this, I'd just manually edit /boot/cmdline.txt when I wanted to reboot to a different OS userland (it's the kernel root= parameter; kernel.org/doc/html/latest/admin-guide/kernel-parameters.html). Or I guess write a short command to do it for me if that turned out to be too much of a hassle. It does mean if you change your mind you'd have to boot completely, make the change, and reboot.
    – goldilocks
    Commented Feb 9, 2020 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.