Skip to content

rootdev: support btrfs#6

Merged
pothos merged 2 commits intoflatcar-masterfrom
kai/rootdev-support-btrfs
Jul 28, 2021
Merged

rootdev: support btrfs#6
pothos merged 2 commits intoflatcar-masterfrom
kai/rootdev-support-btrfs

Conversation

@pothos
Copy link
Copy Markdown
Member

@pothos pothos commented Jul 14, 2021

  • rootdev: support btrfs

    With btrfs it's not possible in general to find a single underlying
    block device because there could be many, but still it is possible for
    our case since we have a single partition. However, rootdev failed to
    find it because it uses the device minor and major pair from a "stat"
    syscall on the mount point. This doesn't work with btrfs because it
    gives a logical pair instead of one belonging to a block device.

    Instead of using the minor and major pair, find the underlying block
    device of a mount point by looking it up in /proc/mounts. The existing
    traversal code to find the lowest backing device is kept in place by
    getting the minor and major pair for the found block device.

  • cgpt: fix cause for compiler warning

How to use/Testing done

This was built and tested with the coreos-overlay branch kai/bootengine-verity-hashoffset from flatcar-archive/coreos-overlay#1106 and flatcar-scripts branch kai/btrfs-usr-oem from flatcar/scripts#131 in http://jenkins.infra.kinvolk.io:8080/job/os/job/manifest/3029/cldsv/ where the Flatcar image that has a btrfs /usr partition and OEM partition.
While the actual switch to a btrfs filesystem on the /usr partition is only possible when all changes are part of a Stable release because update-engine needs to know how to handle the new filesystem when updating, we can already do the switch for the OEM partition.

With btrfs it's not possible in general to find a single underlying
block device because there could be many, but still it is possible for
our case since we have a single partition. However, rootdev failed to
find it because it uses the device minor and major pair from a "stat"
syscall on the mount point. This doesn't work with btrfs because it
gives a logical pair instead of one belonging to a block device.

Instead of using the minor and major pair, find the underlying block
device of a mount point by looking it up in /proc/mounts. The existing
traversal code to find the lowest backing device is kept in place by
getting the minor and major pair for the found block device.
@pothos pothos force-pushed the kai/rootdev-support-btrfs branch from 1cc426a to d3b9b01 Compare July 15, 2021 10:33
@pothos pothos merged commit 0d57463 into flatcar-master Jul 28, 2021
@pothos pothos deleted the kai/rootdev-support-btrfs branch July 28, 2021 11:20
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Jul 28, 2021
t-lo pushed a commit to flatcar/scripts that referenced this pull request Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants