diff --git a/installer.sh.in b/installer.sh.in index 636ff6f85a..a2b64221df 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -1003,8 +1003,11 @@ as FAT32, mountpoint /boot/efi and at least with 100MB of size." ${MSGBOXSIZE} FILESYSTEMS_DONE=1 } +FSOPTS=defaults,noatime +BTRFS_OPTS="subvol=@,$FSOPTS,space_cache" + create_filesystems() { - local mnts dev mntpt fstype fspassno mkfs size rv uuid + local mnts dev mntpt fstype fspassno mkfs size rv uuid fsopts mnts=$(grep -E '^MOUNTPOINT.*' $CONF_FILE) set -- ${mnts} @@ -1058,8 +1061,21 @@ failed to create filesystem $fstype on $dev!\ncheck $LOG for errors." ${MSGBOXSI # Mount rootfs the first one. [ "$mntpt" != "/" ] && continue mkdir -p $TARGETDIR - echo "Mounting $dev on $mntpt ($fstype)..." >$LOG - mount -t $fstype $dev $TARGETDIR >$LOG 2>&1 + if [ "$fstype" = "btrfs" ]; then + # Setup subvolume on BTRFS partitions + echo "Mounting $dev on $mntpt ($fstype) to create subvolume @..." >$LOG + mount -t $fstype $dev $TARGETDIR >$LOG 2>&1 + btrfs subvolume create $TARGETDIR/@ >$LOG 2>&1 + umount $TARGETDIR >$LOG 2>&1 + fsopts=$BTRFS_OPTS + echo "Remounting $dev on $mntpt ($fstype) with options [$fsopts]..." >$LOG + + else + # Setup filesystem options on other partition types + fsopts=$FSOPTS + echo "Mounting $dev on $mntpt ($fstype) with options [$fsopts]..." >$LOG + fi + mount -o $fsopts -t $fstype $dev $TARGETDIR >$LOG 2>&1 if [ $? -ne 0 ]; then DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} \ failed to mount $dev on ${mntpt}! check $LOG for errors." ${MSGBOXSIZE} @@ -1072,7 +1088,7 @@ failed to mount $dev on ${mntpt}! check $LOG for errors." ${MSGBOXSIZE} else fspassno=1 fi - echo "UUID=$uuid $mntpt $fstype defaults 0 $fspassno" >>$TARGET_FSTAB + echo "UUID=$uuid $mntpt $fstype $fsopts 0 $fspassno" >>$TARGET_FSTAB done # mount all filesystems in target rootfs @@ -1084,7 +1100,7 @@ failed to mount $dev on ${mntpt}! check $LOG for errors." ${MSGBOXSIZE} [ "$mntpt" = "/" -o "$fstype" = "swap" ] && continue mkdir -p ${TARGETDIR}${mntpt} echo "Mounting $dev on $mntpt ($fstype)..." >$LOG - mount -t $fstype $dev ${TARGETDIR}${mntpt} >$LOG 2>&1 + mount -o $FSOPTS -t $fstype $dev ${TARGETDIR}${mntpt} >$LOG 2>&1 if [ $? -ne 0 ]; then DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} \ failed to mount $dev on $mntpt! check $LOG for errors." ${MSGBOXSIZE} @@ -1092,7 +1108,7 @@ failed to mount $dev on $mntpt! check $LOG for errors." ${MSGBOXSIZE} fi # Add entry to target fstab uuid=$(blkid -o value -s UUID "$dev") - echo "UUID=$uuid $mntpt $fstype defaults 0 2" >>$TARGET_FSTAB + echo "UUID=$uuid $mntpt $fstype $FSOPTS 0 2" >>$TARGET_FSTAB done }