The Proxmox Server offers native backup capabilities. It can be slow, but figured out a way to tweak it with PIGZ and that offered great improvements. However, the nightly backups are complete virtual machines. Proxmox Backup Server (“PBS”) can be used to facilitate backups incrementally and offers pruning and so many other backup related features. The setup seems to require local hard disks, but I wanted to use iSCSI. I figured out a way to use iSCSI on the PBS successfully. This article will pickup from a point after a successful install of PBS and setup the iSCSI target.
PBS can apparently be setup three different ways. One as a virtual machine on the Proxmox server; I have read that this is not advisable. Another method directly installed via command line on the Proxmox server; I wasn’t a fan of this approach for no real reason. The final approach, to install as a separate server, is the selected setup for this PBS installation.
From the PBS command line, the following commands were used to test the connectivity between the PBS and iSCSI target and to manually setup ZFS.
iscsiadm -m discovery -t st -p 10.10.10.10 iscsiadm -m node --login iscsiadm -m session -o show
If successful, then setup the ZFS pool. Determine the disk using fdisk -l. I have determined that /dev/sdb was the one to use.
zpool create -f backups /dev/sdb zpool list
After the ZFS is setup, you should be able to access /backups from your system. Make note of the iSCSI connections, you’ll need them later.
Reboot. This will remove the iSCSI and make it easier to setup the iSCSI connections permanently.
Automate iSCSI
Automatically start the iSCSI requires the following two commands and a modification to a config file.
iscsiadm --mode node -T iqn.2007-11.org.freenas.ctl:pbsbks -p 10.10.10.10 -o update -n node.startup -v automatic iscsiadm --mode node -T iqn.2007-11.org.freenas.ctl:pbsbks -p 10.10.10.10 -o update -n node.conn[0].startup -v automatic sed -i '/^node.startup = /s/manual/automatic/g' /etc/iscsi/iscsid.conf
Automate ZFS
Determine the disk
systemctl list-units --all --full | grep disk | grep 10.10.10.10 | egrep -v "*part*
Create a ZFS service
Use the disk information you determined above.
cat << 'EOF' > /etc/systemd/system/pbsbks-pool.service [Unit] After=dev-disk-by\x2dpath-ip\x2d10.10.10.10:3260\x2discsi\x2diqn.2007\x2d11.org.freenas.ctl:nas\x2dea\x2d04\x2db7:pbsbks\x2dlun\x2d0.device [Service] ExecStart=/usr/sbin/zpool import backups ExecStartPost=/usr/bin/logger "started ZFS pool backups" [Install] WantedBy=dev-disk-by\x2dpath-ip\x2d10.10.10.10:3260\x2discsi\x2diqn.2007\x2d11.org.freenas.ctl:nas\x2dea\x2d04\x2db7:pbsbks\x2dlun\x2d0.device EOF
Start the service
systemctl daemon-reload systemctl enable pbsbks-pool systemctl restart pbsbks-pool
The next time you reboot your system, the iSCSI will connect and the ZFS pool with be imported and the datastore you create will automatically remain without error.
Bonus
I don’t see anywhere to delete a datastore in the GUI, but can be done via CUI. Where in this case datastore is the name of the datastore.
proxmox-backup-manager datastore remove datastore
Conclusions
This is a rough layout, but should be enough to get your project further along.
Source(s)
- https://linuxhint.com/install_zfs_ubuntu_1804/
- https://www.cyberciti.biz/faq/freebsd-linux-unix-zfs-automatic-mount-points-command/
- https://pbs.proxmox.com/docs/storage.html
- https://forum.proxmox.com/threads/how-to-remove-datastore-directory.78958/
- http://unicolet.blogspot.com/2015/12/how-to-automatically-import-zfs-pool.html
- https://www.unixmen.com/attach-iscsi-target-disks-linux-servers/
- https://library.netapp.com/ecmdocs/ECMP1654943/html/GUID-8EC685B4-8CB6-40D8-A8D5-031A3899BCDC.html