From 500ee0c6f6edd74d00acaf92ab2d56c479e7b144 Mon Sep 17 00:00:00 2001 From: Nicholas D Steeves Date: Wed, 23 Nov 2016 11:17:14 -0500 Subject: [PATCH] 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. --- debian/changelog | 7 +++++++ fstab.d/btrfs | 8 ++++++-- mount.d/btrfs | 9 ++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index f1e1195..bce49a4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +partman-btrfs (53) UNRELEASED; urgency=medium + + [ Nicholas D Steeves ] + * Add minimal subvolume support for /. + + -- Nicholas D Steeves Mon, 09 Mar 2020 17:26:59 -0400 + partman-btrfs (52) unstable; urgency=medium * Team upload diff --git a/fstab.d/btrfs b/fstab.d/btrfs index 77d403b..7d72fac 100755 --- a/fstab.d/btrfs +++ b/fstab.d/btrfs @@ -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 ;; diff --git a/mount.d/btrfs b/mount.d/btrfs index eb4b1fb..28332b1 100755 --- a/mount.d/btrfs +++ b/mount.d/btrfs @@ -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 ;;