ZFS - subvolume for zvol vm disks?

Dec 30, 2020
11
1
8
Hello,

I've created a zfs pool (zssd960) with the proxmox GUI
After creating some VMs I see the disks of the VMs created as ZFS zvols direct under the ZFS pool
zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 5,61G 102G 104K /rpool
rpool/ROOT 5,61G 102G 96K /rpool/ROOT
rpool/ROOT/pve-1 5,61G 102G 5,61G /
rpool/data 96K 102G 96K /rpool/data
zssd960 203G 657G 96K /zssd960
zssd960/vm-100-disk-0 33,0G 689G 1,35G -
zssd960/vm-101-disk-0 33,0G 689G 1,40G -
  • the rpool contains a subvol - data - where the zvols are placed
  • should I create a subvol on my pool (zssd960) also?
zfs create -V 4G zssd960/vol-test-1
zfs create zssd960/volumes
zfs rename zssd960/vol-test-1 zssd960/volumes/vol-test-1
  • is there an advantage using a subvol for the vm disks?
  • if I create a subvol and move the vm disks - I've to edit /etc/pve/storage.cfg
from:
zfspool: zssd960
pool zssd960
content images,rootdir
mountpoint /zssd960
nodes srv1,srv2
sparse 1

to:
zfspool: zssd960
pool zssd960/volumes
content images,rootdir
mountpoint /zssd960/volumes
nodes srv1,srv2
sparse 1
  • is it okay to change the storage path of VM disks in storage.cfg (when the VMs are off)?
  • or should I simple let the VM disk live in the ZFS pool root?
Thanks,
Gerald
 
or should I simple let the VM disk live in the ZFS pool root?
My recommendation: stick with the defaults.

I can see no real benefit for a subvol approach unless you have "multiple things" hosted on one pool and therefore want to have some folder structure. And this might be the reason you see this on the rpool.
 
Subvols are for inheritance, childs inherit options from their parent volume.

If you got vm/vm-x, and container/container-x you can set options on vm for every vm etc.

So it's best practice to use it.


For options use lz4 compression which is default in newer version and disable atime for better performance.

If it's a raidz also adjust volblocksize.
 
I like using datasets. For example I got datasets for:
-encrypted zvols with sync=standard
-encrypted zvols with sync=none (to prevent sync writes)
-unencrypted zvols

That way I can move my zvols between these 3 datasets and the zvols will inherit the settings of the parent dataset.
If everything if stored on the pool itself without datasets, it isn't possible to use encrypted and unencrypted zvols at the same time because the complete pool with everything within would be encrypted. So its better to just encrypt one dataset.
And datasets are great to organize things if you want to use recursive snapshots/replication.
For stuff like that datasets are great.
 
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!