Can I use my ZFS pool as data storage (in addition to VM storage)?

May 21, 2020
25
9
8
I run Proxmox at home on an ASRock DeskMini, with the following storage:
  • 1x 512GB NVMe SSD (Proxmox is installed here)
  • 2x Intel D3-S4510 960GB SATA SSD (this is a ZFS mirror called intel_mirror where my VMs/LXCs reside)
Code:
root@proxmox02:~# zpool list
NAME           SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
intel_mirror   888G   258G   630G        -         -    44%    29%  1.00x    ONLINE  -
root@proxmox02:~# zfs list
NAME                             USED  AVAIL     REFER  MOUNTPOINT
intel_mirror                     316G   544G      128K  /intel_mirror
intel_mirror/subvol-101-disk-0  1.12G  6.88G     1.12G  /intel_mirror/subvol-101-disk-0
intel_mirror/subvol-103-disk-0   301M  7.71G      301M  /intel_mirror/subvol-103-disk-0
intel_mirror/subvol-104-disk-0  2.73G  6.30G     1.70G  /intel_mirror/subvol-104-disk-0
intel_mirror/subvol-104-disk-1  61.4G  38.6G     61.4G  /intel_mirror/subvol-104-disk-1
intel_mirror/subvol-107-disk-0  2.02G  5.98G     2.02G  /intel_mirror/subvol-107-disk-0
intel_mirror/subvol-113-disk-0  4.19G  3.81G     4.19G  /intel_mirror/subvol-113-disk-0
intel_mirror/vm-100-disk-0      56.7G   552G     49.2G  -
intel_mirror/vm-102-disk-0      8.25G   548G     4.33G  -
intel_mirror/vm-105-disk-0         3M   544G       80K  -
intel_mirror/vm-105-disk-1      16.5G   556G     5.02G  -
intel_mirror/vm-106-disk-0      77.3G   557G     64.6G  -
intel_mirror/vm-111-disk-0      8.25G   547G     5.37G  -
intel_mirror/vm-207-disk-0      77.3G   564G     57.2G  -

I run some VMs (Nextcloud, Docker, K3s, etc...) that have data stored on the VM disk (right next to the OS), which means the VM is huge and has a huge backup (see VMs 104, 106, and 207 above).

I'd like to carve out some space on my ZFS mirror, mount that to my VMs, and have each VM use that as a storage. This would:
  • make my VM smaller (since my data is stored on a mountpoint)
  • allow me to backup my data with zfs send
How can I accomplish this? I think I need to:
  • create a dataset for each VM
  • Code:
    zfs create -p intel_mirror/data_storage/nextcloud
    zfs create -p intel_mirror/data_storage/docker
    zfs create -p intel_mirror/data_storage/k3s
  • Create a directory on that dataset (e.g., Datacenter-->Storage-->Add-->Directory, put in a path like /intel_mirror/data_storage/nextcloud, repeat for the rest)
  • Set is_mountpoint to true and mkdir to 0
  • Code:
    pvesm set ZFS_nextcloud --is_mountpoint yes
    pvesm set ZFS_docker --is_mountpoint yes
    pvesm set ZFS_k3s --is_mountpoint yes
    
    pvesm set ZFS_nextcloud --mkdir 0
    pvesm set ZFS_docker --mkdir 0
    pvesm set ZFS_k3s --mkdir 0
  • Add a hard disk to my VMs using that storage
  • Mount the disk in /etc/fstab and add a filesystem (does it matter which filesystem, since it's ZFS underneath?)
  • Done???
 
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!