ZFS usedbysnapshot is off by a hundred gigabytes

WhiteStarEOF

Active Member
Mar 6, 2012
96
10
28
Hello,

I have a couple of Proxmox 4.4 deployments out in the wild. On occasion, one of them will have their "usedbysnapshot" field grow to incredible sizes. If I do a zfs get all on the vdev, it's showing usedbysnap is 279G. I've listed out all of the snapshots, there are 337 hourly snapshots, which is expected. None of them hit 1GB in size. The largest might be 200MB in size. I sum'd them up, and they total about 8GB.

Has anyone run into this before, where the usedbysnapshot seems to have gone off the rails? Any way to work around it? Currently I'm getting the exact values by sum'ing up zfs list -p -t snapshot pool/dataset/zvol. I could script it up, but it would be nice to see it just work. I've got at least 3 zvols across different machines that are doing this right now.
 
IMHO usedbysnapshot only refers to data that is ONLY used in this snapshot and is in general not useable to calculating sizes of snapshots. If you want to calculate the size of a snapshot (so the difference to another one), you have to zfs send with verbose as a dry-run and then look at the bottom of the verbose output. This is the size of the snapshot:

Code:
$ zfs send -Pnv \
    -I zpool/proxmox/subvol-1098-disk-1@2018_04_02-20_00_01 \
       zpool/proxmox/subvol-1098-disk-1@2018_04_03-04_00_01 \
  | grep size
size    72937232
 
So, apparently the "written" field will tell you how much new data is contained in a snapshot, if I were to add those up, I get yet another value for space used.

I can't imagine that transferring snapshots is the only way to achieve even somewhat accurate accounting for space utilization. That would be a massive failing of ZFS indeed.
 
You also have to differentiate between space utilization and size of the snapshot. The first depends on compression, ashift value, used raiz/mirroring and copies :-D
 

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!