How-To create a backup of a bhyve VM?

Status
Not open for further replies.

wil

Cadet
Joined
Dec 30, 2017
Messages
8
Hi,

So I have a bhyve VM up and running and it works great.
The VM is setup using a zvol as is described in the documentation.

Now I would like to create a backup of that VM and am contemplating on what the best way is to do that.

Caveat Emptor: I do not have another freeNAS box here that I can sync with.

Preferably I would just like to be able to create some sort of copy that I can zip up.

Also important.. how would someone restore that backup onto freeNAS?

I looked in the doc and didn't see it nor did I see this mentioned in a topic here, but I just might have overlooked, so my apologies if this already has been discussed.

Ideas welcome.

thanks!
 

kdragon75

Wizard
Joined
Aug 7, 2016
Messages
2,457
First of all, setup snapshots. Once you have a snapshot you can zfs send it to an archive file of your liking. Take a look at ZFS: Send and Receive from itfromallangles.com. Once you have you tar/zip file, you can do whatever you want with it. One thing to note about snapshots of bhyve VMs is that the FreeNAS snapshot scheduler built into FreeNAS (as far as I know) will take an instant snapshot of your VMs storage even if it running and in the middle of writing. to get a clean backup, the VM needs to be powered off first. At present there does not seem to be a way to take a snapshot of a bhyves running state, just the underlying storage.
 

wil

Cadet
Joined
Dec 30, 2017
Messages
8
Interesting, I was under the assumption that zfs send/receive was only for use between two FreeNAS boxes (or well only for use between zfs installs). Clearly I was wrong, and it looks like that this would work, thanks for the tip.

Other feedback is ofcourse still welcome.
 

ukos

Dabbler
Joined
Jul 22, 2018
Messages
12
One thing to note about snapshots of bhyve VMs is that the FreeNAS snapshot scheduler built into FreeNAS (as far as I know) will take an instant snapshot of your VMs storage even if it running and in the middle of writing. to get a clean backup, the VM needs to be powered off first.

Savely powering off the vm before doing a zfs snapshot (and powering them on again afterwards) would be a killer feature for freenas!
 

kdragon75

Wizard
Joined
Aug 7, 2016
Messages
2,457
Savely powering off the vm before doing a zfs snapshot (and powering them on again afterwards) would be a killer feature for freenas!
This could be done with a cron task in the GUI. I don't expect anything like this to be built into FreeNAS anytime soon as there is no reliable way to know what's going on in the VM in order to coordinate shutdown, snapshot, and reboot. Most of that kind of functionality comes from extra guest drivers i.e. VMware Tools and Virtualbox Guest Additions. bhyve is just not to that point and likely won't be for some time. In the meantime, almost any guest level backup software like Veeam Endpoint would work fine as they work inside the guest OS and can use things like cache flushing and CBT as well as application specific options for things like SQL etc.
 

kdragon75

Wizard
Joined
Aug 7, 2016
Messages
2,457
I looks like he's using SSH to connect and shutdown the machine. This would be the ideal way of doing it as the script could be used to gracefully stop any running services. For example, if your running a minecraft server, you may want to warn users, save/backup the world, and then stop the server before shutting down. Obviously this would not work with Windows VMs. This is where the ACPI shutdown is more universal and is what VMware uses when you shutdown a guest VM without VMware Tools.
 
Status
Not open for further replies.
Top