Hi,
this is a (kind of a) continuation of this thread: https://forum.proxmox.com/threads/container-shows-wrong-disk-usage.37429/
But to keep things clear and because of a new problem I open a new topic.
So the old problem was, that whenever I delete files inside a container the raw disk file of the container itself does not shrink and that is a problem.
The last threads solution was to mount every container and do and fstrim (or if the container is not unprivileged you can run fstrim directly in the container), but to keep things clear I wrote myself this script:
I think it's very simple but works good, mounts all containers, do fstrim and after that unmount.
BUT, I've ran out of disk space so I used a NFS share for some containers disk images.
So far so good, but as it's the same, just the .raw disk images saved on the NFS server, I get the same problem: delete a file in a container and the disk space will be still used.
Ah, this aint no problem, right? Just do fstrim like always!
So it looks like fstrim is not supported on nfs shares. My only option would be to mount the disk inside the nfs server and then do fstrim. But as the NFS server is no proxmox node I cant simply do pct mount.
So I'm really screwed now, any idea how to solve my problem?
this is a (kind of a) continuation of this thread: https://forum.proxmox.com/threads/container-shows-wrong-disk-usage.37429/
But to keep things clear and because of a new problem I open a new topic.
So the old problem was, that whenever I delete files inside a container the raw disk file of the container itself does not shrink and that is a problem.
The last threads solution was to mount every container and do and fstrim (or if the container is not unprivileged you can run fstrim directly in the container), but to keep things clear I wrote myself this script:
Code:
#!/bin/bash
vmid=$(ls /etc/pve/nodes/*nodename*/lxc/)
list=$(echo "$vmid" | sed -r 's/.conf//g')
for i in $list
do
pct mount $i
done
for j in $list
do
fstrim /var/lib/lxc/$j/rootfs
done
for k in $list
do
pct unmount $k
done
I think it's very simple but works good, mounts all containers, do fstrim and after that unmount.
BUT, I've ran out of disk space so I used a NFS share for some containers disk images.
So far so good, but as it's the same, just the .raw disk images saved on the NFS server, I get the same problem: delete a file in a container and the disk space will be still used.
Ah, this aint no problem, right? Just do fstrim like always!
Code:
root@pve:~# pct mount 102
root@pve:~# fstrim /var/lib/lxc/102/rootfs
fstrim: /var/lib/lxc/102/rootfs: the discard operation is not supported
So it looks like fstrim is not supported on nfs shares. My only option would be to mount the disk inside the nfs server and then do fstrim. But as the NFS server is no proxmox node I cant simply do pct mount.
So I'm really screwed now, any idea how to solve my problem?