Jul 31

ESXi is one of my favorite products on the market and is really excellent for home use. It’s missing out on a few enterprise features like SNMP (I’ll show you how to get around that in a later post) but is otherwise very complete. I had previously been using a separate storage server using iscsi for my vmfs, but the dependency of the two boxes kept me from shutting down either server as needed. So, I converted everything back to local SATA storage (another post) and went on a hunt for how to backup my VMDKs. My iSCSI SAN had dual power supplies, 2 hot standby drives and I could do snapshot based backups whenever I wanted. My ESXi server has two SATA drives, one power supply and no easy way to backup. Enter GhettoVCB. GhettoVCB is a brilliant little shell script that runs on the ESXi server and performs backups of your vms using snapshots that can be stored on local, attached or network storage.  Getting GhettoVCB up and running isn’t difficult at all, you just need to make sure you have a few things in place first.

  • A place to store the backups (NFS, iSCSI, Local storage and potentially DAS)
  • Decide how many backups you want to have available
  • Decide How you want to store the files (thin, thick, etc) This consideration will impact how many backups you have available because of the different space requirements.
  • And lastly when you want your backups to run.

I’ve decided to take thin copies of my vmdks at midnight every night and store them on an NFS share with 5 backups available before the older ones get replaced.  I’m not going to try to replicate the excellent instructions that already exist for GhettoVCB,  but here is how I did it.

  1. Create an NFS mount on my NFS server with the following options
  2. /mnt/raid5/VMWare       10.0.0.0/24(rw,async,all_squash,anonuid=99,anongid=99)

  3. Mount the NFS share in vSphere and call it Backups
  4. enable ssh on your ESXi server
  5. scp ghettovcb.tar.gz to your ESXi server
  6. untar ghettovcb.tar.gz to /usr/ghettovcb
  7. edit ghettoVCB.sh and change VM_BACKUP_VOLUME to be VM_BACKUP_VOLUME=/vmfs/volumes/Backups
  8. edit DISK_BACKUP_FORMAT to be DISK_BACKUP_FORMAT=thin
  9. edit VM_BACKUP_ROTATION_COUNT to VM_BACKUP_ROTATION_COUNT=5
  10. edit EMAIL_LOG to EMAIL_LOG=0  unless you want to setup logs to be emailed to you.
  11. edit cron by running this command
  12. echo "0 6 * * * /usr/ghettoVCB/ghettoVCB.sh -a > /var/log/ghettoVCB-backup-$(date +\%s).log" >> /var/spool/cron/crontabs/root
    kill $(cat /var/run/crond.pid)
    busybox crond

  13. My cron is set for 6am because my clock is set to UTC, to 6am is midnight for me
  14. Wait until midnight for the cron to run or run it by hand yourself.

Logs will be stored in /var/log/  .  I’m backing up 8 VMs in roughly an hour using about 60GB of space (thin provisioned) and have tested restores successfully. Good luck and let me know if you have any issues!

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.