Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simple way to backup virtual machine disks on ZFS

Featured Replies

Hello!

 

I'm using Unraid 6.12.10 and recently started using ZFS on one of the pools. I'm now facing a small issue with backing up virtual machines stored in the ZFS pool: I haven't found a simple way of making a "consistent" backup of the virtual machine disks.

 

To elaborate, when using XFS I had a scheduled User script like this:

echo "Backing up machine XXX"
cp --reflink=always "/mnt/disk1/domains/XXX/vdisk1.img" "/mnt/disk1/domains/XXX/vdisk1-SNAPSHOT.img"
cp "/mnt/disk1/domains/XXX/vdisk1-SNAPSHOT.img" /mnt/backuppool/virtualmachines
rm "/mnt/disk1/domains/XXX/vdisk1-SNAPSHOT.img"

It makes a consistent snapshot of the disk image and copies it into another pool, so no matter how hard I screw up the original pool, the backup can be found from the other pool.

 

With ZFS the "--reflink=always" does not work, and I'm afraid that without using it, the copies might become corrupted. I've watched the ZFS videos by Spaceinvader One, where the backup script plays the Imperial march tune and all kinds of cool features, but that seems overly complicated for my use case. I want to KISS. 

 

Any tips on what kind of script should I use with ZFS?

If you have a backup pool also using zfs you can snapshot them and incrementally send/receive to that volume.

? run the plugin to backup the vm> appdat backup

image.png.5ac98f4f387949852baf5504d9d33b09.png

and/or:

full disk data backups:
image.png.f2a01d66010a010af7ca2a027c924763.png

Edited by bmartino1

14 hours ago, Iivo said:

Do you think these commands would work on Unraid

Yes, Unraid uses standard zfs.

  • Author

Thanks for the suggestions! I'll start experimenting and will get back with the results. The VM Backup plugin is not as "production grade" as I would like it to be (it's in beta and the only developer is quite busy). Due to the plugin status I actually made a feature request for Lime back in 2022 to help make it stable or include similar features in Unraid, and the response was "That's a very requested feature and one we plan on adding in the future, but no ETA for now"

6.13 will support VM snapshots, and you can take native zfs snapshots if they are stored on zfs, will still need to run a script to send/receive to a different device/server.

  • 7 months later...
  • Author

Finally I had the time to finish the backup configuration during the Xmas vacations.

 

I installed the QEMU guest agent to all VMs I could to enable the snapshot feature in the VM Backup plugin - the snapshot feature is a must.

I moved any problematic VMs back to the Array (XFS) and I'll use the old User script backup script for these. For example pfSense has the QEMU guest agent installed and the network interface listing is visible in Unraid, but when the backup starts, an error occurs:
"failure: snapshot command failed on pfsense-vdisk2.snap for pfSenseXXX."
"failure: snapshot_fallback is 0. skipping backup for pfSenseXX to prevent data loss. no cleanup will be performed for this vm.".
I checked that the virtual disk paths are not using /mnt/user, but didn't investigate much further. Edit: under the "Number of backups to keep" tooltip it mentions that if multiple vdisks are present, they need to be sequentially numbered - there is only one vdisk in this VM, but it ends with 2, could maybe be an issue...

 

This solution is good enough for now, let's see if something changes with Unraid 7. Have a happy new year!

Edited by Iivo

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.