Support btrfs as /usr filesystem#11
Conversation
|
(CI fails until flatcar/seismograph#6 is merged) |
CI will fail anyway - see: flatcar/Flatcar#282 (comment) :) |
8a5b4e2 to
b515a1d
Compare
|
Hm, I need to find why update-engine still doesn't find the right partition ( |
|
Testing locally didn't run into that message but into the problem that conceptually two identical filesystems can't be mounted at the same time, this prevents testing to update from the same version because update-engine has to mount the new partition to copy the kernel over to |
|
This change doesn't affect the dm-verity r/o aspect?
|
|
The temporary mounting to run the postinstall hook is done without setting up dm-verity |
34aa96b to
e0272b8
Compare
When btrfs is used to fit more content into the partition, mounting fails because ext2/3 was hardcoded. Also try to mount as btrfs if mounting as ext2/3 fails. The norecovery options makes sure that the filesystem isn't touched even if the it is corrupted.
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. Based on the new code in seismograph's rootdev under src/rootdev/main.c
When trying to mount an identical btrfs image twice because the old and new partition are identical, the kernel refuses because same UUIDs are linked to having a btrfs filesystem spread over multiple devices. Since the same image is used, we can run the postinstall action from the old/current partition.
e0272b8 to
2241ede
Compare
With an outdated package list the download failed. Update the package list before downloading packages for installation.
postinstall: support btrfs as /usr filesystem
When btrfs is used to fit more content into the partition, mounting
fails because ext2/3 was hardcoded.
Also try to mount as btrfs if mounting as ext2/3 fails. The
norecovery options makes sure that the filesystem isn't touched even if
the it is corrupted.
utils: 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.
Based on the new code in seismograph's rootdev under src/rootdev/main.c from rootdev: support btrfs seismograph#6
How to use/Testing done
This was built and tested with the coreos-overlay branch
kai/bootengine-verity-hashoffsetfrom flatcar-archive/coreos-overlay#1106 and flatcar-scripts branchkai/btrfs-usr-oemfrom 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.