Thanks for taking the time to write this mittell. I'll definitely give it a whirl and throw you some feedback.
Sorry about not testing much, I've been traveling. Look for an email later week And so far it works well !
Great Utility, used it... Love it..
Thanks again Alex..
Like Kix, sorry I haven't had a chance to use this yet.
Fingers crossed some lab time is round the corner.
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.
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:
Find the PID for vi-backup.
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.
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!
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.
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!
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!
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.
this script works nicely.. thanks
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.
\[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:
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