ZFS combines a volume manager and filesystem with checksums, compression, snapshots and replication. That makes ZFS storage for virtual machines popular on Proxmox VE, VirtFusion and plain KVM hosts. This guide covers the decisions that matter for VM performance and safety.
Before you start
- A Linux host with OpenZFS installed (
sudo apt install zfsutils-linuxon Ubuntu; built into Proxmox VE). - Dedicated disks for the pool, ideally NVMe or enterprise SSDs. Disks are wiped when added.
- Plenty of RAM; ZFS uses it for the ARC read cache.
Choose a pool layout
| Layout | Redundancy | VM performance |
|---|---|---|
| Mirror (2-way) | Survives 1 disk per mirror | Best random I/O, recommended for VMs |
| Striped mirrors (RAID10) | 1 disk per mirror vdev | Excellent; scales with vdevs |
| RAIDZ1/2 | 1 or 2 disks per vdev | More usable space, weaker random I/O |
Create a mirror pool using stable disk IDs:
zpool create -o ashift=12 vmpool mirror /dev/disk/by-id/nvme-DISK1 /dev/disk/by-id/nvme-DISK2Set dataset defaults
zfs set compression=lz4 vmpoolzfs set atime=off vmpoollz4 compression is cheap and usually increases effective throughput.
Create zvols for VM disks
A zvol is a block device backed by ZFS, used as a raw VM disk:
zfs create -s -V 50G -o volblocksize=16k vmpool/vm-101-disk-0-smakes it sparse (thin provisioned).volblocksizeis fixed at creation. 16k is a common default; databases may prefer matching their page size.- Attach
/dev/zvol/vmpool/vm-101-disk-0to the VM as a raw virtio disk.
Proxmox and VirtFusion create zvols for you when you add a ZFS storage; see VirtFusion storage.
Plan RAM for the ARC
ARC defaults to a large share of RAM. On a VM host, cap it so guests have memory:
echo "options zfs zfs_arc_max=8589934592" | sudo tee /etc/modprobe.d/zfs.confThat caps ARC at 8 GiB after reboot (update the initramfs on Debian-based systems).
Snapshots and replication
zfs snapshot vmpool/vm-101-disk-0@before-upgradezfs send -i @snap1 vmpool/vm-101-disk-0@snap2 | ssh backup zfs receive backup/vm-101Incremental send/receive copies only changed blocks to another host, a strong base for off-site backups.
Troubleshooting
- Pool slow when nearly full: keep usage under about 80%.
- Host out of memory: lower
zfs_arc_max. - Degraded pool: check
zpool statusand replace the failed disk withzpool replace.
Frequently asked questions
Do I need ECC RAM for ZFS?
Recommended for servers, as with any filesystem, but ZFS works without it.
ZFS or LVM-thin for VMs?
LVM-thin is lighter on RAM; ZFS adds checksums, compression and replication. See VM disk formats.
Should I add an SLOG or L2ARC?
Only after measuring. An SLOG helps sync-heavy writes; L2ARC helps when the working set exceeds RAM.
