From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id E48811FF13C for ; Thu, 19 Mar 2026 15:37:25 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 88C3D1D5D; Thu, 19 Mar 2026 15:37:37 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [RFC proxmox{,-backup} 0/6] add scheduled fstrim job for datastore's backing filesystems Date: Thu, 19 Mar 2026 15:36:43 +0100 Message-ID: <20260319143649.681937-1-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1773930979790 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.062 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 2OFWJKQ77K53IUKGUDLA5Z2R74FH4F2P X-Message-ID-Hash: 2OFWJKQ77K53IUKGUDLA5Z2R74FH4F2P X-MailFrom: c.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: As reported in the community forum [0], the default systemd service to run fstrim does not cover datastores mounted via systemd mount unit, since the fstrim command is invoked via: ``` fstrim --listed-in /etc/fstab:/proc/self/mountinfo ... ``` which however only considers the list up to the first non-empty file according to the man page [1]. To allow for easy configuration of scheduled fstrims also on filesystems backing datastores in PBS, implement a scheduled job with per-datastore schedule configuration. Enable and default to executing the fstrim job for new datastores (except crated via ZFS dialog). Open question remaining: How to best handle datastores located on ZFS? Should the command default to zpool trim? Should it set `autotrim=on` on datastore creation instead and silently ignore as it is now? [0] https://forum.proxmox.com/threads/181764/ [1] https://www.man7.org/linux/man-pages/man8/fstrim.8.html proxmox: Christian Ebner (1): pbs-api-types: define fstrim schedule on datastore config pbs-api-types/src/datastore.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) proxmox-backup: Christian Ebner (5): tools: add helper to run fstrim command on path or mountpoint api: config: expose fstrim schedule for datastores bin: proxy: periodically schedule fstrim on datastore's filesystems ui: expose per-datastore fstrim job schedule api: set default fstrim schedule on datastore create src/api2/config/datastore.rs | 10 ++++++ src/api2/node/disks/directory.rs | 6 ++-- src/bin/proxmox-backup-proxy.rs | 59 ++++++++++++++++++++++++++++++++ src/tools/disks/mod.rs | 10 ++++++ www/Makefile | 1 + www/datastore/OptionView.js | 7 ++++ www/window/FstrimJobEdit.js | 27 +++++++++++++++ 7 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 www/window/FstrimJobEdit.js Summary over all repositories: 8 files changed, 134 insertions(+), 2 deletions(-) -- Generated by murpp 0.9.0