LXD ZFS pool backup

In order to take backup of full LXD server node I am trying to backup the storage pool named local created on the lxd node in a cluster.

But there is no easy way I can find on how to backup the whole zfs pool using borgbackup or rsync.

Did anyone try full backup of LXD node storage pool (in my case it’s zfs pool name local)?

As local is not mounted its hard to took the full backup with rsync and borgbackup.

So far only able to take backup of containers and images using zfs snapshot with customized scripts of borgsnap, but couldn’t find an easy solution to take the backup of full zfs pool.

Also found that ZFS do not support restore from old snapshots, it can only use latest snapshot, while BTRFS can, so not sure if I made a mistake by going with ZFS given it will not be supported directly by Linux Kernel like BTRFS.

Feature Directory Btrfs LVM ZFS CEPH
Optimized image storage no yes yes yes yes
Optimized instance creation no yes yes yes yes
Optimized snapshot creation no yes yes yes yes
Optimized image transfer no yes no yes yes
Optimized instance transfer no yes no yes yes
Copy on write no yes yes yes yes
Block based no no yes no yes
Instant cloning no yes yes yes yes
Storage driver usable inside a container yes yes no no no
Restore from older snapshots (not latest) yes yes yes no yes
Storage quotas yes(*) yes yes yes no

On the upside, ZFS has functional quotas, so if you need proper quota enforcement, it’s the way to go.

Yes thats true but with BTRFS being default in Suse and Fedora will see improvements in qgroups.

Also I could setup backup of BTRFS pool easily compared to ZFS pool so far (cannot find any easy solution on how can I take a full zpool backup not individual dataset i.e. volumes).

Recently I had one drive failure in LXD cluster node running on BTRFS. I could easily recover the cluster by breaking the BTRFS RAID.

The only issue I found in both BTRFS and ZFS so far is that both cannot mark badblocks on drive like ext4 or XFS to avoid them. Indeed BTRFS went into read only mount as soon as encountered badblocks in any of the drive within RAID 1.

Hopefully with XFS Copy-on-Write landing in linux kernel LXD will support it as well.

You could also use LVM thinpool with Ext4, as that allows you to restore old snapshots and the quota is enforced by the volume size.

Indeed, the main restriction with LVM is the lack of native transport for volumes and snapshots, so no optimized backups and no optimized migration to other systems.

1 Like