Live data from Hacker News

Linux boot partitions and how to set them up

0pointer.net

51–60 of 184 posts

Re: Linux boot partitions and how to set them up

#51

Earlier quoted context omitted.

Does it? On my Windows 11 install, the EFI partition is still FAT32. There are no other partitions than the C and the recovery partition. Am I missing something?

The commenter is saying that there is an NTFS boot partition that is chained after the ESP. So UEFI mounts and execs whatever is in the (vFAT) ESP, and then that ESP bootloader loads data from the (NTFS) boot partition.

MSR (that another partition) has no role in Windows boot. Windows will work without it being present at all.

Re: Linux boot partitions and how to set them up

#52
post #44

Earlier quoted context omitted.

Interesting. I've never really wanted on boot on ZFS, and I definitely don't see the point if I'd need a dedicated pool for it.

It could be really cool; it would let you snapshot your boot filesystem and roll back to a previous configuration. ...I say, as someone who does in fact leave my boot filesystems on VFAT:)

Ubuntu did snapshot the bpool; unfortunately, it did a poor job of garbage collecting the snapshots. Meaning that eventually you would have failing kernel updates due to lack of space, and having to manually clean it up.

Since 22.04, zsys (the tool that did the snapshoting) is not installed by default.

Re: Linux boot partitions and how to set them up

#53

Earlier quoted context omitted.

It could be really cool; it would let you snapshot your boot filesystem and roll back to a previous configuration. ...I say, as someone who does in fact leave my boot filesystems on VFAT:)

Ubuntu did snapshot the bpool; unfortunately, it did a poor job of garbage collecting the snapshots. Meaning that eventually you would have failing kernel updates due to lack of space, and having to manually clean it up. Since 22.04, zsys (the tool that did the snapshoting) is not installed by default.

> Since 22.04, zsys (the tool that did the snapshoting) is not installed by default.

Er, are they not snapshotting the root filesystem or ex. /home by default then?

Re: Linux boot partitions and how to set them up

#54
post #42

Earlier quoted context omitted.

There is less work, not more work.

This sounds like work to me > For booting the computers, I either boot them from Ethernet or I boot them from a small USB memory that uses a FAT file system for storing the OS kernel, either in the format required by UEFI booting, or, when booting Linux in legacy BIOS mode, together with syslinux, which loads the kernel. Creating boot USB drives (which I think need partitions don't they?) or setting up a PXE boot ser…

If the USB drives were bought formatted as FAT, which is always true for those smaller than 32 GB, they already have the required partition.

For booting with UEFI, you just need to create the directories with the names expected by the firmware. For legacy booting, you just need to install syslinux, which takes a second.

Then the USB drive can be used to boot any computer, without any other work, for many years.

When you change the kernel, you just mount the USB drive (which is not mounted otherwise), then you copy the new kernel to the USB drive (possibly together with an initrd file), renaming it during the copy, you unmount the USB drive and that is all.

You can keep around a few USB drives with different kernel versions, and if an update does not go well, you just replace the USB drive with one having an older version.

Configuring a DHCP/TFTP server for Ethernet booting is done only once.

Adding extra computers may need a directory copy in the directory of the TFTP server only when the new computers have a different hardware that requires different OS kernels.

Updating a kernel requires just a file copy towards the directory of the TFTP server, replacing the old kernel.

None of these operations requires more work than when using a boot partition on the root device.

There is less work because you make booting USB drives or a DHCP/TFTP server only once for many years or even decades, while you need to partition the SSD/HDD whenever you buy a new one that will be used as the root device.

Re: Linux boot partitions and how to set them up

#55

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" mo…

> grub-mkconfig > "/boot/grub/grub.cfg" Shell redirection is fine, but you could just use `grub-mkconfig -o` to set the output file.

Why? One more flag to remember whereas redirection works for any program.

Re: Linux boot partitions and how to set them up

#57

Earlier quoted context omitted.

Ubuntu did snapshot the bpool; unfortunately, it did a poor job of garbage collecting the snapshots. Meaning that eventually you would have failing kernel updates due to lack of space, and having to manually clean it up. Since 22.04, zsys (the tool that did the snapshoting) is not installed by default.

> Since 22.04, zsys (the tool that did the snapshoting) is not installed by default. Er, are they not snapshotting the root filesystem or ex. /home by default then?

No, you have to install and enable zsys yourself.

Re: Linux boot partitions and how to set them up

#58
post #40

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" mo…

> This makes two partitions, one for GRUB to inject legacy BIOS boot code into and one for the ESP. Why do you still need the legacy BIOS boot logic?

For BIOS boot, the BIOS looks at the first couple of blocks on a hard drive for the boot code. This is the first GPT partition that gets created, and the future grub-install code injects the BIOS bootloader there. Thus, to support BIOS and UEFI, you need the BIOS bootloader at the beginning of the drive.

Re: Linux boot partitions and how to set them up

#59

Earlier quoted context omitted.

> grub-mkconfig > "/boot/grub/grub.cfg" Shell redirection is fine, but you could just use `grub-mkconfig -o` to set the output file.

Why? One more flag to remember whereas redirection works for any program.

It doesn't matter which end of the egg.

Re: Linux boot partitions and how to set them up

#60

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.

Windows does not have a separate NTFS boot partition. MSR is not it (check the size and content). Windows Boot Manager and BCD are stored on the EFI partition. Windows Boot Manager itself does understand NTFS: it loads winload.efi, ntoskrnl.exe and core drivers from the system root itself. This way, Windows is not going to have the common linux problem ("update failed, /boot too small"). Two partitions are needed onl…

I'm talking about the WinRE partition, which is required to boot Bitlocker encrypted boot partition (and Bitlocker is enabled by default). Enabling Bitlocker without one results in an error message, and Windows happily recreates/resizes the WinRE partition on every (OS) upgrade by simply reducing the size of the main partition. It has been a long time that the size of the ESP is not enough for all the stuff that Windows wants to do on preboot.

For the record, and showing again the unfairness of the entire MS monopoly situation, most commercial UEFI implementations out there happen to understand NTFS. This allows e.g. a Windows pendrive to boot no matter how the user formats it.

Post reply on HN