User:Jayofdoom/DiscoverablePartitions

From Gentoo Wiki
Jump to:navigation Jump to:search

Discoverable partitions allows you to put information about how to deal with your disk partitions in your partition table metadata. This can enable you to boot with minimal additional configuration beyond normal disk configuration steps.

This is not a comprehensive guide, it shows a simple case of how you can use this to get an system booted without an fstab.

General Steps

  1. Ensure your partitions are labelled properly for their types. Check the DiscoverablePartitionsSpec for all possible values.
  2. Use Systemd-boot as your bootloader. Others may work, as of now grub does not.
  3. Check your kernel command line.
    1. You do not want or need "root=/dev/whatever" or "ro" on it.
    2. Beware if migrating to systemd-boot: it will reuse the cmdline in use when you installed it.
    3. If you end up with an "ro" on your kernel command line your root will mount read only... and nothing will remount it rw.
    4. If you get things in your command line, and you want no command line:
      touch /etc/kernel/cmdline
      
      Alternatively, just populate that with the command line you want. And no ro or root= is needed or desired!
  4. If all your partitions are discoverable, delete the fstab! Otherwise, just delete the properly labelled partitions from the fstab.

Example

# lsblk -o NAME,MOUNTPOINTS,PARTTYPENAME,PARTTYPE
NAME   MOUNTPOINTS PARTTYPENAME        PARTTYPE
vda
├─vda1 /boot       EFI System          c12a7328-f81f-11d2-ba4b-00a0c93ec93b
├─vda2 [SWAP]      Linux swap          0657fd6d-a4ab-43c4-84e5-0933c84b4f4f
└─vda3 /           Linux root (x86-64) 4f68bce3-e8cd-4db1-96e7-fbcaf984b709
# mount | grep -E '(/boot|/ |swap)'
/dev/vda3 on / type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
systemd-1 on /boot type autofs (rw,relatime,fd=50,pgrp=1,timeout=120,minproto=5,maxproto=5,direct,pipe_ino=14673)
/dev/vda1 on /boot type vfat (rw,nosuid,nodev,noexec,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
# swapon
NAME      TYPE      SIZE USED PRIO
/dev/vda2 partition   4G   0B   -2

Gotchas

Automatic mounting is on demand

For things like /boot; they will not mount until/unless you need them. So don't fret if you manually check and they aren't there.