VMware Cloud Community
fahrer
Contributor
Contributor

esx / esxi backup script (beta)

Hi everyone,

i wrote a little script for esx / esxi backups. it runs on linux (can be a vm) and uses rcli and putty. it features:

*Creating backups of esx / esxi guests to smb / nfs shares and local disks through scp or to a vmfs with vmkfstools

*supports hot and cold backups

*email warnings

*exlcluding disks

What you need:

*Linux System (can be a virtual machine)

*RCLI

*nfs-client

*smbfs

*putty-tools

Limitations:

*No config validation yet

*Passwords are printed and mailed in clear text when running in debug mode!

*Passwords are passed over the commandline (Definitly NOT secure!!!)

*No automatic restores

How To install (Ubuntu):

aptitude install nfs-client smbfs putty-tools
perl -MCPAN -e shell
install Crypt::SSLeay MIME::Lite
quit

How to run:

./esxbk.pl -c /path/to/config

How to add guests:

/usr/bin/vmware-cmd -H ESXHOST -U root -P PASSWORD "/vmfs/volumes/491ea291-76d589c6-7b43-001a4be672fc/avgw01/avgw01.vmx" setguestinfo esxbk.job.0 JOBNAME

where jobname stands for the jobname that you specified in the config

you can specify different jobs for a guests by incrementing the number

Exclude disks

/usr/bin/vmware-cmd -H ESXHOST -U root -P PASSWORD "/vmfs/volumes/491ea291-76d589c6-7b43-001a4be672fc/myvm/myvm.vmx" setguestinfo esxbk.exclude.scsi0:0 true

Substitude scsi0:0 with the scsi id of the disk you want to exlcude

Forcing a backupmode for a guest:

/usr/bin/vmware-cmd -H ESXHOST -U root -P PASSWORD "/vmfs/volumes/491ea291-76d589c6-7b43-001a4be672fc/myvm/myvm.vmx" setguestinfo esxbk.mode BACKUPMODE 

Where BACKUPMODE can be hot, cold or suspended

Reply
0 Kudos
1 Reply
fahrer
Contributor
Contributor

anyone tested it yet?

Reply
0 Kudos