ZVOL snapshots as VBox raw devices?

Status
Not open for further replies.

kleinem

Dabbler
Joined
Jul 29, 2014
Messages
10
Hello everyone,

i'm planning on running one, possibly more, Windows 2012R2 Servers as a VBox Machine.
I performed a clean install of W2012R2, applied the latest security patches, sysprep'd and shut it down.
Now i have a perfectly fine template to use. In order to save disk space for multiple machines, obviously snapshots come into mind.

You probably already guessed where this is going... My plan was to create a ZVOL - not VBox snapshots for each Server instance. Similar to VMware where you can build trees of snapshots and decide from which to start.

It just wont work though. My assumption is that ZFS COW mechanism does not store its deltas in the snapshot file, but keeps writing to the original file, and saves the block before new data is written...
Can anyone confirm this?

I can't test it right now, but would it work if i keep the zvol template as it is, and create a snapshot from it on the VBox Layer for each Machine instance?

regards,
kleinem

P.S: I just realized that this is a kinda rough introduction - i will write a proper one when i get home :)
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
ZFS' COW mechanism isn't related to the snapshot feature. Don't confuse the two.

COW ensure that *a* good copy of the data always exists.

Snapshots link to the blocks that existed at the moment the snapshot was made.

VirtualBox may support using a single template for multiple machines is fine (I haven't tried to use that feature of virtualbox). I've never used it. But that has nothing to do with ZFS' ability to do snapshots. In fact, with regards to the template files themselves I don't see what snapshots would bring to the table since the template needs to be static for all of the applicable VMs. So snapshotting the template later won't "gain" you anything.

I think you've crossed wires somewhere and need to sit down and think this out. Or I'm confused and don't understand what you are trying to do.
 

kleinem

Dabbler
Joined
Jul 29, 2014
Messages
10
After some fiddling around, i think i found the naswer myself :)
Code:
# zfs snapshot tank/jails/vbox/W2012R2-template@nd-vm-1_disk0
# zfs clone tank/jails/vbox/W2012R2-template@nd-vm-1_disk0 tank/jails/vbox/tank/jails/vbox/nd-vm-1_disk0

# zfs list
NAME  USED  AVAIL  REFER  MOUNTPOINT
tank/jails/vbox  47.0G  7.07T  825M  /mnt/tank/jails/vbox
tank/jails/vbox/W2012R2-template  36.6G  7.09T  16.0G  -
tank/jails/vbox/nd-vm-1_disk0  10.7K  7.07T  16.0G  -

# ls -la /dev/zvol/tank/jails/vbox/*
crw-r-----  1 root  operator  0x67 Jul 29 19:25 /dev/zvol/tank/jails/vbox/W2012R2-template
crw-r-----  1 root  operator  0xb8 Jul 29 19:41 /dev/zvol/tank/jails/vbox/W2012R2-template@nd-vm-1_disk0
crw-r-----  1 root  operator  0xb9 Jul 29 19:41 /dev/zvol/tank/jails/vbox/nd-vm-1_disk0
 
Last edited:

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Ah, I see what you are trying to do. This isn't recommended because there's no guarantee at the moment of the snapshot that the VM is quiescent. If it's not and you do need to rollback the snapshot you may find that the VM won't function. The only way to really deal with this potential problem is to shutdown the VMs, take the snapshot, then startup the VMs.

Many people do it anyway, some test it and then argue that since the test was fine that it'll work in production. But the reality is that the viability of your VM will depend on exactly what was going on in the VM at the moment that the snapshot was taken. If your timing is bad it could cause an undesirable result. ;)
 

kleinem

Dabbler
Joined
Jul 29, 2014
Messages
10
Hm, now i'm unsure what you mean. I did of course shutdown the template vm right after sysprep - and then took the snapshot of the template...
 
Status
Not open for further replies.
Top