From 879f953a9fdbde818c2edde80b3862abd2bc331d Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Thu, 26 Mar 2026 23:37:41 -0600 Subject: [PATCH] feat: delete ext2_saved subvolume after btrfs-convert Removes the ext2_saved subvolume (created by btrfs-convert to preserve original ext4 metadata) before running defrag to reclaim space. --- core/src/disk/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/disk/main.rs b/core/src/disk/main.rs index fab738b04..59c4c3dcf 100644 --- a/core/src/disk/main.rs +++ b/core/src/disk/main.rs @@ -344,12 +344,17 @@ pub async fn mount_fs>( .arg(&blockdev_path) .invoke(ErrorKind::DiskManagement) .await?; - // Defragment after conversion for optimal performance + // Delete ext2_saved subvolume and defragment after conversion let tmp_mount = datadir.as_ref().join(format!("{name}.convert-tmp")); tokio::fs::create_dir_all(&tmp_mount).await?; BlockDev::new(&blockdev_path) .mount(&tmp_mount, ReadWrite) .await?; + Command::new("btrfs") + .args(["subvolume", "delete"]) + .arg(tmp_mount.join("ext2_saved")) + .invoke(ErrorKind::DiskManagement) + .await?; Command::new("btrfs") .args(["filesystem", "defragment", "-r"]) .arg(&tmp_mount)