* Re: [PATCH proxmox-backup 5/5] api: set default fstrim schedule on datastore create
@ 2026-03-24 14:08 Fabian Grünbichler
0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2026-03-24 14:08 UTC (permalink / raw)
To: Christian Ebner, pbs-devel
On March 19, 2026 3:36 pm, Christian Ebner wrote:
> Default to set a weekly fstrim schedule for newly created datastores.
>
> Do not set when crating a datastore via the ZFS dialog, as it does
> not support discard.
that is not true, it just doesn't support triggering discard/trim via
fstrim.. which might be true for other file systems as well, not sure?
>
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
> src/api2/config/datastore.rs | 1 +
> src/api2/node/disks/directory.rs | 6 ++++--
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs
> index b10b7fb0a..45df53c72 100644
> --- a/src/api2/config/datastore.rs
> +++ b/src/api2/config/datastore.rs
> @@ -336,6 +336,7 @@ pub fn create_datastore(
> // clearing prune settings in the datastore config, as they are now handled by prune jobs
> let config = DataStoreConfig {
> prune_schedule: None,
> + fstrim_schedule: config.fstrim_schedule.or(Some("weekly".to_string())),
> keep: KeepOptions::default(),
> ..config
> };
> diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
> index c37d65b8d..42cd1d2d7 100644
> --- a/src/api2/node/disks/directory.rs
> +++ b/src/api2/node/disks/directory.rs
> @@ -242,10 +242,12 @@ pub fn create_datastore_disk(
> let lock = pbs_config::datastore::lock_config()?;
> let datastore: DataStoreConfig = if removable_datastore {
> serde_json::from_value(
> - json!({ "name": name, "path": name, "backing-device": uuid }),
> + json!({ "name": name, "path": name, "backing-device": uuid , "fstrim-schedule": "weekly" }),
> )?
> } else {
> - serde_json::from_value(json!({ "name": name, "path": mount_point }))?
> + serde_json::from_value(
> + json!({ "name": name, "path": mount_point, "fstrim-schedule": "weekly" }),
> + )?
> };
> let (config, _digest) = pbs_config::datastore::config()?;
>
> --
> 2.47.3
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread* [RFC proxmox{,-backup} 0/6] add scheduled fstrim job for datastore's backing filesystems
@ 2026-03-19 14:36 Christian Ebner
2026-03-19 14:36 ` [PATCH proxmox-backup 5/5] api: set default fstrim schedule on datastore create Christian Ebner
0 siblings, 1 reply; 2+ messages in thread
From: Christian Ebner @ 2026-03-19 14:36 UTC (permalink / raw)
To: pbs-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH proxmox-backup 5/5] api: set default fstrim schedule on datastore create
2026-03-19 14:36 [RFC proxmox{,-backup} 0/6] add scheduled fstrim job for datastore's backing filesystems Christian Ebner
@ 2026-03-19 14:36 ` Christian Ebner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Ebner @ 2026-03-19 14:36 UTC (permalink / raw)
To: pbs-devel
Default to set a weekly fstrim schedule for newly created datastores.
Do not set when crating a datastore via the ZFS dialog, as it does
not support discard.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
src/api2/config/datastore.rs | 1 +
src/api2/node/disks/directory.rs | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs
index b10b7fb0a..45df53c72 100644
--- a/src/api2/config/datastore.rs
+++ b/src/api2/config/datastore.rs
@@ -336,6 +336,7 @@ pub fn create_datastore(
// clearing prune settings in the datastore config, as they are now handled by prune jobs
let config = DataStoreConfig {
prune_schedule: None,
+ fstrim_schedule: config.fstrim_schedule.or(Some("weekly".to_string())),
keep: KeepOptions::default(),
..config
};
diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
index c37d65b8d..42cd1d2d7 100644
--- a/src/api2/node/disks/directory.rs
+++ b/src/api2/node/disks/directory.rs
@@ -242,10 +242,12 @@ pub fn create_datastore_disk(
let lock = pbs_config::datastore::lock_config()?;
let datastore: DataStoreConfig = if removable_datastore {
serde_json::from_value(
- json!({ "name": name, "path": name, "backing-device": uuid }),
+ json!({ "name": name, "path": name, "backing-device": uuid , "fstrim-schedule": "weekly" }),
)?
} else {
- serde_json::from_value(json!({ "name": name, "path": mount_point }))?
+ serde_json::from_value(
+ json!({ "name": name, "path": mount_point, "fstrim-schedule": "weekly" }),
+ )?
};
let (config, _digest) = pbs_config::datastore::config()?;
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-24 14:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-24 14:08 [PATCH proxmox-backup 5/5] api: set default fstrim schedule on datastore create Fabian Grünbichler
-- strict thread matches above, loose matches on Subject: below --
2026-03-19 14:36 [RFC proxmox{,-backup} 0/6] add scheduled fstrim job for datastore's backing filesystems Christian Ebner
2026-03-19 14:36 ` [PATCH proxmox-backup 5/5] api: set default fstrim schedule on datastore create Christian Ebner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.