This tutorial will show you how to backup your ESXi VMs using a free
solution - ghettoVCB.
I'm using it on ESXi hosts that store the VMs locally.
The script is not interactive and can be setup as a cron job.
Here is the script philosophy:
- it takes snapshots of live running virtual machines
- backs up the master VMDK(s)
- upon completion, deletes the snapshot
[cc lang='bash']
# copy "https://github.com/lamw/ghettoVCB/archive/master.zip" to
"/vmfs/volumes/data/BackUp/"
\$ unzip master.zip; rm master.zip
\$ cat \<\<'EOF' > ghettoVCB-master/ghettoVCB.conf
VM_BACKUP_VOLUME=
DISK_BACKUP_FORMAT=thin
VM_BACKUP_ROTATION_COUNT=3
POWER_VM_DOWN_BEFORE_BACKUP=0
ENABLE_HARD_POWER_OFF=0
ITER_TO_WAIT_SHUTDOWN=3
POWER_DOWN_TIMEOUT=5
ENABLE_COMPRESSION=0
VM_SNAPSHOT_MEMORY=0
VM_SNAPSHOT_QUIESCE=0
ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP=0
ENABLE_NON_PERSISTENT_NFS=1
UNMOUNT_NFS=1
NFS_SERVER=10.10.10.10
NFS_MOUNT=/var/nfs
NFS_LOCAL_NAME=nfs_backup
NFS_VM_BACKUP_DIR=esx.jokeru.ro
SNAPSHOT_TIMEOUT=15
EMAIL_LOG=0
EMAIL_SERVER=
EMAIL_SERVER_PORT=
EMAIL_DELAY_INTERVAL=
EMAIL_TO=
EMAIL_FROM=
WORKDIR_DEBUG=0
VM_SHUTDOWN_ORDER=
VM_STARTUP_ORDER=
EOF
\$ cat \<\<'EOF' > ghettoVCB-master/list
vm1
vm2
EOF
# setup cronjob
\$ sed -i '\$d' /etc/rc.local.d/local.sh
\$ cat \<\<'EOF' >> /etc/rc.local.d/local.sh
/bin/kill \$(cat /var/run/crond.pid)
/bin/echo "30 01 */3 * *
/vmfs/volumes/data/BackUp/ghettoVCB-master/ghettoVCB.sh -g
/vmfs/volumes/data/BackUp/ghettoVCB-master/ghettoVCB.conf -f
/vmfs/volumes/data/BackUp/ghettoVCB-master/list >
/vmfs/volumes/data/BackUp/ghettoVCB-master/ghettoVCB-backup-\\$(date
+\\%s).log" >> /var/spool/cron/crontabs/root
/bin/crond
exit 0
EOF
\$ /etc/rc.local.d/local.sh
[/cc]
more details: https://communities.vmware.com/docs/DOC-8760