[SOLVED] Wrong size calculation in web-UI when using ZFS datasets within "images"?

Pickwick

New Member
Aug 6, 2024
7
1
3
Hi everyone,

in my Proxmox I've created a storage dir to store all kinds of data and made that one a ZFS dataset on its own. I want to be able to configure individual auto-snapshot retention policies this way. Everything works fine, I'm able to create VMs etc. in that dataset and the web-UI shows the usage of the pool and the amount of data within that dataset.

Bash:
pvesm add dir 'zpool-hdd' --content 'backup,images,iso,rootdir,snippets,vztmpl' --is_mountpoint 'yes' --prune-backups 'keep-all=1' --path '/zpool-hdd/pve'

Though, I've decided to put one VM into an additional child dataset to apply individual retention policy on that as well. That additional dataset is zpool-hdd/pve/images/100 and really not otherwise known to Proxmox, but just a plain ZFS dataset. While that still works as expected, I just recognized that the size calculation in the web-UI doesn't work properly anymore. Before my change it showed the size of all the files in all the directories within zpool-hdd/pve, nowe it only show the size of the files directly in the dataset zpool-hdd/pve without taking child datasets into account. So the size calculation is bound to the boundaries of datasets.

Is that behaviour designed that way and as expected?

I expected that Proxmox looks at my datasets just as directories and takes the child directories and files into account when calculating the size. But it seems to be dataset-aware in this case, even though I just created "dir".
 
This should the expected behavior of the WebGUI's usage statistics, as even though the zpool-hdd/pve/images/100 dataset is a child dataset of the parent dataset zpool-hdd/pve, it is still a separate filesystem that is just happening to be mounted on top of another already mounted ZFS pool directory. It's the same as I wouldn't expect my root / to grow in size when I write to some external mount point /mnt/foo.
 
It's the same as I wouldn't expect my root / to grow in size when I write to some external mount point /mnt/foo.
There's a difference: Proxmox takes the free space from the pool as well already, because the individual datasets don't have their own free space. So, do you know if Proxmox really looks at "zfs" commands for the directory sizes and free space? Or does it use some file-based size calculation which just stops at filesystem boundaries? Some tools have something like "--one-filesystem" or something.
 
Seems like Proxmox simply uses the following, because that's pretty much the numbers I see:

Bash:
root@srv01:/zpool-hdd/pve# df -h .
Filesystem      Size  Used Avail Use% Mounted on
zpool-hdd/pve    15T  910M   15T   1% /zpool-hdd/pve
root@srv01:/zpool-hdd/pve#
 
Yes, that's correct! Proxmox VE uses the df command to get the used available space for the ZFS directory mount (with storage type dir).
So, do you know if Proxmox really looks at "zfs" commands for the directory sizes and free space? Or does it use some file-based size calculation which just stops at filesystem boundaries?
Proxmox VE uses the zfs command to get the used and available space when the storage type is zfs, where it will output the sizes for the whole ZFS pool. The difference here is really that when you add a ZFS as a "Directory" in PVE it will get treated that way, not the other way around.

If you look closely when you e.g. (temporarily) move some larger file to zpool-hdd/pve/images/100, the "total size" in the Usage bar of your zpool-hdd/pve storage in PVE will shrink by roughly that amount, because it was "taken away" from the zpool-hdd/pve ZFS directory by the zpool-hdd/pve/images/100 ZFS directory in your ZFS pool. You'd need to add zpool-hdd/pve/images/100 as its own mounted directory storage in PVE to also see its Usage in the WebGUI.
 

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!