Live data from Hacker News

Linux boot partitions and how to set them up

0pointer.net

1–10 of 184 posts

Re: Linux boot partitions and how to set them up

#4
Even Windows has a separate, NTFS boot partition these days. Fail to see the point of this, and since the main take basically is "put your /boot inside the FAT ESP, or if not possible, make /boot a FAT partition", it's also bound to create a lot of disagreement.

Re: Linux boot partitions and how to set them up

#5

Great to see Lennart back working on what systemd does best: streamlining and cleaning existing grubby (pun intended) parts of Linux. /boot (and ESP) management always feels hacky at best.

Can you explain what about the boot partition status quo seems hacky, and how this approach "cleans" it?

Re: Linux boot partitions and how to set them up

#6
How to make one boot partition to rule them all (debian, secure boot disabled for UEFI due to weird bug with how files are laid out with removable flag):

  parted -s "${diskpath}" mklabel gpt
  parted -s "${diskpath}" mkpart primary 1MiB 2MiB
  parted -s "${diskpath}" set 1 bios_grub on
  parted -s "${diskpath}" mkpart primary 2Mib 202MiB
  parted -s "${diskpath}" set 2 esp on
  sleep 1
  mkfs.fat -F 32 -n "boot" "${diskpath}2"
  mount "/dev/disk/by-label/boot" "/boot"
  grub-install --target=i386-pc "${diskpath}"
  grub-install --target=x86_64-efi --efi-directory=/boot --removable --no-uefi-secure-boot
  grub-mkconfig > "/boot/grub/grub.cfg"
This makes two partitions, one for GRUB to inject legacy BIOS boot code into and one for the ESP. ESP gets mounted to /boot, grub gets setup to support both. Only bug is Debian complains about symlinking .bak files for initrd, no biggie.

(This is part of a larger Debian imaging script I made)

Re: Linux boot partitions and how to set them up

#8

Using ZFS makes this all a lot simpler.

I fail to see how? The ESP partition must be vFAT on GPT, in order for the BIOS to find it. Your BIOS doesn't speak ZFS.

The main partition can be whatever, but that's not typically available until after the kernel & initramfs are loaded. (As it is typically initramfs that does the prompt for the password, to decrypt it.)

Re: Linux boot partitions and how to set them up

#10
As growing the size of an existing ESP is problematic (for example, because there’s no space available immediately after the ESP, or because some low-quality firmware reacts badly to the ESP changing size)

Code quality of the firmware in typical systems is known to not always be great. When relying on the file system driver included in the firmware it’s hence a good idea to limit use to operations that have a better chance to be correctly implemented.

Remind me again why I should cater to people who insist on writing and running terrible code.

Post reply on HN