From ed87a77c131ed6502040906ee94308216f669ccc Mon Sep 17 00:00:00 2001 From: oddlama Date: Mon, 5 Oct 2020 22:28:32 +0200 Subject: [PATCH] Added proper btrfs mount options --- scripts/internal_config.sh | 22 ++++++++++++++++++++++ scripts/main.sh | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/internal_config.sh b/scripts/internal_config.sh index 2ef9a66..c2901be 100644 --- a/scripts/internal_config.sh +++ b/scripts/internal_config.sh @@ -290,6 +290,16 @@ create_default_disk_layout() { fi DISK_ID_SWAP=part_swap DISK_ID_ROOT="$root_id" + + if [[ $root_fs == "btrfs" ]]; then + DISK_ID_ROOT_TYPE="btrfs" + DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,compress=zstd,subvol=/root" + elif [[ $root_fs == "btrfs" ]]; then + DISK_ID_ROOT_TYPE="ext4" + DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,errors=remount-ro,discard" + else + die "Unsupported root filesystem type" + fi } # Example 2: Multiple disks, with raid 0 and luks @@ -343,6 +353,16 @@ create_raid0_luks_layout() { [[ $size_swap != "false" ]] && \ DISK_ID_SWAP=part_raid_swap DISK_ID_ROOT=part_luks_root + + if [[ $root_fs == "btrfs" ]]; then + DISK_ID_ROOT_TYPE="btrfs" + DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,compress=zstd,subvol=/root" + elif [[ $root_fs == "btrfs" ]]; then + DISK_ID_ROOT_TYPE="ext4" + DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,errors=remount-ro,discard" + else + die "Unsupported root filesystem type" + fi } # Example 3: Multiple disks, up to 3 partitions on first disk (efi, maybe swap, dm-crypt for btrfs). @@ -414,4 +434,6 @@ create_btrfs_raid_layout() { [[ $size_swap != "false" ]] && \ DISK_ID_SWAP=part_swap_dev0 DISK_ID_ROOT="$root_id" + DISK_ID_ROOT_TYPE="btrfs" + DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,compress=zstd,subvol=/root" } diff --git a/scripts/main.sh b/scripts/main.sh index 846ad2c..15a001b 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -257,7 +257,7 @@ generate_fstab() { einfo "Generating fstab" install -m0644 -o root -g root "$GENTOO_INSTALL_REPO_DIR/configs/fstab" /etc/fstab \ || die "Could not overwrite /etc/fstab" - add_fstab_entry "UUID=$(get_blkid_uuid_for_id "$DISK_ID_ROOT")" "/" "ext4" "defaults,noatime,errors=remount-ro,discard" "0 1" + add_fstab_entry "UUID=$(get_blkid_uuid_for_id "$DISK_ID_ROOT")" "/" "$DISK_ID_ROOT_TYPE" "$DISK_ID_ROOT_MOUNT_OPTS" "0 1" if [[ $IS_EFI == "true" ]]; then add_fstab_entry "UUID=$(get_blkid_uuid_for_id "$DISK_ID_EFI")" "/boot/efi" "vfat" "defaults,noatime,fmask=0177,dmask=0077,noexec,nodev,nosuid,discard" "0 2" else