Add minimal subvolume support for /.

Rational: current installation of rootfs to default subvolume
makes a post-install flat subvolume structure (recommended!)
unnecessarily difficult to accomplish.
This commit is contained in:
Nicholas D Steeves 2016-11-23 11:17:14 -05:00 committed by Cyril Brulebois
parent af781092e3
commit 500ee0c6f6
3 changed files with 21 additions and 3 deletions

7
debian/changelog vendored
View file

@ -1,3 +1,10 @@
partman-btrfs (53) UNRELEASED; urgency=medium
[ Nicholas D Steeves ]
* Add minimal subvolume support for /.
-- Nicholas D Steeves <nsteeves@gmail.com> Mon, 09 Mar 2020 17:26:59 -0400
partman-btrfs (52) unstable; urgency=medium
* Team upload

View file

@ -17,10 +17,14 @@ for dev in $DEVICES/*; do
[ -f "$id/mountpoint" ] || continue
mountpoint=$(cat $id/mountpoint)
# due to #249322, #255135, #258117:
if [ "$mountpoint" = /tmp ]; then
if [ "$mountpoint" = "/tmp" ]; then
rm -f $id/options/noexec
fi
options=$(get_mountoptions $dev $id)
if [ "$mountpoint" = "/" ]; then
options="$(get_mountoptions $dev $id),subvol=@rootfs"
else
options=$(get_mountoptions $dev $id)
fi
# There is no btrfs fsck
echo "$path" "$mountpoint" btrfs $options 0 0
;;

View file

@ -11,7 +11,14 @@ pass=$6
case $type in
btrfs)
mount -t btrfs ${options:+-o "$options"} $fs /target$mp || exit 1
if [ "$mp" = "/" ]; then
mount -t btrfs ${options:+-o "$options"} $fs /target/ || exit 1
btrfs subvolume create /target/@rootfs || exit 1
umount /target || exit 1
mount -t btrfs ${options:+-o "$options,subvol=@rootfs"} $fs /target || exit 1
else
mount -t btrfs ${options:+-o "$options"} $fs /target"$mp" || exit 1
fi
echo "umount /target$mp"
exit 0
;;