Beruflich Dokumente
Kultur Dokumente
sh -
Restoring VM's backed up from ghettoVCB to
ESX(i) 3.5 and 4.0+
Table of Contents:
• Description
• Requirements
• Setup
• Usage
• Sample Execution
• Change Log
• Known Issues
Description:
This script performs a restore of virtual machines backed up using ghettoVCB . Tasks are performed directly within
the service console of the ESX(i) server involved in the restore process. This is currently a Ghetto Tech Preview that
includes basic restore functionality. Two main use cases are supported in this release:
In all cases, restored VMs will have VMDKs that reside on the SAME datastore chosen for the restore process.
Please ensure that there is sufficient space on the target datastore before attempting a restore operation. In the near
future, restoration of VMs backed up using the compression feature of ghettoVCB will be implemented.
Features
• Support for logging output
• Support for various debugging output
• Allow spaces in VM(s) backup list (not recommended and not a best practice)
• Support for restore in the following formats: ZEROEDTHICK (default behavior), 2GB SPARSE, THIN or
EAGERZEROEDTHICK
Requirements:
VMs backed up using ghettoVCB.sh on ESX(i) 3.5 or 4.0
SSH console access to ESX/ESXi 3.5 or 4.0 host
Setup:
1) Download ghettoVCB-restore.tar.gz and upload to either your ESX or ESXi system (use scp or WinSCP to
transfer the file)
2) The script is now ready to be used and is located in a directory named ghettoVCB-restore
[root@himalaya
ghettoVCB-restore]# ls -l
total 20
-rwxr-xr-x 1 root root 15279 May 10 18:41 ghettoVCB-restore.sh
-rw-r--r-- 1 root root 309 May 10 18:41 vms_to_restore_sample.txt
Usage:
[root@himalaya ~]#
./ghettoVCB-restore.sh
###############################################################################
#
# ghettoVCB-restore for ESX/ESXi 3.5u2+ & 4.x+
# Author: William Lam
# http://www.engineering.ucsb.edu/~duonglt/vmware/
# Created: 08/18/2009
# Last modified: 08/25/2009
#
###############################################################################
OPTIONS:
-c VM backup list
-l File ot output logging
(e.g.)
Comments in the input file is acceptable so long as the intended line is preceded by a #. The above sample VM
restore file, vms_to_restore, describes the following backup:
WILLIAM_BACKUPS/vMA-resize/
vMA-resize-2009-08-23--1
Sample Execution:
Execute restore with output going to stdout (restore the first two VMs listed from above):
Input file:
[root@himalaya ~]# cat
vms_to_restore
"/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/VCAP/VCAP-2009-08-20--1;/vmfs/volume
"/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/sideswipe/sideswipe-2009-08-20--1;/v
[root@himalaya ~]#
./ghettoVCB-restore.sh -c vms_to_restore
################## Restoring VM: VCAP #####################
Start time: Sun Aug 23 22:31:26 PDT 2009
Restoring VM from:
"/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/VCAP/VCAP-2009-08-20--1"
Restoring VM to Datastore:
"/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage" using Disk
Format: "zeroedthick"
Creating VM directory:
"/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP" ...
Copying "VCAP.vmx" file ...
Restoring VM's VMDK(s) ...
Updating VMDK entry in "VCAP.vmx" file ...
Destination disk format: VMFS zeroedthick
Cloning disk
'/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/VCAP/VCAP-2009-08-20--1/VCAP.vmdk'..
Clone: 100% done.
Registering VCAP ...
End time: Sun Aug 23 22:32:32 PDT 2009
################## Completed restore for VCAP!
#####################
'/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/sideswipe/sideswipe-2009-08-20--1/si
Clone: 100% done.
Updating VMDK entry in "sideswipe.vmx" file ...
Destination disk format: VMFS zeroedthick
Cloning disk
'/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/sideswipe/sideswipe-2009-08-20--1/4a
Clone: 100% done.
Updating VMDK entry in "sideswipe.vmx" file ...
Destination disk format: VMFS zeroedthick
Cloning disk
'/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/sideswipe/sideswipe-2009-08-20--1/4a
Clone: 100% done.
Updating VMDK entry in "sideswipe.vmx" file ...
Destination disk format: VMFS zeroedthick
Cloning disk
'/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/sideswipe/sideswipe-2009-08-20--1/si
Clone: 100% done.
Registering sideswipe ...
End time: Sun Aug 23 22:34:46 PDT 2009
################## Completed restore for sideswipe!
#####################
-------------------------------------------------------------------------------------------------
Execute restore with output going to log file /tmp/ghettoVCB-restore.log (restore the last two VMs listed from
above):
Input file:
[root@himalaya ~]# cat
vms_to_restore
"/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/stupid
ass vm with spaces/stupid ass vm with
spaces-2009-08-20--1;/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage;2"
"/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/vMA-resize/vMA-resize-2009-08-23--1;
[root@himalaya ~]#
./ghettoVCB-restore.sh -c vms_to_restore -l
/tmp/ghettoVCB-restore.log
Logging output to "/tmp/ghettoVCB-restore.log" ...
cat /tmp/ghettoVCB-restore.log
-------------------------------------------------------------------------------------------------
SOURCE:
"/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/stupid
ass vm with spaces/stupid ass vm with spaces-2009-08-20--1/stupid
ass vm with spaces.vmdk"
ORIGINAL_VMX_LINE: -->scsi0:0.fileName = "stupid ass vm
with spaces.vmdk"<--
DESTIONATION:
"/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/stupid ass vm
with spaces/stupid ass vm with spaces-0.vmdk"
MODIFIED_VMX_LINE: -->scsi0:0.fileName = "stupid ass vm
with spaces-0.vmdk"<--
Updating VMDK entry in "stupid ass vm with spaces.vmx" file ...
SOURCE:
"/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/stupid
ass vm with spaces/stupid ass vm with
spaces-2009-08-20--1/4a31aece-e34d675a-72cf-003048d9586a/stupid ass
vm with spaces.vmdk"
ORIGINAL_VMX_LINE: -->scsi0:1.fileName =
"/vmfs/volumes/4a31aece-e34d675a-72cf-003048d9586a/stupid ass vm
with spaces/stupid ass vm with spaces.vmdk"<--
DESTIONATION:
"/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/stupid ass vm
with spaces/stupid ass vm with spaces-1.vmdk"
MODIFIED_VMX_LINE: -->scsi0:1.fileName = "stupid ass vm
with spaces-1.vmdk"<--
Updating VMDK entry in "stupid ass vm with spaces.vmx" file ...
SOURCE:
"/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/stupid
ass vm with spaces/stupid ass vm with
spaces-2009-08-20--1/4a31aece-e34d675a-72cf-003048d9586a/stupid ass
vm with spaces_1.vmdk"
ORIGINAL_VMX_LINE: -->scsi0:2.fileName =
"/vmfs/volumes/4a31aece-e34d675a-72cf-003048d9586a/stupid ass vm
with spaces/stupid ass vm with spaces_1.vmdk"<--
DESTIONATION:
"/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/stupid ass vm
with spaces/stupid ass vm with spaces-2.vmdk"
MODIFIED_VMX_LINE: -->scsi0:2.fileName = "stupid ass vm
with spaces-2.vmdk"<--
Registering stupid ass vm with spaces ...
End time: Sun Aug 23 23:05:11 PDT 2009
################## Completed restore for stupid ass vm with spaces!
#####################
Restoring VM from:
"/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/vMA-resize/vMA-resize-2009-08-23--1"
Restoring VM to Datastore:
"/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage" using Disk
Format: "thin"
Creating VM directory:
"/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/vMA-resize" ...
Copying "vMA-resize.vmx" file ...
Restoring VM's VMDK(s) ...
Updating VMDK entry in "vMA-resize.vmx" file ...
SOURCE:
"/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS/vMA-resize/vMA-resize-2009-08-23--1/
ORIGINAL_VMX_LINE: -->scsi0:0.fileName =
"vMA-resize.vmdk"<--
DESTIONATION:
"/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/vMA-resize/vMA-resize-0.vmdk"
MODIFIED_VMX_LINE: -->scsi0:0.fileName =
"vMA-resize-0.vmdk"<--
Registering vMA-resize ...
End time: Sun Aug 23 23:05:11 PDT 2009
################## Completed restore for vMA-resize!
#####################
-------------------------------------------------------------------------------------------------
Change Log:
05/10/2010
Tarred up ghettoVCB-restore.sh script and sample input file per user request
Known Issues: