NFS storage + live migration lab
This lab produces shared NFS storage across all cluster nodes and demonstrates live migration between two hosts.
Steps
1. Configure the NFS server
On the NFS host:
apt install -y nfs-kernel-server
mkdir -p /srv/nfs-vm
chown nobody:nogroup /srv/nfs-vm
cat > /etc/exports << 'EOF'
/srv/nfs-vm 10.0.0.0/24(rw,sync,no_subtree_check,no_root_squash)
EOF
exportfs -a
systemctl enable --now nfs-server
2. Test the export
# From any PVE node
showmount -e <nfs-server>
# Expected: /srv/nfs-vm 10.0.0.0/24
3. Add NFS as PVE storage
In the GUI: Datacenter → Storage → Add → NFS.
ID: nfs-vm
Server: <nfs-server>
Export: /srv/nfs-vm
Content: Disk image, Container
Or via CLI:
pvesm add nfs nfs-vm --server <nfs-server> --export /srv/nfs-vm \
--content images,rootdir --options vers=4.1
The storage is automatically mounted on every cluster node.
4. Create a test VM on NFS
qm create 920 --name nfs-test --memory 2048 --cores 2 \
--net0 virtio,bridge=vmbr0 --ostype l26 \
--scsi0 nfs-vm:32,iothread=1
qm start 920
5. Verify the VM is on shared storage
pvesh get /nodes/<current-node>/qemu/920/config
# Look for scsi0: nfs-vm:vm-920-disk-0
6. Live migrate to another node
qm migrate 920 <target-node> --online
Watch the migration progress:
# On the source node, while the VM is migrating
pvesh get /cluster/resources --type vm
# Expected: VM shows state "running" throughout; brief "migrating" mid-flight
7. Confirm the VM is on the target node
pvesh get /nodes/<target-node>/qemu/920/status/current
# Expected: status "running"
Verify the VM did not reboot (check uptime inside the guest):
# Inside the VM
uptime
# Compare to the time before migration; difference should be a few seconds, not minutes
Verification
- NFS share is mounted on every cluster node
- A VM created on NFS can live-migrate with zero downtime
- VM uptime inside the guest confirms continuous operation
pvesm statuslists nfs-vm with the right content types
Cleanup
qm stop 920 && qm destroy 920
# On every cluster node:
umount /mnt/pve/nfs-vm
# Then remove the storage via the GUI or:
pvesm remove nfs-vm
# On the NFS server:
rm -rf /srv/nfs-vm/*
Notes
NFS for VM workloads is supported but has trade-offs: no per-VM snapshots (only per-export), and performance depends heavily on the network. For higher-performance shared storage, consider Ceph (RBD) or iSCSI. This lab demonstrates NFS as the simplest option.