ZFS doesn't update free space correctly

sandman

Member
Oct 10, 2017
9
0
6
33
Hello

I've been having a problem with a thin-provisioned filesystem on ZFS. Right now I'm not really sure if its a problem with proxmox or the guest. Right now my setup is:

ZFS:
Code:
NAME                       USED  AVAIL  REFER  MOUNTPOINT
rpool                     10.2T  47.1G   140K  /rpool
rpool/ROOT                45.0G  47.1G   140K  /rpool/ROOT
rpool/ROOT/pve-1          35.0G  57.0G  35.0G  /
rpool/data                10.1T  47.1G   140K  /rpool/data
rpool/data/vm-100-disk-2  10.1T  47.1G  10.1T  -
rpool/swap                8.50G  53.4G  2.19G  -

Guest:
- Running Debian 8.10
- Over provisioned disk (10035G, shows as 9.8TiB)
- Disk is mounted as scsi-virtio with discard option marked on proxmox.
- Free space on disk:
Code:
# df  -h /u
S.ficheros     Tamaño Usados  Disp Uso% Montado en
/dev/sda         9,8T   6,9T  2,4T  75% /u
- Output of fstrim
Code:
# fstrim -v /u
/u: 27,6 GiB (29595009024 bytes) trimmed

You can see there is a pretty huge difference between free space on the guest and what ZFS is showing. I have a small reservation on rpool/ROOT/pve-1 to make sure it doesn't completely fills root.

Is there any way to correctly reclaim the free space on the guest?
 
do you have snapshots on that disk? do you have checked the box 'thin-provisioned' ? if not, marks the disk as not sparse and it uses the specified space
 
- No snapshots at all.
- Thin provision is enabled on ZFS storage
upload_2018-6-14_11-13-30.png

- How would I mark the disk as not sparse? Just uncheck discard on the disk?

EDIT:
So when doing a zfs get all I noticed this:
Code:
# zfs get all rpool/data/vm-100-disk-2
NAME                      PROPERTY              VALUE                  SOURCE
rpool/data/vm-100-disk-2  type                  volume                 -
rpool/data/vm-100-disk-2  creation              Mon Jul 10 10:45 2017  -
rpool/data/vm-100-disk-2  used                  10.1T                  -
rpool/data/vm-100-disk-2  available             47.1G                  -
rpool/data/vm-100-disk-2  referenced            10.1T                  -
rpool/data/vm-100-disk-2  compressratio         1.00x                  -
rpool/data/vm-100-disk-2  reservation           none                   default
rpool/data/vm-100-disk-2  volsize               9.80T                  local
rpool/data/vm-100-disk-2  volblocksize          8K                     default
rpool/data/vm-100-disk-2  checksum              on                     default
rpool/data/vm-100-disk-2  compression           on                     inherited from rpool
rpool/data/vm-100-disk-2  readonly              off                    default
rpool/data/vm-100-disk-2  createtxg             1811                   -
rpool/data/vm-100-disk-2  copies                1                      default
rpool/data/vm-100-disk-2  refreservation        none                   default
rpool/data/vm-100-disk-2  guid                  9301506174573547132    -
rpool/data/vm-100-disk-2  primarycache          all                    default
rpool/data/vm-100-disk-2  secondarycache        all                    default
rpool/data/vm-100-disk-2  usedbysnapshots       0B                     -
rpool/data/vm-100-disk-2  usedbydataset         10.1T                  -
rpool/data/vm-100-disk-2  usedbychildren        0B                     -
rpool/data/vm-100-disk-2  usedbyrefreservation  0B                     -
rpool/data/vm-100-disk-2  logbias               latency                default
rpool/data/vm-100-disk-2  dedup                 off                    default
rpool/data/vm-100-disk-2  mlslabel              none                   default
rpool/data/vm-100-disk-2  sync                  standard               inherited from rpool
rpool/data/vm-100-disk-2  refcompressratio      1.00x                  -
rpool/data/vm-100-disk-2  written               10.1T                  -
rpool/data/vm-100-disk-2  logicalused           6.93T                  -
rpool/data/vm-100-disk-2  logicalreferenced     6.93T                  -
rpool/data/vm-100-disk-2  volmode               default                default
rpool/data/vm-100-disk-2  snapshot_limit        none                   default
rpool/data/vm-100-disk-2  snapshot_count        none                   default
rpool/data/vm-100-disk-2  snapdev               hidden                 default
rpool/data/vm-100-disk-2  context               none                   default
rpool/data/vm-100-disk-2  fscontext             none                   default
rpool/data/vm-100-disk-2  defcontext            none                   default
rpool/data/vm-100-disk-2  rootcontext           none                   default
rpool/data/vm-100-disk-2  redundant_metadata    all                    default

logicalused and logicalreferenced show the right space used.
 
Last edited:

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!