VMware Cloud Community
admin
Immortal
Immortal

Announcement: New (free) backup utility realease.

Hello all,

I've written a backup utility, it's currently still in 'beta' but I think I've worked out most of the bugs and it's been working very well for me, so I thought I'd share my work with the community. Smiley Happy

I'll be trying to update it fairly regularly, hot-clone of a VM or specific VMDK attached to a VM planned for next version.

Please see the readme file here for some initial instructions: http://users.ox.ac.uk/~alexm/README

You can download the utility here:

http://xtravirt.com/index.php?option=com_remository&Itemid=75&func=select&id=5

Once you've extracted the archive, please read the README file in the directory created for instructions on using the utility.

Any problems post them to this thread and I'll try and resolve them, I'll set up a proper website when I have the time.

Alex

p.s. Big thanks to acr for help with testing!

Added link to the latest release - 21st May 2007[/b]

Message was edited by:

MR-T: Updated with link to Xtravirt site

0 Kudos
367 Replies
letoatrads
Expert
Expert

Thanks for taking the time to write this mittell. I'll definitely give it a whirl and throw you some feedback.

0 Kudos
kix1979
Immortal
Immortal

Sorry about not testing much, I've been traveling. Look for an email later week Smiley Happy And so far it works well !

Thomas H. Bryant III
0 Kudos
acr
Champion
Champion

Great Utility, used it... Love it..

Thanks again Alex.. Smiley Happy

0 Kudos
MR-T
Immortal
Immortal

Like Kix, sorry I haven't had a chance to use this yet.

Fingers crossed some lab time is round the corner.

Cheers

0 Kudos
samkshah
Contributor
Contributor

Works like a charm...I backed up about 8 VMs using the script without any issues. Noticed that if we had an option to terminate scheduled backup process, it would have been great for me. I actually started process (scheduled) and then realized that I needed to terminate process. However, the script works great.

Thanks,

samkshah

0 Kudos
admin
Immortal
Immortal

Hmm that's an interesting point, perhaps the script should just check if there is already an instance running already, and if there is, refuse to run?

I'm slightly nervous about automatically terminating processes from a menu option, although I could put it in fairly easily.

If you need to terminate a backup job early for any reason you can do so as follows:

ps aux | grep vi-backup[/code]

Find the PID for vi-backup.

kill [/code]

That should terminate any existing backup, note that if a disk is currently being exported it will be completed but no further exports will be made, you will also need to remove 'Scripted Backup Snapshots' from any VMs that had a backup terminated half way though using the vi-client.

Version 0.8.5 will be out in the next week, with a menu option to hot clone VMs, and a few bug fixes related to DRS migrations and logging, and lock files so two instances of the script don't attempt to backup a VM simultaneously. I'll try and work something into it related to existing processes too.

Thanks for the suggestion, glad you found the script useful. Smiley Happy

0 Kudos
HanzdeVries
Contributor
Contributor

Thanks for the great script, good job!

Can you explain to me why backups of VM's can't be run without committing or flushing the existing snapshots? We use (manual) snapshots on quite a lot of servers and would like to preserve them. VCBMounter doesn't complain about the snapshots, that's why I don't understand why the script does. Thanks in advance!

0 Kudos
admin
Immortal
Immortal

It doesn't use vcbMounter to do the exports, couple of reasons I chose not to use it - firstly I found it to be unreliable at removing snapshots - so I decided to deal with them myself and use vmkfstools to export the disks. Secondly this way you also end up with instantly usable exported VMDKs, you don't need to use vcbRestore and the catalog file to restore the VMs - this opens other options like the ability to clone VM/specific VMDKs etc.

So, the reason snapshotted VMs are excluded is that I'd have to write a load of logic into the script to find existing snapshot files/.vmsd and export them as well as the base VMDK, and this would also complicate the automatic restore of VMs massivley as I'd have to make sure I re-imported the deltas properly and that the correct delta was in use.

I may have a crack at dealing with VMs with existing snapshots at some point but it's not a small a task.

Hope it's useful to you anyway. Smiley Happy

0 Kudos
HanzdeVries
Contributor
Contributor

