[pbs-devel] [PATCH proxmox-backup 1/1] ext4 filesystems no longer reserve blocks when created as a datastore

Daniel Tschlatscher d.tschlatscher at proxmox.com
Fri May 27 12:57:27 CEST 2022


Ext4 Filesystems reserve about 5% of all available blocks for usage by
the root user. While this can be helpful for root partitions and mount
points, it is significantly less so for datastores. Therefore, ext4
filesystems are created with no reserved blocks, increasing the
available storage for unpriviliged backup users.
Some more rationale can be found in #4077:
https://bugzilla.proxmox.com/show_bug.cgi?id=4077

Signed-off-by: Daniel Tschlatscher <d.tschlatscher at proxmox.com>
---
 src/tools/disks/mod.rs | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs
index 568dccbf..9a19f0c1 100644
--- a/src/tools/disks/mod.rs
+++ b/src/tools/disks/mod.rs
@@ -979,10 +979,14 @@ pub fn create_file_system(disk: &Disk, fs_type: FileSystemType) -> Result<(), Er
         None => bail!("disk {:?} has no node in /dev", disk.syspath()),
     };
 
-    let fs_type = fs_type.to_string();
-
     let mut command = std::process::Command::new("mkfs");
-    command.args(&["-t", &fs_type]);
+
+    command.args(&["-t", &fs_type.to_string()]);
+
+    if matches!(fs_type, FileSystemType::Ext4) {
+        command.args(&["-m", "0"]);
+    }
+
     command.arg(disk_path);
 
     proxmox_sys::command::run_command(command, None)?;
-- 
2.30.2






More information about the pbs-devel mailing list