ZFS: zvol or files

Alessandro 123

Well-Known Member
May 22, 2016
653
24
58
40
Sorry for the question but standard PVE with ZFS, store images in files on a ZFS or creates a new zvol for each VM ?

In other words: something like a new LVM volume for each VM disk like XenServer does or images are stored as files ?
 
Both is supported. You can either use raw file images in directory storage in zfs or zvol block device-based images. The default config uses the latter (zvols for each vm).
 
Yes, sory for being imprecise, 1 zvol per VM disk. zvol has the supposed advantage of being a "simple" block device with fewer layers of complexity and thus being faster for this kind of storage, but it's better to test in your own systems first. The PVE defaults are pretty good though, I rarely need to change them in this regard.
 
Ok, so, a zvol is a block device, the VM sees that as /dev/sda (or similiar) and is able to partition and format using ext4 or any other filesystem)

If I have to access to the VM filesystem from PVE, i could map the zvol partition via kpartx and mount each partition somewhere on PVE host.
 
Yes, you can do that - but always use a (zfs) clone of the zvol before attempting that, or even better for consistent results, shut down the vm and then use directly, clone/restart etc.
 
Is possible to increse/decrease the size of ZVOL online and then just resize the partition inside from the VM ?
 
PVE supports increase even on the web GUI and then you can adjust partitions inside the guest. You can decrease manually but that requires more complex preparation.
 
Well, after setting the volsize to the desired new value, you'll need to fix up the size value in your qemu vm convig under /etc/pve/... too. That should do it, but by that time you'll need to have prepared the shrinked fs inside the guest.

According to this issue, you might need to export/import your pool (or reboot) to make the change visible but I don't think it's necessary any more.
 

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!