Added proper btrfs mount options

This commit is contained in:
oddlama 2020-10-05 22:28:32 +02:00
parent e1fc6cf9eb
commit ed87a77c13
No known key found for this signature in database
GPG Key ID: 88EA325D51D53908
2 changed files with 23 additions and 1 deletions

View File

@ -290,6 +290,16 @@ create_default_disk_layout() {
fi fi
DISK_ID_SWAP=part_swap DISK_ID_SWAP=part_swap
DISK_ID_ROOT="$root_id" 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 # Example 2: Multiple disks, with raid 0 and luks
@ -343,6 +353,16 @@ create_raid0_luks_layout() {
[[ $size_swap != "false" ]] && \ [[ $size_swap != "false" ]] && \
DISK_ID_SWAP=part_raid_swap DISK_ID_SWAP=part_raid_swap
DISK_ID_ROOT=part_luks_root 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). # 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" ]] && \ [[ $size_swap != "false" ]] && \
DISK_ID_SWAP=part_swap_dev0 DISK_ID_SWAP=part_swap_dev0
DISK_ID_ROOT="$root_id" DISK_ID_ROOT="$root_id"
DISK_ID_ROOT_TYPE="btrfs"
DISK_ID_ROOT_MOUNT_OPTS="defaults,noatime,compress=zstd,subvol=/root"
} }

View File

@ -257,7 +257,7 @@ generate_fstab() {
einfo "Generating fstab" einfo "Generating fstab"
install -m0644 -o root -g root "$GENTOO_INSTALL_REPO_DIR/configs/fstab" /etc/fstab \ install -m0644 -o root -g root "$GENTOO_INSTALL_REPO_DIR/configs/fstab" /etc/fstab \
|| die "Could not overwrite /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 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" 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 else