VMware Cloud Community
devzero
Expert
Expert

snapshot based backup/mirror strategy

Hello,

i´d like to get some feedback/comment about this thoughts:

if you want to live mirror your virtual infrastructure, you need to do the mirroring at san/storage-level or use a host-based replication solution like esxreplicator.

for most VMs i use i can live with loosing several hours of data, as these are mostly tateless systems like mail-gateway, printservers, admin-stations etc.

what about the following strategy then ?

1.

on source system, create temporary snapshot with "vcbSnapshot VMid Snapname"

2.

rsync -av /path/VMName root@destinationesx:/path/backupdir

3.

As rsync will skip the current delta vmdk and the vswp file, as it cannot be accessed while being in use, these files are missing on the destination system.

this has the result, that VMware does not recognize that the VM has a snapshot, when registering that VM on the destination system. furthermore,the vm will not boot, as this files are needed for booting. i can trick vmware into thinking the snapshot is in place by just creating some empty files with the appropriate names on the destination.

4.

then remove the Snapshot on the soruce VM again.

5.

Now, if you loose your VM on the primary system, you have a crash-consistent copy on the other system. register that VM, don`t yet start it up and go back to the snapshot 'Snapname', i.e. use snapshot manager for that. Vmware seems it will just drop the vswp and the delta vmdk, ignoring it`s contents. (i.e. it doesn`t matter if the files have valid content or not)

yes, i could use vcbSnapAll instead, but that can only transfer directly to a local directory and so won`t let me use rsync or other tools for a network transfer, so i would either need temporary place for storage on the source system before transferring to the other system (which would result in twice the I/O) or i would need to do this via NFS or whatever.

what do you experts think ?

is that a valid/feasible approach ?

if someone has a better, cost neutral strategy for some snapshot based "mirroring", please let me know.

roland

Reply
0 Kudos
7 Replies
Texiwill
Leadership
Leadership

Hello,

Yes it will work, but I would look into the following free tools: VISBU from XtraVirt, vmbk.pl, and the free version of esXpress.


Best regards,
Edward L. Haletky
VMware Communities User Moderator
====
Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.
Blue Gears and SearchVMware Pro Blogs -- Top Virtualization Security Links -- Virtualization Security Round Table Podcast

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
Reply
0 Kudos
devzero
Expert
Expert

thanks, i will have a look.

anyway, vcbSnapshot is a pain and just sucks - whis is this command so much more complicated to add/remove snapshots than on workstation?

how do i list all snapshots of a Vm on the commandline ?

Did somebody write a wrapper script for this to make handling of snapshots more comfortable ?

Reply
0 Kudos
Texiwill
Leadership
Leadership

Hello,

I actually just use vcbMounter to do everything and have it copy to either a locally mounted CIFS share or send everything over SSH. Or use a proxy server.

That way I do not need to worry about snapshots directly.


Best regards,
Edward L. Haletky
VMware Communities User Moderator
====
Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.
Blue Gears and SearchVMware Pro Blogs -- Top Virtualization Security Links -- Virtualization Security Round Table Podcast

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
Reply
0 Kudos
Hiney
Enthusiast
Enthusiast

you could try copying and editing the vcbSnapAll script to add the rsync lines to success clause in the function 'backup_vms'. When run with something like -r /backup will snap(backup) each vmto /backup and rsync it to the backup server and then delete /bakcup/* and move on to the next. this means that /backup can have limited space (eg 20G or 30G - enough for the largest vm). obviously use your own directory

I've attached one i did a few years ago (so it's an older vcbSnapAll - might need to translocate the changes into a newer version)

to /etc/vmware/backuptools.conf, i've appended

VCHOST=localhost

USERNAME=root

PASSWORD=abc1234

RSYNC_PORT=10900

RSYNC_SERVER=backup01::BACKUP

#add any excluded hosts here

EXCLUDEHOSTS=

also requires a rsync server setup on the backup server on the port specified.

I'm about to rewrite it with rsync/ssh using keys and not using root on the backup server.

eg: usage:

root/bin/vcbSnapAll_rsync -r /backup -a Powerstate:on >/var/log/vmware/vcbSnapAll_rsync.log 2>&1

Hope the idea helps

P

"I have an inferiority complex, it's just not a very good one."
Reply
0 Kudos
devzero
Expert
Expert

hey, great idea - thanks !

Reply
0 Kudos
devzero
Expert
Expert

>I actually just use vcbMounter to do everything and have it copy to either a locally mounted CIFS share or send everything over SSH.

i have spent some time now with the vcbstuff and i think it sucks, at least regarding "pseudo replication".

the problem is, that you always have 2 additional copy steps when transferring a VM from host A to host B, since vcbMounter/vcbSnapAll/vcbRestore is sorta export/import tool

if you shuffle hundreds of gigabytes of data you need a lot of temp space and....time.

even worse: vcbMounter -r scp:// syntax appears pretty nice on the first view, but on the second view, it sucks big, too , as it also creates a local copy of all vmdk`s in /tmp (which is even worse as there is only few space available in the root partition and the resulting error message tells everything but "out of space errror")

so, i`m still not satisfied with "available" solutions and still trust in my first idea, but the problem is that if think it`s sorta "hackerish".

i dislike faking vmware snapshot manager into thinking correct files are in place when they aren`t.

to continue the discussion about my initial idea, i`m really unsure if i should expect some more intelligence from the snapshot manager.

why does it tell there is no snapshot if there is one and all i need to make it happy is adding 2 missing files? (as we always can do a REVERT TO SNAPSHOT as we have all we need to do that)

ok, you would never be able to successfulle REMOVE the snapshot, as you have no data to merge into the base vmdk, but REVERT should always work.

would it be worth opening a SR or RFE for this ?

Reply
0 Kudos
devzero
Expert
Expert

nobody using a similar backup/replication strategy ?

i`d be interested in exchanging some real-world experience.

i`m quite sure, vizioncore vReplicator internally works with a similar strategy (please explain how it works if i`m wrong and you know better)

Reply
0 Kudos