Discard is not working, discard doesn't free up space

Aug 23, 2023
9
2
1
Hi.
So I added new SSD. 2TB NVMe.
I did move some VMs to this SSD, I need free up space. at this moment proxmomx shows full VMs disk full size in admin panel
So I did enable dsicard on, than did login in Ubuntu 20.04 guest and did run trim commands.
But proxmox panel is showing there is no space on disk enough.
When I run zpool list, I see different values, which could more true with space.
Like here is picture about where free space for disk 1.37 tb.
1727322152673.png1727322075660.png
1727322015931.png
 
Last edited:
  • Like
Reactions: 0815Cracky
Hello,

I’m facing a similar issue as described in this thread. I have a VM with Ubuntu Server 24.04 on Proxmox 8.3.1. After deleting a large amount of data in the VM (from approximately 1 TB down to ~300 GB), I expected the free space to be released on the ZFS level. However, the backup size still remains the same (~1 TB).

I’m attaching a screenshot of my ZFS pool settings:
zfs_settings.png

My questions:
  • Are my ZFS pool settings correct?
  • If they are, how can I manually or automatically perform space reclamation so that Proxmox recognizes the freed space, and the backup size reflects the actual used space?
 
@smueller
I am very glad for your answers. Unfortunately I am not IT pro or a programmer so I want to solve this issue as simple as possible.
That is why I ask numb questions.
I read the admin guide but I did not find any helpful information.

So if I understand it right I can connect to my VM via ssh and run:
Bash:
sudo fstrim -av

Is it correct or you recommend something else?
 
I miss your previous answer about using command
Bash:
systemctl start fstrim.service

I tried it and gonna make a Proxmox backup for testing.
Then I will let you know.
 
  • Like
Reactions: smueller
It's correct and should work with out issues.

you should get something like this as output:
1734010243982.png
But you would have to run it periodically.

Or set up a cron job to run fstrim weekly or for example every 2 days, follow these steps:

  1. Open the crontab editor
    Run the following command in your terminal:
    Code:
    crontab -e

  2. Add the cron job for fstrim
    Insert the following line into the crontab file:
    Weekly:
    Code:
    @weekly /sbin/fstrim -a

    Every two days:
    Code:
    0 3 */2 * * /sbin/fstrim -a

  3. Save and exit
    After editing the crontab file, save the changes and exit (in vim, press Esc, type :wq, and hit Enter).

  4. Verify the crontab entry
    To confirm the cron job is set, list the crontab entries:
    Code:
    crontab -l
 
Last edited:
  • Like
Reactions: vawaver
@smueller
Perfect!
I just tested a Proxmox backup of trimmed VM and it finally works as I need!!!
I appreciate your help.

Now I am able to create Wiki tutorial for my friends for this topic.