Storage layout

Storage layout in Ubuntu Core 20 has been designed to support its recovery modes and uses the following partitions:

  • ubuntu-seed (role: system-seed; read-only, ext4 or typically vfat)
    Contains the configuration for the first-stage/recovery boot loader and at least one recovery system. This is a set of snaps (base, kernel, gadget and application snaps, see Snaps in Ubuntu Core for more details), together with a model assertion and snap assertions that define the device and for which the device can be recovered or reinstalled .
  • ubuntu-boot (role: system-boot; read-only, ext4 or vfat): contains the second-stage/run bootloader and unpacked kernel(s) to boot and with.
  • ubuntu-save (role: system-save; writable, ext4): stores device identity backup data and data to facilitate recovery or re-install. This partition is mandatory on encrypted systems.
  • ubuntu-data (role: system-data; writable, ext4): stores user and system data. This partition is often minimally sized in the image but extended during device initialisation to use all the space available.

Additional partitions may be required by the device/board specific bootloader.

On UEFI systems, ubuntu-seed is intended to be the EFI System Partition (ESP) with its specific GUID and must be vfat formatted.

Whether ubuntu-seed or ubuntu-boot are vfat or ext4 formatted depends on the capabilities and requirement of the specific bootloader. Some bootloaders might support ext4 but not robustly. With grub on UEFI systems, for example, ubuntu-seed will be vfat-formatted while ubuntu-boot can be ext4-formatted.

The definitive layout of the generated image used to install Ubuntu Core, and the resultant storage on the device, is described by the gadget snap and its associated gadget.yaml.

A device image for an Ubuntu Core 20 device must only contain bootloader-specific partitions and ubuntu-seed, such that a recovery system in it can be booted into install mode. Installation will create and size the other missing partitions.

ubuntu-seed layout

When the image is created, the recovery systems partition is populated with any required bootloader-specific binaries and assets extracted from the gadget.

In all cases, ubuntu-seed will contain the following directories:

  • One or more systems/<system-label> recovery system directories

    The <system-label> for these directories is usually date-based, e.g. 20201210, and each fully describes a recovery system, comprising:

    • a model file containing the model assertion for the recovery system
    • an assertions directory that includes all the other assertions needed by the system
    • a kernel image, or other bootloader-specific information to help find the appropriate kernel

    The model and all the assertions together determine which snaps and revisions compose the system and they can be used to verify and cross-reference them.

  • A snaps directory which operates as a pool of snaps shared across all recovery systems. The assertions in a recovery system will define and reference which of these will be used by the system.

Installation process

Any device booting an Ubuntu Core 20 installation image will proceed through the following steps - with the first three (1-3) also describing the recovery mode boot process:

  1. Boot through the bootloader, its assets, and boot configuration in ubuntu-seed
  2. Bootloader loads the kernel from a designated recovery system
  3. Kernel initialises the system and runs the snaps from that system in install mode. At this point, the system is running from tmpfs in an ephemeral state with all snaps from the recovery system model marked for use in install mode (as indicated by the modes field values), including the snapd snap
  4. The snapd snap proceeds to install the actual run mode system by:
    • creating all missing partitions
    • (optionally) encrypting ubuntu-data and ubuntu-save if supported and not disabled
    • sealing the disk keys through hardware support
    • setting up the run system in ubuntu-data
    • setting boot configuration and the run mode kernel in ubuntu-boot for run mode
  5. snapd proceeds to reboot into run mode
  6. From run mode, snapd bootstraps itself and proceeds to install and activate all the snaps marked for run mode use in the recovery system