How to backup Vmware ESX VM using Script

  1. Log in to a base server using root
  2. Change directory to “/vmfs/volumes/VSBASE-SAN-BK-8/vmbackup” (or “/vmfs/volumes/MSA60-VSBASE-2-BK/vmbackup”)
    1. Note: Vcentre doesn’t allow datastore to have the same name. So path will be a little different depending on the host.
  3. Two files are located in this directory:
    1. ghettoVCB.sh and vmlist
    2. The original ghettoVCB.sh  also resides here ghettoVCB-restore.sh 
  4. (optional) Open script using command “vi ghettoVCB.sh”, and double check the backup destination. It should have already defined.
clip_image002

  1. Open another file “vi vmlist”
  2. Input all VMs on this ESX host that need to backup into “vmlist”, and save the file. If you want to skip a server, just put a # before the server name.
clip_image004

  1. Run script “./ghettoVCB.sh -f vmlist”
  2. Backup will start and import all local VMs to backup location. Note: If a server has snapshot, the backup will skip this server and do the next.

Post a Comment

Previous Post Next Post