Install to nvme: place root volume to separate subvolume when btrfs fs used

This commit is contained in:
Igor Velkov 2025-04-20 02:43:13 +03:00 committed by Igor
parent b83ed148ce
commit 810ea3eefe
1 changed files with 11 additions and 1 deletions

View File

@ -96,7 +96,7 @@ mkopts[f2fs]='-f'
# @TODO source these options from one source, this is mostly defined in partioning.sh
mountopts[ext4]='defaults,noatime,commit=120,errors=remount-ro,x-gvfs-hide 0 1'
mountopts[btrfs]='defaults,noatime,commit=120,compress=lzo,x-gvfs-hide 0 2'
mountopts[btrfs]="defaults,commit=120,compress=lzo,x-gvfs-hide,subvol=@ 0 2"
mountopts[f2fs]='defaults,noatime,x-gvfs-hide 0 2'
# Create boot and root file system #
@ -120,6 +120,16 @@ create_armbian()
[[ -n $2 ]] && ( mount -o compress-force=zlib "$2" "${TempDir}"/rootfs 2> /dev/null || mount "$2" "${TempDir}"/rootfs )
[[ -n $1 && $1 != "mtd" ]] && mount "$1" "${TempDir}"/bootfs
fi
# make separate subvolume for rootfs on btrfs
if [[ $eMMCFilesystemChoosen =~ ^(btrfs)$ ]]; then
btrfs subvolume create "${TempDir}"/rootfs/@
sync
btrfs subvolume list ${TempDir}/rootfs/ | grep 'path @$' | cut -d' ' -f2 \
| xargs -I{} btrfs subvolume set-default {} ${TempDir}/rootfs/
umount "${TempDir}"/rootfs
mount -o compress-force=zlib,subvol=@ "$2" "${TempDir}"/rootfs 2> /dev/null
fi
rm -rf "${TempDir}"/bootfs/* "${TempDir}"/rootfs/*
# sata root part