Thank you for the explanation, that clears things up. For a short time I tried your previous script (I think it was called something like smb_backup.sh) and that used vcbMounter, so I assumed the new script also did.

The script is very useful for me, I just have to try and find a way to tackle the 'snapshot-enabled' servers. Thanks again!

0 Kudos
ISD_Plc
Enthusiast
Enthusiast

Hi All,

Im going to look at this but wanted to ask a few questions!

our san is a netapp 3050c and a 3020 for DR

now i want to be able to backup the vm's to a volume then replicate that vol to the dr san that I can then use as a datastore in the event of a disaster?

So will this util create copies of the vm's or will it create backup files that can only be 'restored' also does it quiesce any file/cache activity first?

er think that will do for know!

0 Kudos
admin
Immortal
Immortal

Yep that should work. The util creates copies of VMs that can be used immediately (if on VMFS), no 'restore' neccesary. It creates a snapshot of the VM, thus quiescing the VMs VMDK files, and exports them with vmkfstools.

0 Kudos
renski
Contributor
Contributor

this script works nicely.. thanks

0 Kudos
renski
Contributor
Contributor

Hi,

When I try to use this script with the smb option, it fails.

I can't seem to chmod or chown anything on a smbmount from my samba server... I can create and delete files but not change the permissions on them.

Stephen

0 Kudos
renski
Contributor
Contributor

\[root@dali vi-backup]# vi-backup.pl -c vi-backup.cfg

*****Virtual Infrastructure Scripted Backup Utility v0.8.4 by Alex Mittell*****

We're running VMware ESX Server 3.0.1 build-32039

\----


Searching for target VMs....

Locating VM files....

Processing config files....

Target VMs from specified searchspec:

logbook

Snapshotting VM logbook....

Snapshot of logbook successful.

Exporting disks for logbook....

Exporting disk UBUNTU - Logbook Server.vmdk....

Destination disk format: VMFS thick

Cloning disk '/vmfs/volumes/440500b0-6cb6fa4d-412a-0017a4a74e4e/UBUNTU - Logbook Server/UBUNTU - Logbook Server.vmdk'...

Failed to clone disk : File system isn't VMFS. (35)

WARNING: There were one or more errors during the disk export. Please look at the VM log file.

Removing Snapshot for logbook....

Snapshot removed successfully from logbook.

Exporting VM config and log file...

Config and log file exported successfully.

chmod: changing permissions of `/vmfs/volumes/storage1/ESXBackup2/logbook/logbook.restore' (requested: 0700, actual: 0755): Operation not permitted

0 Kudos
admin
Immortal
Immortal

Hi, could you PM me your config file (minus passwords/real FQDNs of course). Looks like your export path has been detected as VMFS rather than SMB so the -d 2gbsparse switch has not been parsed to vmkfstools.

What is your export path?

0 Kudos
renski
Contributor
Contributor

exportpath=/vmfs/volumes/storage1/ESXBackup2/

Also after the vi-backup fails, I notice this smb is mounted now:

//10.2.32.10/esx 276G 76G 200G 28% /vmfs/volumes/440500b0-6cb6fa4d-412a-0017a4a74e4e/ESXBackup2

0 Kudos
renski
Contributor
Contributor

If i run the script without the smb option using that same export path, it works fine... but as soon as I use the smb it fails.

0 Kudos
renski
Contributor
Contributor

\[root@dali vi-backup]# cat vi-backup.cfg

\## Config file created by vi-backup.pl ##

hostname=dali.xxx.edu

username=root

password=xxx

searchspec=name:logbook

exportpath=/vmfs/volumes/storage1/ESXBackup2/

safemode=1

mailreport=1

mailserver=123.123.123.123

mailfrom=esx@xxx.edu

mailto=logs@xxx.com.au

smb=1

smbshare=//10.2.32.10/esx

smbuser=vmesx

smbpass=xxxx

Message was edited by:

renski

0 Kudos
admin
Immortal
Immortal

Right the problem is your export path - you should only mount VMFS volumes under /vmfs.

Create a directory called /mnt/backup to mount your SMB share on.

mkdir /mnt/backup[/code]

Then change your export path to /mnt/backup and it should work fine.

If you want to backup to a VMFS export path, leave the smb option off.

0 Kudos