From 494347a931f37acac22ffff171b719bf0423d687 Mon Sep 17 00:00:00 2001 From: anaximeno Date: Tue, 21 Oct 2025 14:25:20 -0100 Subject: [PATCH 1/2] btrfs: Improve fstab mount options during a btrfs install --- usr/lib/live-installer/installer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/lib/live-installer/installer.py b/usr/lib/live-installer/installer.py index db03c8a8..040c4de2 100644 --- a/usr/lib/live-installer/installer.py +++ b/usr/lib/live-installer/installer.py @@ -592,9 +592,9 @@ def write_fstab(self, path="/target/etc/fstab"): if "ext" in fs: fstab_mount_options = "rw,errors=remount-ro" elif fs == "btrfs" and partition.mount_as == "/": - fstab_mount_options = "defaults,subvol=@" + fstab_mount_options = "subvol=@,defaults,noatime,compress=zstd:1,discard=async" elif fs == "btrfs" and partition.mount_as == "/home": - fstab_mount_options = "defaults,subvol=@home" + fstab_mount_options = "subvol=@home,defaults,noatime,compress=zstd:1,discard=async" else: fstab_mount_options = "defaults" @@ -606,7 +606,7 @@ def write_fstab(self, path="/target/etc/fstab"): if fs == "btrfs" and partition.mount_as == "/" and not self.setup_has_dedicated_home(): # Special case, if / is btrfs and there is no dedicated /home, add the @home subvolume to / - fstab.write("%s\t%s\t%s\t%s\t%s\t%s\n" % (partition_uuid, "/home", "btrfs", "defaults,subvol=@home", "0", "0")) + fstab.write("%s\t%s\t%s\t%s\t%s\t%s\n" % (partition_uuid, "/home", "btrfs", "subvol=@home,defaults,noatime,compress=zstd:1,discard=async", "0", "0")) fstab.close() def write_mtab(self, fstab="/target/etc/fstab", mtab="/target/etc/mtab"): From 799e195a54aed9bbede1982cc97d47b8b6d123c5 Mon Sep 17 00:00:00 2001 From: anaximeno Date: Thu, 16 Apr 2026 20:00:00 -0100 Subject: [PATCH 2/2] Remove discard=async option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need to explicitly set discard=async in fstab, as it is the default for kernel versions ≥ 6.2 and is automatically enabled on SSD/NVMe devices. ref: https://btrfs.readthedocs.io/en/latest/ch-mount-options.html Thanks https://github.com/emanuc for the suggestion. --- usr/lib/live-installer/installer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/lib/live-installer/installer.py b/usr/lib/live-installer/installer.py index 040c4de2..41a95f99 100644 --- a/usr/lib/live-installer/installer.py +++ b/usr/lib/live-installer/installer.py @@ -592,9 +592,9 @@ def write_fstab(self, path="/target/etc/fstab"): if "ext" in fs: fstab_mount_options = "rw,errors=remount-ro" elif fs == "btrfs" and partition.mount_as == "/": - fstab_mount_options = "subvol=@,defaults,noatime,compress=zstd:1,discard=async" + fstab_mount_options = "subvol=@,defaults,noatime,compress=zstd:1" elif fs == "btrfs" and partition.mount_as == "/home": - fstab_mount_options = "subvol=@home,defaults,noatime,compress=zstd:1,discard=async" + fstab_mount_options = "subvol=@home,defaults,noatime,compress=zstd:1" else: fstab_mount_options = "defaults" @@ -606,7 +606,7 @@ def write_fstab(self, path="/target/etc/fstab"): if fs == "btrfs" and partition.mount_as == "/" and not self.setup_has_dedicated_home(): # Special case, if / is btrfs and there is no dedicated /home, add the @home subvolume to / - fstab.write("%s\t%s\t%s\t%s\t%s\t%s\n" % (partition_uuid, "/home", "btrfs", "subvol=@home,defaults,noatime,compress=zstd:1,discard=async", "0", "0")) + fstab.write("%s\t%s\t%s\t%s\t%s\t%s\n" % (partition_uuid, "/home", "btrfs", "subvol=@home,defaults,noatime,compress=zstd:1", "0", "0")) fstab.close() def write_mtab(self, fstab="/target/etc/fstab", mtab="/target/etc/mtab"):