Using a ZFS pool for backups (iso, vztmpl)

ndejay

Member
Dec 19, 2020
8
1
23
36
Hi,

I have a ZFS dataset intended for backing up QEMU and LXC images.

Code:
root@doctor:~# zpool list
NAME   SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
slim  1.81T   163G  1.65T        -         -     0%     8%  1.00x    ONLINE  -
root@doctor:~# zfs list
NAME               USED  AVAIL     REFER  MOUNTPOINT
slim               163G  1.60T      112K  /slim
slim/backup        138G   374G      138G  /slim/backup
slim/vz           24.3G  39.7G     24.3G  /slim/vz

I configured the PVE storage to use it for backup purposes, as follows:

Code:
root@doctor:~# cat /etc/pve/storage.cfg
dir: slim-vz
       path /slim/vz
       content iso,vztmpl,snippets
       nodes doctor,dope-dean
       shared 0

dir: slim-backup
       path /slim/backup
       content backup
       nodes doctor,dope-dean
       shared 0

However, sometimes when I reboot, PVE is loaded before ZFS and creates the whole directory tree structure and prevents the ZFS pool from being mounted where it should be.

Code:
tree /slim
/slim
├── backup
│   └── dump
└── vz
    ├── snippets
    └── template
        ├── cache
        └── iso

Is there a simple solution for this i.e. telling PVE not to create the directory structure?

Many thanks!
 
I figured it out, I simply made sure that ZFS pools are mounted before PVE storage runs.

Code:
$ cat /lib/systemd/system/pve-storage.target
After=zfs-mount.service
 
  • Like
Reactions: elriti