Trim, Discard and Raw - How to reclaim space

Dihaxu

New Member
Feb 17, 2023
9
2
3
Hi, one of my VMs expanded to fill the pool, and maxed out the storage. I was able to use a rescue disk to remove some files and reduce the size of the VM, but the pool is still full.

Within the VM if I run df I see I have 4TB free space on /sdb:


Code:
~$ df -H
Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                              3.4G  1.2M  3.4G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   32G   21G  9.9G  68% /
tmpfs                               17G     0   17G   0% /dev/shm
tmpfs                              5.3M     0  5.3M   0% /run/lock
/dev/sda2                          2.1G  264M  1.7G  14% /boot
/dev/sdb                            35T   31T  4.2T  88% /data
tmpfs                              3.4G  4.1k  3.4G   1% /run/user/1000

fstrim is enabled, and in my VM settings I have Discard checked.

My pool is ZFS and the disk is RAW format. Should I be able to shrink the disk file within the pool, or will it always stay at that size, just with free space within it?

Thanks for any help
 
I have fstrim enabled to run on the default Ubuntu schedule, and I have tried running manually like that, but am not seeing any change in the raw disk file size in the pool. Should it be possible to shrink that disk file by doing this?
 
Does that mean I can only reclaim space on my pool if it uses SSDs? The pool itself is on spinning disks.

I have a ZFS pool on spinning disks, and then for my VM I have that set to use SSD Emulation and Discard.
 
Also, my storage is Thin Provisioned, and this is the pool info:

Code:
# zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
dpool  32.7T  32.2T   535G        -         -    49%    98%  1.00x    ONLINE  -
rpool   230G  21.9G   208G        -         -     3%     9%  1.00x    ONLINE  -
 
I have a feeling I just didn't free up as much space in the VM as I thought... Removed one other large file I missed and running fstrim, and I can see the space being reclaimed in Proxmox.

Thanks for the help
 
  • Like
Reactions: ITT
Does that mean I can only reclaim space on my pool if it uses SSDs? The pool itself is on spinning disks.
No, you can reclaim space also on harddisks.


I have a ZFS pool on spinning disks, and then for my VM I have that set to use SSD Emulation and Discard.
That's good. Have you virtio-SCSI aswell?

I have tried running manually like that, but am not seeing any change in the raw disk file size in the pool. Should it be possible to shrink that disk file by doing this?
What does the command output? the -v is explcitly there to show you what is trimmed.

Ubuntu you say ... what filesystem are you running in ubuntu? If this is also ZFS, you may run zpool trim <pool> in your Ubuntu machine.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!