Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for unified image layout #1870

Merged
merged 5 commits into from
Dec 17, 2021

Commits on Dec 16, 2021

  1. systemd: exclude default repart service

    The repart service is a oneshot, so we can't use a drop-in to replace
    the `ExecStart` command that runs by default, which attempts to add
    or grow defined partitions on the same device as the root filesystem.
    
    This is OK for "unified" images, where the data partition is at the
    end of the device, but not OK for "split" images, where it lives on a
    different device.
    
    Signed-off-by: Ben Cressey <[email protected]>
    bcressey committed Dec 16, 2021
    Configuration menu
    Copy the full SHA
    c4c2dc2 View commit details
    Browse the repository at this point in the history
  2. release: use systemd-repart for partition resizing

    Switch from our `growpart` tool to `systemd-repart` to resize the
    data partition. For a unified root+data image.
    
    `growpart` uses the `gptman` crate, which calls the BLKRRPART ioctl
    to tell the kernel to re-read the partition table. This call fails if
    the device contains mounted partitions.
    
    `systemd-repart` uses the newer BLKPG ioctl, which manipulates the
    kernel's view of individual partitions. This works even if the root
    filesystem is present on the same device and already mounted. It also
    avoids the need to handle the partition symlink going away and coming
    back, since udev does not get the change event that triggers this.
    
    The two tools differ in how much free space is left on the device
    after the last partition is resized. `growpart` ends the partition
    one sector before the last 1 MiB boundary, while `systemd-repart`
    ends it just before the GPT label. Both tools run on every boot.
    
    To avoid problems on downgrade after a newer release resizes the data
    filesystem beyond where the older release will end the partition, we
    constrain `systemd-repart` to leave the older number of free sectors.
    
    Since `/local` can be mounted during the resize operation, we can use
    a real mount unit for it, which greatly simplifies the dependencies,
    and allows us to decouple the "prepare" logic from "resize" logic.
    
    Signed-off-by: Ben Cressey <[email protected]>
    bcressey committed Dec 16, 2021
    Configuration menu
    Copy the full SHA
    067671a View commit details
    Browse the repository at this point in the history
  3. build: add support for building unified images

    For some targets such as bare metal systems, the requirement for a
    separate block device to hold the data partition is unworkable.
    
    Implement a "unified" image layout, which places the data partition
    after the final OS partition, and is suitable for targets which may
    only have one disk.
    
    The old "split" layout remains the default.
    
    Signed-off-by: Ben Cressey <[email protected]>
    bcressey committed Dec 16, 2021
    Configuration menu
    Copy the full SHA
    6f2c173 View commit details
    Browse the repository at this point in the history

Commits on Dec 17, 2021

  1. pubsys: add support for publishing unified images

    Although the existing AWS and VMware variants use the "split" image
    layout, custom variants for these platforms might use the "unified"
    layout instead.
    
    Adapt the AMI registration and OVA creation logic to account for the
    possibility that we only build a single disk image.
    
    Signed-off-by: Ben Cressey <[email protected]>
    bcressey committed Dec 17, 2021
    Configuration menu
    Copy the full SHA
    4c7912f View commit details
    Browse the repository at this point in the history
  2. release: label overlayfs state directories

    Using `state_t` as the label makes the directories read-only for all
    unprivileged containers, even if they have access via a host mount.
    
    Signed-off-by: Ben Cressey <[email protected]>
    bcressey committed Dec 17, 2021
    Configuration menu
    Copy the full SHA
    29de89f View commit details
    Browse the repository at this point in the history