Month: July 2011

How to take Live-Backup of VMware(Esxi Server) VM host

How to take Live-Backup of VMware(Esxi Server) VM host

Introduction
ghettoVCB is a simple shell script which you can use to take backup of LIVE/ONLINE backup of Vm hosts/machines/servers on VMware ESXi-4.x Servers. It is a alternate solution of VCB (Vmware Comprehension Backup)
We need to copy this script on VMware ESXi servers. Please enable SSH on ESXi server and then copy this tool/script on the server.

Step 1) Download and Copy ghettoVCB Tool on Physical host of VM like host01 etc at following location

[root@localhost]# wget -c http://communities.vmware.com/servlet/JiveServlet/download/8760-71-63631/ghettoVCB.tar.gz
/var/src/ghettoVCB
[root@localhost]# tar xvfz ghettoVCB.tar.gz
[root@localhost]# ls ghettoVCB
arunb_vm_to_backup  ghettoVCB.conf  ghettoVCB.sh
[root@localhost]#

** I am copying ghettoVCB to host01 which is my VMware ESXi Server

[root@localhost]# scp -r   ghettoVCB host01:/vmfs/volumes/datastore1/

Step 2) Then Login to  Physical host of VM  say host01

[root@localhost]# ssh host01

~ # ls /vmfs/volumes/datastore1/ghettoVCB
arunb_vm_to_backup          arunb_vm_to_backup-temlate  ghettoVCB.conf              ghettoVCB.sh
~ #

Step 3) Please add VM you want to BACKUP (Live Backup)

* Open file in vi (for example I wanted to take backup of host01vm8)

~ # vi /vmfs/volumes/4e1e2374-4417303c-c9e5-00259037a1e1/ghettoVCB/arunb_vm_to_backup

~ # cat /vmfs/volumes/4e1e2374-4417303c-c9e5-00259037a1e1/ghettoVCB/arunb_vm_to_backup
host01vm8
~ #

Step 4) Start Backup in DRY-RUN Mode First ~

[root@localhost]# ssh host01

~ # cd /vmfs/volumes/datastore1/ghettoVCB/
/vmfs/volumes/4e1e2374-4417303c-c9e5-00259037a1e1/ghettoVCB # ls
arunb_vm_to_backup          arunb_vm_to_backup-temlate  ghettoVCB.conf              ghettoVCB.sh

** DRY-RUN First –

/vmfs/volumes/4e1e2374-4417303c-c9e5-00259037a1e1/ghettoVCB # ./ghettoVCB.sh -g ./ghettoVCB.conf  -f arunb_vm_to_backup -d dryrun

Logging output to “/tmp/ghettoVCB-2011-04-09_06-45-38.log” …
2011-04-09 06:45:38 — info: ============================== ghettoVCB LOG START ==============================

2011-04-09 06:45:38 — info: CONFIG – USING GLOBAL GHETTOVCB CONFIGURATION FILE = ./ghettoVCB.conf
2011-04-09 06:45:38 — info: CONFIG – VERSION = 2011_05_22_1
2011-04-09 06:45:38 — info: CONFIG – GHETTOVCB_PID = 636718
2011-04-09 06:45:38 — info: CONFIG – VM_BACKUP_VOLUME = /vmfs/volumes/NFS_admin_nfs/vmware/vm_backup
2011-04-09 06:45:38 — info: CONFIG – VM_BACKUP_ROTATION_COUNT = 3

….
2011-04-09 06:45:39 — dryrun: VM_ID: 112
2011-04-09 06:45:39 — dryrun: VMX_PATH: /vmfs/volumes/datastore1/host01vm8/host01vm8.vmx
2011-04-09 06:45:39 — dryrun: VMX_DIR: /vmfs/volumes/datastore1/host01vm8
2011-04-09 06:45:39 — dryrun: VMX_CONF: host01vm8/host01vm8.vmx
2011-04-09 06:45:39 — dryrun: VMFS_VOLUME: datastore1
2011-04-09 06:45:39 — dryrun: VMDK(s):
2011-04-09 06:45:39 — dryrun:  host01vm8.vmdk 2020 GB
2011-04-09 06:45:39 — dryrun: INDEPENDENT VMDK(s):
2011-04-09 06:45:39 — dryrun: TOTAL_VM_SIZE_TO_BACKUP: 20 GB
2011-04-09 06:45:39 — dryrun: ###############################################

2011-04-09 06:45:39 — info: ###### Final status: OK, only a dryrun. ######

2011-04-09 06:45:39 — info: ============================== ghettoVCB LOG END ================================

/vmfs/volumes/4e1e2374-4417303c-c9e5-00259037a1e1/ghettoVCB #

Step 5) Start Backup in NOW  ~

** RUN BACKUP Command –

/vmfs/volumes/4e1e2374-4417303c-c9e5-00259037a1e1/ghettoVCB # ./ghettoVCB.sh -g ./ghettoVCB.conf  -f arunb_vm_to_backup

Logging output to “/tmp/ghettoVCB-2011-04-09_06-46-22.log” …
2011-04-09 06:46:22 — info: ============================== ghettoVCB LOG START ==============================

2011-04-09 06:46:22 — info: CONFIG – USING GLOBAL GHETTOVCB CONFIGURATION FILE = ./ghettoVCB.conf
2011-04-09 06:46:22 — info: CONFIG – VERSION = 2011_05_22_1
2011-04-09 06:46:22 — info: CONFIG – GHETTOVCB_PID = 636880

….
2011-04-09 06:46:22 — info: CONFIG – LOG_LEVEL = info
2011-04-09 06:46:22 — info: CONFIG – BACKUP_LOG_OUTPUT = /tmp/ghettoVCB-2011-04-09_06-46-22.log
2011-04-09 06:46:22 — info: CONFIG – VM_SNAPSHOT_MEMORY = 0
2011-04-09 06:46:22 — info: CONFIG – VM_SNAPSHOT_QUIESCE = 0
2011-04-09 06:46:22 — info: CONFIG – VMDK_FILES_TO_BACKUP = all
2011-04-09 06:46:22 — info: CONFIG – EMAIL_LOG = 0
2011-04-09 06:46:22 — info:

2011-04-09 06:46:25 — info: Initiate backup for host01vm8
2011-04-09 06:46:25 — info: Creating Snapshot “ghettoVCB-snapshot-2011-04-09” for host01vm8
Destination disk format: VMFS thin-provisioned
Cloning disk ‘/vmfs/volumes/datastore1/host01vm8/host01vm8.vmdk’…
Clone: 3% done.

++++++++++++++++++++++++++++++++++

That’s it!!

NOTE – PLEASE CHECK BACKUP PATH (where do you want to TAKE BACKUP) in “ghettoVCB.conf”

VM_BACKUP_VOLUME=/vmfs/volumes/NFS_admin_nfs/vmware/vm_backup

Please visit following urls for more information –

Blog – http://www.virtuallyghetto.com/
http://communities.vmware.com/docs/DOC-8760

Thank You
Mohit Vadhera