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.

KVM backup script using snapshots/blockcommit

Featured Replies

I've been looking for a KVM backup script leveraging libvirt's snapshot and blockcommit features. The advantage of this method is that there is no downtime when taking backups, and they should also be application consistent. I've adapted the script found here (https://gist.github.com/cabal95/e36c06e716d3328b512b) for use with unRAID, to add additional functionality, and to fix some bugs.

 

The script will either back up specified VMs, or all using the '--all' parameter. VMs with spaces in their names are supported, and if specifying the VMs as a parameter, use double quotes around the VM name. VMs have to be running in order to take a snapshot, so the script will power up any VMs that are turned off, and will then attempt a clean shutdown once the snapshot has been committed and disks copied. There are global variables that you can modify in the script to specify how long to wait for a VM to start before aborting the backup process, and how long to wait for a VM to cleanly shut down before powering it off. CD-ROM images and floppy drive images (I mean...if you have any...?) are automatically excluded from the backup.

 

The script will utilize unRAID's built in notification system - which you can figure to send emails with a detailed summary that looks like this:

 



Event: unRAID Status
Subject: KVM Backup completed with warnings
Description: KVM Backup completed with warnings at 06/16/2017 03:31:33
Importance: warning

Total backup size: 845GB
Total backup duration:  00:31:32


Test-VM backup size: 171GB
Test-VM backup duration: 00:04:38

Test-VM2 backup size: 606GB
Test-VM2 backup duration: 00:21:55

Windows Server 2012 backup size: 29GB
Windows Server 2012 backup duration: 00:01:28

Windows Server 2016 Template backup size: 41GB
Windows Server 2016 Template backup duration: 00:03:31


06/16/2017 03:00:01 Beginning backup for Test-VM
06/16/2017 03:04:39 Test-VM backup size: 171GB
06/16/2017 03:04:39 Test-VM backup duration: 00:04:38
06/16/2017 03:04:39 Finished backup of Test-VM
06/16/2017 03:04:39 Starting Test-VM2 to begin backup process
06/16/2017 03:05:16 Waiting for Test-VM2 to start
06/16/2017 03:05:16 Beginning backup for Test-VM2
06/16/2017 03:26:23 Waiting for Test-VM2 to shut down.
06/16/2017 03:26:34 Shut down of Test-VM2 completed
06/16/2017 03:26:34 Test-VM2 backup size: 606GB
06/16/2017 03:26:34 Test-VM2 backup duration: 00:21:55
06/16/2017 03:26:34 Finished backup of Test-VM2
06/16/2017 03:26:34 Starting Windows Server 2012 to begin backup process
06/16/2017 03:26:34 Waiting for Windows Server 2012 to start
06/16/2017 03:26:34 Beginning backup for Windows Server 2012
06/16/2017 03:27:52 Waiting for Windows Server 2012 to shut down.
06/16/2017 03:28:02 Shut down of Windows Server 2012 completed
06/16/2017 03:28:02 Windows Server 2012 backup size: 29GB
06/16/2017 03:28:02 Windows Server 2012 backup duration: 00:01:28
06/16/2017 03:28:02 Finished backup of Windows Server 2012
06/16/2017 03:28:02 Starting Windows Server 2016 Template to begin backup process
06/16/2017 03:28:02 Waiting for Windows Server 2016 Template to start
06/16/2017 03:28:02 Beginning backup for Windows Server 2016 Template
06/16/2017 03:29:33 Waiting for Windows Server 2016 Template to shut down............
06/16/2017 03:31:33 Warning: Windows Server 2016 Template did not shut down within 120 seconds - forcing shutdown
06/16/2017 03:31:33 Shut down of Windows Server 2016 Template completed
06/16/2017 03:31:33 Windows Server 2016 Template backup size: 41GB
06/16/2017 03:31:33 Windows Server 2016 Template backup duration: 00:03:31
06/16/2017 03:31:33 Finished backup of Windows Server 2016 Template

 

Usage:

vm-snapshot.sh <backup folder> <list of domains, comma separated, or --all to backup all domains> [max-backups (default is 7 if not specified)]

 

The script can be found on github: https://github.com/rinseaid/unraid-vm-snapshot

  • 4 weeks later...

This looks great. Are the snapshots incremental? Anybody using this? Any way to set dated backup file names or allow you to set a tag in the filename like "install" or something?

Sent from my Pixel using Tapatalk

  • Author

The snapshots are not incremental, and unfortunately I'm not sure I have the time to implement this. As far as time stamps - a folder is created within your chosen destination with the name of the VM, and within that folder are time stamped folders that contain the VM backup files. There is no way to tag the filenames. I'll admit this is pretty quick and dirty and I'm hoping some form of backup is built into unRAID in the future.

  • 2 years later...

Anyone of you care to make a functional stable plugin out of this script and this other script below?

 

1 hour ago, fluisterben said:

Anyone of you care to make a functional stable plugin out of this script and this other script below?

What happened to "ask NICELY"? 🙄

11 minutes ago, fluisterben said:

some people paid good money for Unraid.

Nobody that participated in this thread is paid to program plugins for unraid. It's all volunteer.

 

If you want to flex the "I paid for this product", please talk to [email protected] about your wishes.

18 minutes ago, fluisterben said:

Was that not nice enough? Wow. Seems to me your toes are a little too long. By the way, some people paid good money for Unraid.

My toes are indeed quite long.

Do these snapshots work when passing through a GPU? I ask because virsh save doesn't work when this is the case.

Archived

This topic is now archived and is closed to further replies.

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.