The Discoverable Partitions Specification
TL;DR: Let's automatically discover, mount and enable the root partition, /home, /srv and the swap partitions based on GUID Partition Tables (GPT)!
The GUID Partition Table (GPT) is mandatory on EFI systems. It allows identification of partition types with GUIDs. So far Linux has made little use of this, and mostly just defined one GUID for file system partitions and another one for swap partitions. With this specification we introduce a number of additional partition types in order to enable automatic discovery of partitions and their purpose. This has a couple of benefits:
- OS installers can automatically discover and make sense of partitions of pre-existing Linux installations
- The OS can discover and mount the necessary file systems with a non-existing or incomplete /etc/fstab file and without root= kernel command line option
- Container managers (such as nspawn and libvirt-lxc) can decode and set up file systems contained in GPT disk images automatically and mount them to the right places, thus allowing booting the same, identical images on bare-metal and in Linux containers. This enables true, natural portability of disk images between physical machines and Linux containers.
- As a help to administrators and users partition manager tools can show more descriptive information about partitions tables.
Note that the OS side of this scheme is implemented in systemd 211 and newer in the systemd-auto-gpt-generator(8) and systemd-efi-boot-generator(8) generator tools. Note that automatic discovery of the root or ESP partition only works if the boot loader communicates this information to the OS, by implementing the Boot Loader Interface.
Defined Partition Type GUIDs
|Partition Type GUID||Name||Allowed File Systems||Explanation|
|Any native, optionally in LUKS||On 32bit x86 systems the first x86 root partition on the disk the EFI ESP is located on is automatically mounted to the root directory /. If the partition is encrypted with LUKS the device mapper file will be named /dev/mapper/root.|
|Any native, optionally in LUKS||On 64bit x86 systems the first x86-64 root partition on the disk the EFI ESP is located on is automatically mounted to the root directory /. If the partition is encrypted with LUKS the device mapper file will be named /dev/mapper/root.|
|Any native, optionally in LUKS||On 32bit ARM systems the first ARM root partition on the disk the EFI ESP is located on is automatically mounted to the root directory /. If the partition is encrypted with LUKS the device mapper file will be named /dev/mapper/root.|
|Any native, optionally in LUKS||On 64bit ARM systems the first 64bit ARM root partition on the disk the EFI ESP is located on is automatically mounted to the root directory /. If the partition is encrypted with LUKS the device mapper file will be named /dev/mapper/root.|
|Any native, optionally in LUKS||The first home partition on the disk the root partition is located on is automatically mounted to /home. If the partition is encrypted with LUKS the device mapper file will be named /dev/mapper/home.|
|Any native, optionally in LUKS||The first server data partition on the disk the root partition is located on is automatically mounted to /srv. If the partition is encrypted with LUKS the device mapper file will be named /dev/mapper/srv.|
|Swap||All swap partitions located on the disk the root partition is located on are automatically enabled.|
|VFAT||The ESP used for the current boot is automatically mounted to /boot, unless a different partition is mounted there, possibly via /etc/fstab, or the directory is non-empty on the root disk. THis partition type is defined by the UEFI Specification.|
|VFAT||The first extended boot partition is automatically used by installers to place the boot loader in. It is not automatically mounted on normally system boots, unless configured explicitly in /etc/fstab, which installers are supposed to do. This partition type is defined by the Boot Loader Specification.|
|Any native, optionally in LUKS||No automatic mounting takes place for other Linux data partitions. This partition type should be used for all partitions that carry Linux file systems. The installer needs to mount them explicitly via entries in /etc/fstab. Optionally, these partitions may be encrypted with LUKS.|
Other GPT type IDs might be used on Linux, for example to mark software RAID or LVM partitions. The definitions of those GPT types is outside of the scope of this specification.
For partitions of the types listed above it is recommended to use human-friendly, descriptive partition names in the GPT partition table, for example "Home", "Server Data", "Fedora Root" and similar, possibly localized.
For the root, server data, home and swap partitions the partition flag bit 63 ("no-auto") may be used to turn off auto-discovery for the specific partition. If set the partition will not be automatically mounted or enabled.
For the root, server data and home partitions the partition flag bit 60 ("read-only") may be used to mark a partition for read-only mounts only. If set the partition will be mounted read-only instead of read-write.
Note that these two flag definitions happen to map nicely to the ones used by Microsoft Basic Data Partitions.
Suggested Mode of Operation
An installer that repartitions the hard disk, should use the above GUID partition types for the partitions it creates.
An installer which supports a "manual partitioning" UI is may choose to prepopulate the UI with swap, /home and /srv partitions of pre-existing Linux OS installations, identified with the GPT type GUIDS above. Note that it shall only prepopulate the UI with the Extended Boot Partition if its boot loader supports the Boot Loader Specification. The installer should not prepopulate such an UI with any identified root partition unless the intention is too overwrite an existing operating system that might be installed.
An installer may omit creating entries in /etc/fstab for root, /home, /srv and for the swap partitions if they use these GUID partition types, and are the first partitions on the disk of each type. If the ESP shall be mounted to /boot it may omit creating entries in /etc/fstab for it, too. If an extended boot partition is used or if the EFI partition shall not be mounted to /boot it must create /etc/fstab entries for them. If other partitions are used (for example for /var or /usr), the installer must register these in /etc/fstab. The root= parameter passed to the kernel by the boot loader may be omitted too, if the root partition is the first one on the disk of its type. If the root partition is not the first one on the disk, the root= parameter must be passed to the kernel by the boot loader. An installer that mounts a root, /home or /srv file system with the partition types defined as above which contains a LUKS header must call the device mapper device "root", "home" and "srv". This is necessary to ensure that the automatic discovery will never result in different device mapper names than any static configuration by the installer, thus eliminating possibly naming conflicts and ambiguities.
An operating system should automatically discover and mount the first root partition (which does not have the no-auto flag set, see above), by looking on the disk the EFI ESP used to boot is located on. It should automatically discover and mount the first /home, /srv and swap partitions (which do not have the no-auto flag set, see above) by looking on the disk the root partition is located on. It should automatically discover and mount the /boot partition to the ESP used for booting. It should not discover/mount partitions with other GUID partition types, or partitions located on other disks, or partitions with the no-auto flag set (see above). User configuration shall always override automatic discovery and mounting. If a root, /home, /srv, /boot file system or swap partition is listed in /etc/fstab or with root= on the kernel command line it shall always take precedence over automatically discovered partitions. If a /home, /srv, /boot file system is found to be populated already the automatic discovery shall not overmount it with any discovered file system.
A container manager should automatically discover and mount the root, /home and /srv boot file systems inside a container disk image. It should ignore any swap, ESP or Extended Boot Partitions should they be included in a container disk image.
If a btrfs file system is automatically discovered and mounted by the operating system/container manager it will be mounted with its default subvolume. The installer should make sure to set the default subvolume correctly using "btrfs subvolume set-default".
Sharing of File Systems between Installations
If two (Linux-based) operating systems are installed on the same disk, the scheme above suggests that they may share the swap, /home, /srv, ESP and Extended Boot Partition. However, they should each have their own root partition.
Frequently Asked Questions
What about automatic discovery of /var, /usr or /etc partitions?
Partitions for /home, /srv or swap may be shared relatively painlessly between multiple OS installations on the same disk. The same is not true for /var, /usr and /etc which belong closely to one specific root partition and need to be updated in close synchronization with each other. Since the GPT partition table scheme cannot express which sets of partitions belong to a single OS installation and to avoid the risk of accidentally mixing and matching incorrect combinations of these partitions we decided to not define auto-discovery of these partition types within this specification.
What about automatic mounting of btrfs subvolumes to /var, /home and so on?
Doing a similar automatic discovery of btrfs subvolumes and mounting them automatically to the appropriate places is certainly desirable. We are waiting for the btrfs designers to add a per-subvolume type UUID to their disk format to make this possible.
Why are you taking my /etc/fstab away?
We are not. /etc/fstab always overrides automatic discovery. We are just trying to make the boot and installation processes of Linux a bit more robust and self-descriptive.
Why did you only define the root partition for x86, x86-64 and ARM?
Well, the automatic discovery of the root partition is defined to operate on the disk the EFI System Partition (ESP) that was used for booting is located on. Since EFI only exists on x86, x86-64 and ARM in the wild so far we only defined root partition GUIDs for these two architectures. Should EFI become more common on other architectures too we can define additional GUIDs for them.
Why define distinct root partition GUIDs for the various architectures?
In order to allow disk images that may be booted on multiple architectures we want to enable discovery of the appropriate root partition on each architecture.
Doesn't this break multi-boot scenarios?
No, it doesn't. The specification says that installers may not stop creating /etc/fstab or stop including root= on the kernel command line, unless the used partitions are the first ones of their type on the disk. And /etc/fstab and root= override all automatic discovery. Multi-boot is hence well supported, since it doesn't change anything for anything but the first installation.
That all said, it's not expected that generic installers generally stop setting root= and creating /etc/fstab anyway. The option to drop these configuration bits is primarily something for appliance-like devices. However, generic installers should still set the right GPT partition types for the partitions they create so that container managers, partition tools and administrators can benefit. Or to say this differently: this specification introduces A) the recommendation to use the newly defined partition types to tag things properly and B) the option to then drop root= and /etc/fstab. While we advertise A) to all installers, we only propose B) for simpler, appliance-like installations.