[pbs-devel] [PATCH proxmox-backup] api: zfs: create zpool with atime=off and relatime=on

Dominik Csapak d.csapak at proxmox.com
Tue Nov 2 10:39:08 CET 2021


some operations (e.g. garbage collection/restore/etc.) are very read
intensive on the chunks, and having atime=on (zfs default) makes those
write intensive operations too. Additionally, 'ext4' defaults to relatime,
so also change the default for api-created zpools.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/api2/node/disks/zfs.rs | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
index 9c3a0958..242f5f7b 100644
--- a/src/api2/node/disks/zfs.rs
+++ b/src/api2/node/disks/zfs.rs
@@ -273,13 +273,15 @@ pub fn create_zpool(
                 proxmox_systemd::enable_unit(&import_unit)?;
             }
 
+            let mut command = std::process::Command::new("zfs");
+            command.arg("set");
             if let Some(compression) = compression {
-                let mut command = std::process::Command::new("zfs");
-                command.args(&["set", &format!("compression={}", compression), &name]);
-                task_log!(worker, "# {:?}", command);
-                let output = pbs_tools::run_command(command, None)?;
-                task_log!(worker, "{}", output);
+                command.arg(&format!("compression={}", compression));
             }
+            command.args(&["atime=off", "relatime=on", &name]);
+            task_log!(worker, "# {:?}", command);
+            let output = pbs_tools::run_command(command, None)?;
+            task_log!(worker, "{}", output);
 
             if add_datastore {
                 let lock = pbs_config::datastore::lock_config()?;
-- 
2.30.2





More information about the pbs-devel mailing list