parameter to ignore mountpoints when doing fstrim on a container
root@pve:~# pct fstrim 123
/var/lib/lxc/123/rootfs/: 338.7 MiB (
355094528 bytes) trimmed
/var/lib/lxc/123/rootfs/test: 8.9 GiB (
9576009728 bytes) trimmed
root@pve:~# pct fstrim 123 --ignore-mountpoints
/var/lib/lxc/123/rootfs/: 338.7 MiB (
355094528 bytes) trimmed
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
additionalProperties => 0,
properties => {
vmid => get_standard_option('pve-vmid', { completion => \&PVE::LXC::complete_ctid }),
+ 'ignore-mountpoints' => {
+ description => 'ignore mountpoints when doing an fstrim operation for a container.',
+ optional => 1,
+ type => 'boolean',
+ },
},
},
returns => { type => 'null' },
PVE::LXC::Config->foreach_volume($conf, sub {
my ($name, $mp) = @_;
$path = $mp->{mp};
+ return if $param->{'ignore-mountpoints'} && $name =~ /^mp\d+/;
my $cmd = ["fstrim", "-v", "$rootdir$path"];
PVE::Tools::run_command($cmd);
});