Backing up bhyve VMs

Status
Not open for further replies.

freenik

Cadet
Joined
Dec 27, 2015
Messages
2
Hi,

I have a question regarding virtual machines running on bhyve.
If using the GUI (11.0-U4) the only way to add disks to bhyve is zvol's.
Are there any ideas how to handle backups of those zvols?

I'm aware of a couple of different ways it could be done but I'm looking for more ideas.
I would like to address backups both from a spontaneous DR perspective as well as saving historical backups.

Currently I'm using hashbackup and b2 for backups.
For vmware (using zvol + iscsi) I'm mounting the iscsi datastore in a vm and backing up from there. I'm using weekly snapshots within vmware.

If possible I would like to avoid per-vm backups and instead focus on one centrally managed backup
Ideally all the snapshots + backups could be done in the same place for both vmware and bhyve vm's.

Cheers
 

Zaaphod

Contributor
Joined
Dec 15, 2015
Messages
109
I was just about to post this exact same question, except I am aware of zero ways to do this. It didn't make sense to start another thread with a duplicate question, so I'll post my details here.

My configuration is:
FreeNAS: 11.0-U4
4 4TB Hard Drives in a RAID 1 Array
2 SSDs in a RAID 1 Array storing a Zvol containing a Windows 10 Professional VM.


I would like the entire Zvol containing the Windows 10 VM to be backed up daily to the to the 4TB Array, with a rolling backup scheme of 5 days, So Every Monday it updates the Monday backup, every Tuesday it updates the Tuesday Backup... etc.. so every Monday - Friday there is a current backup with the last 5 work days also stored

I don't want to back up individual files from inside the ZVol, but the entire thing, so should both SSDs fail, I could duplicate the Zvol Backup and have my entire VM restored exactly the way it is without any re-installing of anything in a new VM, and I don't want to be hogging up all my very limited space on the SSD array with snapshots.

I have no experience with backups like this, I've been just letting the RAID 1 be the backup method.

Some Questions I have are...
Would a backup of the entire Zvol always the the same size as the Zvol, or is there a way to only backup the used portion of the Zvol?
Would I need to shut down the VM to back up the entire Zvol this way?
If the VM needs to be shut down, I could schedule a shutdown at a particular time of day, but is there a way to restart it with a script once the backup is complete?
Would it be possible to automate the process? I want this to happen in the middle of the night.
Until I figure out how to automate it is there a Manual process to just to a one time backup to the 4TB Array so at least I have one backup?

Any Advice is greatly appreciated
 
Last edited by a moderator:

sesipod

Contributor
Joined
Jan 27, 2017
Messages
162
Yeah same question here! I was just about to post on this as well :)

I would like to use 4x Samsung evo 850's in raid 0 with backups of the vms(or full Zvol) to my 9x3TB Z2 storage array.
I would love to dump ESXI 6.5 but can't until I have a solid way of backing up FreeNAS vms...
 
Last edited:

freenik

Cadet
Joined
Dec 27, 2015
Messages
2
Well there is one way and that's snapshot + zfs send to 2nd nas.. but it only fits those going the 2nd nas route.
Perhaps it's possible to do some magic on /dev/zvol/<dataset1>/<datasetN>/<zvol>? It is however a char device if it matters!?
 

Zaaphod

Contributor
Joined
Dec 15, 2015
Messages
109
I don't know much about zfs send and zfs receive but I just did a search and came up with this: http://blog.fosketts.net/2016/08/18/migrating-data-zfs-send-receive/
It looks like one could create a snapshot and save it to a file with ZFS Send, then apply the file with ZFS Receive... is there any reason it would have to be on a second nas and not just a second array:

use ZFS send to Create snapshot of /ssd_array/vm_zvol to a file
use ZFS receive to use the file to restore the snapshot to /hdd_array/vm_zvol
?
 

Pasquale61

Explorer
Joined
Oct 8, 2014
Messages
62
For what it's worth, I just tried testing this with a Ubuntu bhyve VM and it worked great! I used the send/receive example in this link: https://www.thegeekdiary.com/zfs-tutorials-creating-zfs-snapshot-and-clones/

Here are the high-level steps I did to test this:

1. Listed all my snapshots:
zfs list -t snapshot
In my case my latest snapshot that I wanted to backup was MyZpool/OriginalVMZvol@auto-20180203.1454-2w

2. I did a zfs send from the snapshot to a file named backup1 in a local dataset called mystuff:
zfs send MyZpool/OriginalVMZvol@auto-20180203.1454-2w > /mnt/MyZpool/mystuff/backup1

3. I destroyed the zvol containing the bhyve VM (OriginalVMZvol) using the FreeNAS GUI.

4. I did a zfs receive from my local backup1 file to a new zvol called NewVMZvol:
zfs receive MyZpool/NewVMZvol < /mnt/MyZpool/mystuff/backup1

5. I created a new bhyve vm with the same settings as my original and attached the new zvol, and it booted right up! I also tested manually copying the backup1 file I created above to a completely separate FreeNAS environment, and running the zfs receive command. I was able to successfully attach it to a newly created bhyve VM and boot it up. This is exactly what I was looking for. (Knowing that I could restore a VM without solely relying on my existing NAS and it's snapshots.)

The reason I want to do this is so that I can keep an offline backup that does not rely on FreeNAS/ZFS at all. I'm hoping I can script this and back this single file up to Crashplan or something, possibly once a month. It's not critical for me to have daily copies of this because my VM content is fairly static. (It's actually where I plan on running my Crashplan client from.)

I hope this helps.
 
Last edited:
Status
Not open for further replies.
Top