From 48dc88b0c57e428b5a17293a8cd616d1940e404f Mon Sep 17 00:00:00 2001 From: fenris Date: Thu, 9 Dec 2021 17:59:48 +0100 Subject: [PATCH 1/3] ask user if the install drive is a ssd and set the btrfs ssd option accordingly remove space_cache mount option because btrfs-progs uses Free Space Tree (space_cache=v2) since version 5.15 by default. see: https://wiki.tnonline.net/w/Btrfs/Space_Cache --- 0-preinstall.sh | 6 +++--- startup.sh | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/0-preinstall.sh b/0-preinstall.sh index ddc03c9..5a16266 100755 --- a/0-preinstall.sh +++ b/0-preinstall.sh @@ -74,9 +74,9 @@ createsubvolumes () { } mountallsubvol () { - mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@home /dev/mapper/ROOT /mnt/home - mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@tmp /dev/mapper/ROOT /mnt/tmp - mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@.snapshots /dev/mapper/ROOT /mnt/.snapshots + mount -o ${mountoptions},subvol=@home /dev/mapper/ROOT /mnt/home + mount -o ${mountoptions},subvol=@tmp /dev/mapper/ROOT /mnt/tmp + mount -o ${mountoptions},subvol=@.snapshots /dev/mapper/ROOT /mnt/.snapshots mount -o subvol=@var /dev/mapper/ROOT /mnt/var } if [[ "${DISK}" == "nvme" ]]; then diff --git a/startup.sh b/startup.sh index bc5f0c9..7e58783 100644 --- a/startup.sh +++ b/startup.sh @@ -90,6 +90,20 @@ Please select key board layout from this list read -p "Your key boards layout:" keymap echo "keymap=$keymap" >> setup.conf } +drivessd () { +echo -ne " +Is this an ssd? yes/no: +" +read ssd_drive + +case $ssd_drive in + y|Y|yes|Yes|YES) + echo "mountoptions=noatime,compress=zstd,ssd,commit=120" >> setup.conf;; + n|N|no|NO|No) + echo "mountoptions=noatime,compress=zstd,commit=120" >> setup.conf;; + *) echo "Wrong option. Try again";drivessd;; +esac +} diskpart () { lsblk echo -ne " @@ -103,6 +117,8 @@ Please enter disk to work on: (example /dev/sda): " read option echo "DISK=$option" >> setup.conf + +drivessd } userinfo () { echo -ne "Please enter username: " From 2154a80e66fa70c9043be8cda84331ecaf7b7c84 Mon Sep 17 00:00:00 2001 From: fenris Date: Thu, 9 Dec 2021 18:09:40 +0100 Subject: [PATCH 2/3] fix mountoptions for btrfs --- 0-preinstall.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/0-preinstall.sh b/0-preinstall.sh index 5a16266..4963b73 100755 --- a/0-preinstall.sh +++ b/0-preinstall.sh @@ -101,7 +101,7 @@ if [[ "${DISK}" == "nvme" ]]; then createsubvolumes umount /mnt # mount @ subvolume - mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@ /dev/mapper/ROOT /mnt + mount -o ${mountoptions},subvol=@ /dev/mapper/ROOT /mnt # make directories home, .snapshots, var, tmp mkdir -p /mnt/{home,var,tmp,.snapshots} # mount subvolumes @@ -125,7 +125,7 @@ else createsubvolumes umount /mnt # mount all the subvolumes - mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@ /dev/mapper/ROOT /mnt + mount -o ${mountoptions},subvol=@ /dev/mapper/ROOT /mnt # make directories home, .snapshots, var, tmp mkdir -p /mnt/{home,var,tmp,.snapshots} # mount subvolumes From bd075e70c9489648781ad60c6c350fdef571e650 Mon Sep 17 00:00:00 2001 From: fenris Date: Fri, 10 Dec 2021 18:36:11 +0100 Subject: [PATCH 3/3] mountoptions for var --- 0-preinstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0-preinstall.sh b/0-preinstall.sh index 4963b73..1b972bc 100755 --- a/0-preinstall.sh +++ b/0-preinstall.sh @@ -77,7 +77,7 @@ mountallsubvol () { mount -o ${mountoptions},subvol=@home /dev/mapper/ROOT /mnt/home mount -o ${mountoptions},subvol=@tmp /dev/mapper/ROOT /mnt/tmp mount -o ${mountoptions},subvol=@.snapshots /dev/mapper/ROOT /mnt/.snapshots - mount -o subvol=@var /dev/mapper/ROOT /mnt/var + mount -o ${mountoptions},subvol=@var /dev/mapper/ROOT /mnt/var } if [[ "${DISK}" == "nvme" ]]; then if [[ "${FS}" == "btrfs" ]]; then