Ti133700N Posted December 2, 2016 Share Posted December 2, 2016 I know (I think ?) snapshots aren't actually supported in the current UnRaid version however I'm thinking you guys might still be able to help. Basically I was using the virsh snapshot feature using the commandline, on qcow disks: virsh snapshot-create-as --domain MyVM --name "FirstSnapshot" --description "My first snapshot" And everything seemed to work fine. I could virsh snapshot-list --domain MyVM to get the snapshot list, and I could virsh snapshot-revert to get back to a point. However, when I reboot the UnRaid server all my snapshots are gone ! Is there a way to keep my snapshots ? Is there a way to get them back ? Where are they supposed to be saved ? What method do you use to take snapshots ? I was thinking I could rdiff-backup to only save a diff of the VMs, but that's just a bit more involved than using virsh snaphots. Thanks ! Quote Link to comment
kode54 Posted December 2, 2016 Share Posted December 2, 2016 Full libvirt snapshots are created under /var/lib/libvirt/images, which is in RAM, and lost on reboot. The only snapshots you'll be able to keep between reboots, for now, is qcow2 snapshots taken while they are unmounted. You'll have to manage those with qemu-img: qemu-img snapshot -c "new snapshot" <path to.img> qemu-img snapshot -l <path to.img> qemu-img snapshot -a "apply this snapshot" <path to.img> qemu-img snapshot -d "delete this snapshot" <path to.img> So, create, list, apply, delete, all except for list take a snapshot name after their respective switches. I assume you'll want to do this with an unmounted image, or an image for a VM that's suspended to disk. Quote Link to comment
BobPhoenix Posted December 2, 2016 Share Posted December 2, 2016 Full libvirt snapshots are created under /var/lib/libvirt/images, which is in RAM, and lost on reboot. The only snapshots you'll be able to keep between reboots, for now, is qcow2 snapshots taken while they are unmounted. You'll have to manage those with qemu-img: qemu-img snapshot -c "new snapshot" <path to.img> qemu-img snapshot -l <path to.img> qemu-img snapshot -a "apply this snapshot" <path to.img> qemu-img snapshot -d "delete this snapshot" <path to.img> So, create, list, apply, delete, all except for list take a snapshot name after their respective switches. I assume you'll want to do this with an unmounted image, or an image for a VM that's suspended to disk. Couldn't you symlink the /var/lib/libvirt/images folder to somewhere on the system (cache or array drive) and then just put the symlink command in the go file so it is done at every boot? Quote Link to comment
Ti133700N Posted December 3, 2016 Author Share Posted December 3, 2016 Wow ! So I ran this command to list the snapshots for a particular domain: qemu-img snapshot -l /mnt/user/domains/Creative/vdisk1.img and to my surprise, all the previous snapshots I took using `virsh snapshot-create-as` were listed ! So even if I couldn't list them using `virsh snapshot-list --domain Creative` after the server is rebooted, they were still listed using qemu-img. So as you might have guessed, my next experiment was to try to revert to one of those. So I used: qemu-img snapshot -a "AdobeInstalled" /mnt/user/domains/Creative/vdisk1.img and it worked ! Yes, somehow the actual snapshots were still saved within the .img and I could revert back to a past snapshot. But this doesn't stop there, you can even go back and forth to any snapshots (not just back) ! I did some testing (not extensive testing mind you), and so far the best method I came up with is this: [*]Stop the VM [*]Create a snapshot using the command `virsh snapshot-create-as --domain Creative --name "AdobeInstalled" --description "Installed Adobe Creative Suite"` [*]List snapshots using `qemu-img snapshot -l /mnt/user/domains/Creative/vdisk1.img` [*]Go to any snapshot using `qemu-img snapshot -a "AdobeInstalled" /mnt/user/domains/Creative/vdisk1.img` Not sure why this is not integrated in the UnRaid UI yet, as this would bring the value up by 500%. I'll continue experimenting with this, but so far this is perfect as the images are retained between reboots and it adds a lot of flexibility to the system. Thanks ! Quote Link to comment
kode54 Posted December 5, 2016 Share Posted December 5, 2016 Note that only works for snapshots taken while the VM is powered off. Live snapshots will require the memory and system state data from the /var/lib/libvirt/images directory. Of course, if you're using passthrough of anything but USB devices, you're already prevented from taking live snapshots. Quote Link to comment
Recommended Posts
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.