[root@himalaya ~]# chmod +x ghettoVCB.sh
VM_BACKUP_VOLUME=/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
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
SNAPSHOT_TIMEOUT=15
ENABLE_COMPRESSION=0
ADAPTER_FORMAT=buslogic
VM_SNAPSHOT_MEMORY=0
VM_SNAPSHOT_QUIESCE=0
VMDK_FILES_TO_BACKUP="myvmdk.vmdk"
########################## DO NOT MODIFY PAST THIS LINE ##########################
[root@himalaya ~]# ./ghettoVCB.sh
###############################################################################
#
# ghettoVCB for ESX/ESXi 3.5 & 4.x+
# Author: William Lam
# http://www.engineering.ucsb.edu/~duonglt/vmware/
# Created: 11/17/2008
# Last modified: 11/14/2009
#
###############################################################################
Usage: ./ghettoVCB.sh -f [VM_BACKUP_UP_LIST] -c [VM_CONFIG_DIR] -l [LOG_FILE]
OPTIONS:
-f List of VMs to backup
-c Configuration directory for VM backups
-l File to output logging
-d Debug level [info|debug|dryrun] (default: info)
(e.g.)
Backup VMs stored in a list
./ghettoVCB.sh -f vms_to_backup
Backup VMs based on specific configuration located in directory
./ghettoVCB.sh -f vms_to_backup -c vm_backup_configs
Output will log to /tmp/ghettoVCB.log
./ghettoVCB.sh -f vms_to_backup -l /tmp/ghettoVCB.log
Dry run (no backup will take place)
./ghettoVCB.sh -f vms_to_backup -d dryrun
[root@himalaya ~]# cat vms_to_backup
VCAP
VIMA
vMA-2
[root@himalaya ~]# ./ghettoVCB.sh -f vms_to_backup
2009-11-12 06:14:10 -- info: ============================== ghettoVCB LOG START ==============================
2009-11-12 06:14:10 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-12 06:14:10 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-12 06:14:10 -- info: CONFIG - DISK_BACKUP_FORMAT = thin
2009-11-12 06:14:10 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-12 06:14:10 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-12 06:14:10 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-12 06:14:10 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-11-12 06:14:10 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-12 06:14:10 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-12 06:14:10 -- info: CONFIG - LOG_LEVEL = info
2009-11-12 06:14:10 -- info: CONFIG - BACKUP_LOG_OUTPUT = stdout
2009-11-12 06:14:10 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-11-12 06:14:10 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-12 06:14:10 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-11-12 06:14:15 -- info: Initiate backup for VCAP
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP/VCAP_2.vmdk'...
Clone: 100% done.
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP/VCAP_1.vmdk'...
Clone: 100% done.
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP/VCAP.vmdk'...
Clone: 100% done.
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP/VCAP-0.vmdk'...
Clone: 100% done.
2009-11-12 06:15:15 -- info: Backup Duration: 60 Seconds
2009-11-12 06:15:15 -- info: Successfully completed backup for VCAP!
2009-11-12 06:15:17 -- info: Initiate backup for VIMA
2009-11-12 06:15:17 -- info: Creating Snapshot "ghettoVCB-snapshot-2009-11-12" for VIMA
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SAS.Savvio/VIMA/VIMA.vmdk'...
Clone: 100% done.
2009-11-12 06:16:40 -- info: Removing snapshot from VIMA ...
2009-11-12 06:16:43 -- info: Backup Duration: 1.43 Minutes
2009-11-12 06:16:43 -- info: Successfully completed backup for VIMA!
2009-11-12 06:16:47 -- info: Initiate backup for vMA-2
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SAS.Constellation/vMA-2/vMA-2.vmdk'...
Clone: 100% done.
2009-11-12 06:18:14 -- info: Backup Duration: 1.45 Minutes
2009-11-12 06:18:14 -- info: Successfully completed backup for vMA-2!
2009-11-12 06:18:14 -- info: ============================== ghettoVCB LOG END ================================
[root@himalaya ~]# mkdir backup_config
[root@himalaya backup_config]# cp ghettoVCB-vm_backup_configuration_template VCAP
[root@himalaya backup_config]# cp ghettoVCB-vm_backup_configuration_template VIMA
[root@himalaya backup_config]# ls
ghettoVCB-vm_backup_configuration_template VCAP VIMA
[root@himalaya backup_config]# cat VCAP
VM_BACKUP_VOLUME=/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
DISK_BACKUP_FORMAT=thin
VM_BACKUP_ROTATION_COUNT=3
POWER_VM_DOWN_BEFORE_BACKUP=0
ENABLE_HARD_POWER_OFF=0
ITER_TO_WAIT_SHUTDOWN=4
POWER_DOWN_TIMEOUT=5
SNAPSHOT_TIMEOUT=15
ENABLE_COMPRESSION=0
ADAPTER_FORMAT=buslogic
VM_SNAPSHOT_MEMORY=0
VM_SNAPSHOT_QUIESCE=0
VMDK_FILES_TO_BACKUP="VCAP.vmdk,VCAP_2.vmdk"
[root@himalaya backup_config]# cat VIMA
VM_BACKUP_VOLUME=/vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
DISK_BACKUP_FORMAT=thin
VM_BACKUP_ROTATION_COUNT=3
POWER_VM_DOWN_BEFORE_BACKUP=0
ENABLE_HARD_POWER_OFF=0
ITER_TO_WAIT_SHUTDOWN=4
POWER_DOWN_TIMEOUT=5
SNAPSHOT_TIMEOUT=15
ENABLE_COMPRESSION=0
ADAPTER_FORMAT=buslogic
VM_SNAPSHOT_MEMORY=1
VM_SNAPSHOT_QUIESCE=0
VMDK_FILES_TO_BACKUP="all"
[root@himalaya ~]# ./ghettoVCB.sh -f vms_to_backup -c backup_config -l /tmp/ghettoVCB.log
Logging output to "/tmp/ghettoVCB.log" ...
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP/VCAP_2.vmdk'...
Clone: 100% done.
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP/VCAP.vmdk'...
Clone: 100% done.
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SAS.Savvio/VIMA/VIMA.vmdk'...
Clone: 100% done.
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SAS.Constellation/vMA-2/vMA-2.vmdk'...
Clone: 100% done.
[root@himalaya ~]# cat /tmp/ghettoVCB.log
2009-11-12 06:26:53 -- info: ============================== ghettoVCB LOG START ==============================
2009-11-12 06:26:56 -- info: CONFIG - USING CONFIGURATION FILE = backup_config/VCAP
2009-11-12 06:26:56 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-12 06:26:56 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-12 06:26:56 -- info: CONFIG - DISK_BACKUP_FORMAT = thin
2009-11-12 06:26:56 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-12 06:26:56 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-12 06:26:56 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-12 06:26:56 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 4
2009-11-12 06:26:56 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-12 06:26:56 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-12 06:26:56 -- info: CONFIG - LOG_LEVEL = info
2009-11-12 06:26:56 -- info: CONFIG - BACKUP_LOG_OUTPUT = /tmp/ghettoVCB.log
2009-11-12 06:26:56 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-11-12 06:26:56 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-12 06:26:56 -- info: CONFIG - VMDK_FILES_TO_BACKUP = VCAP.vmdk,VCAP_2.vmdk
2009-11-12 06:26:58 -- info: Initiate backup for VCAP
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP/VCAP_2.vmdk'...
Clone: 100% done.
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP/VCAP.vmdk'...
Clone: 100% done.
2009-11-12 06:26:59 -- info: Backup Duration: 1 Seconds
2009-11-12 06:26:59 -- info: Successfully completed backup for VCAP!
2009-11-12 06:26:59 -- info: CONFIG - USING CONFIGURATION FILE = backup_config/VIMA
2009-11-12 06:26:59 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-12 06:26:59 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-12 06:26:59 -- info: CONFIG - DISK_BACKUP_FORMAT = thin
2009-11-12 06:26:59 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-12 06:26:59 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-12 06:26:59 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-12 06:26:59 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 4
2009-11-12 06:26:59 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-12 06:26:59 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-12 06:26:59 -- info: CONFIG - LOG_LEVEL = info
2009-11-12 06:26:59 -- info: CONFIG - BACKUP_LOG_OUTPUT = /tmp/ghettoVCB.log
2009-11-12 06:26:59 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 1
2009-11-12 06:26:59 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-12 06:26:59 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-11-12 06:27:02 -- info: Initiate backup for VIMA
2009-11-12 06:27:02 -- info: Creating Snapshot "ghettoVCB-snapshot-2009-11-12" for VIMA
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SAS.Savvio/VIMA/VIMA.vmdk'...
Clone: 100% done.
2009-11-12 06:29:28 -- info: Removing snapshot from VIMA ...
2009-11-12 06:29:31 -- info: Backup Duration: 2.48 Minutes
2009-11-12 06:29:31 -- info: Successfully completed backup for VIMA!
2009-11-12 06:29:31 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-12 06:29:31 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-12 06:29:31 -- info: CONFIG - DISK_BACKUP_FORMAT = thin
2009-11-12 06:29:31 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-12 06:29:31 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-12 06:29:31 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-12 06:29:31 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-11-12 06:29:31 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-12 06:29:31 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-12 06:29:31 -- info: CONFIG - LOG_LEVEL = info
2009-11-12 06:29:31 -- info: CONFIG - BACKUP_LOG_OUTPUT = /tmp/ghettoVCB.log
2009-11-12 06:29:31 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-11-12 06:29:31 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-12 06:29:31 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-11-12 06:29:35 -- info: Initiate backup for vMA-2
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SAS.Constellation/vMA-2/vMA-2.vmdk'...
Clone: 100% done.
2009-11-12 06:31:05 -- info: Backup Duration: 1.50 Minutes
2009-11-12 06:31:05 -- info: Successfully completed backup for vMA-2!
2009-11-12 06:31:05 -- info: ============================== ghettoVCB LOG END ================================
[root@himalaya ~]# ./ghettoVCB.sh -f vms_to_backup -c backup_config -d debug
2009-11-13 19:51:47 -- info: ============================== ghettoVCB LOG START ==============================
2009-11-13 19:51:47 -- debug: HOST BUILD: VMware ESX 4.0.0 build-164009
2009-11-13 19:51:47 -- debug: HOSTNAME: himalaya.primp-industries.com
2009-11-13 19:51:51 -- info: CONFIG - USING CONFIGURATION FILE = backup_config/VCAP
2009-11-13 19:51:51 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-13 19:51:51 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-13 19:51:51 -- info: CONFIG - DISK_BACKUP_FORMAT = thin
2009-11-13 19:51:51 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-13 19:51:51 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-13 19:51:51 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-13 19:51:51 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 4
2009-11-13 19:51:51 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-13 19:51:51 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-13 19:51:51 -- info: CONFIG - LOG_LEVEL = debug
2009-11-13 19:51:51 -- info: CONFIG - BACKUP_LOG_OUTPUT = stdout
2009-11-13 19:51:51 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-11-13 19:51:51 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-13 19:51:51 -- info: CONFIG - VMDK_FILES_TO_BACKUP = VCAP.vmdk,VCAP_2.vmdk
2009-11-13 19:51:52 -- info: Initiate backup for VCAP
2009-11-13 19:51:52 -- debug: findVMDK() - Searching for VMDK: "VCAP_2.vmdk" to backup
2009-11-13 19:51:52 -- debug: findVMDK() - Found VMDK! - "VCAP_2.vmdk" to backup
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP/VCAP_2.vmdk'...
Clone: 100% done.
2009-11-13 19:51:53 -- debug: findVMDK() - Searching for VMDK: "VCAP_1.vmdk" to backup
2009-11-13 19:51:53 -- debug: findVMDK() - Searching for VMDK: "VCAP.vmdk" to backup
2009-11-13 19:51:53 -- debug: findVMDK() - Found VMDK! - "VCAP.vmdk" to backup
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP/VCAP.vmdk'...
Clone: 100% done.
2009-11-13 19:51:53 -- debug: findVMDK() - Searching for VMDK: "VCAP-0.vmdk" to backup
2009-11-13 19:51:54 -- info: Backup Duration: 2 Seconds
2009-11-13 19:51:54 -- info: Successfully completed backup for VCAP!
2009-11-13 19:51:54 -- info: CONFIG - USING CONFIGURATION FILE = backup_config/VIMA
2009-11-13 19:51:54 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-13 19:51:54 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-13 19:51:54 -- info: CONFIG - DISK_BACKUP_FORMAT = thin
2009-11-13 19:51:54 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-13 19:51:54 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-13 19:51:54 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-13 19:51:54 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 4
2009-11-13 19:51:54 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-13 19:51:54 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-13 19:51:54 -- info: CONFIG - LOG_LEVEL = debug
2009-11-13 19:51:54 -- info: CONFIG - BACKUP_LOG_OUTPUT = stdout
2009-11-13 19:51:54 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 1
2009-11-13 19:51:54 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-13 19:51:54 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-11-13 19:51:56 -- info: Initiate backup for VIMA
2009-11-13 19:51:56 -- info: Creating Snapshot "ghettoVCB-snapshot-2009-11-13" for VIMA
2009-11-13 19:51:58 -- debug: Waiting for snapshot "ghettoVCB-snapshot-2009-11-13" to be created
2009-11-13 19:51:58 -- debug: Snapshot timeout set to: 900 seconds
2009-11-13 19:52:01 -- debug: Waiting for snapshot creation to be completed - Iteration: 0 - sleeping for 60secs (Duration: 0 seconds)
2009-11-13 19:53:03 -- debug: findVMDK() - Searching for VMDK: "VIMA.vmdk" to backup
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SAS.Savvio/VIMA/VIMA.vmdk'...
Clone: 100% done.
2009-11-13 19:54:27 -- info: Removing snapshot from VIMA ...
2009-11-13 19:54:32 -- info: Backup Duration: 2.60 Minutes
2009-11-13 19:54:32 -- info: Successfully completed backup for VIMA!
2009-11-13 19:54:32 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-13 19:54:32 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-13 19:54:32 -- info: CONFIG - DISK_BACKUP_FORMAT = thin
2009-11-13 19:54:32 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-13 19:54:32 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-13 19:54:32 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-13 19:54:32 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-11-13 19:54:32 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-13 19:54:32 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-13 19:54:32 -- info: CONFIG - LOG_LEVEL = debug
2009-11-13 19:54:32 -- info: CONFIG - BACKUP_LOG_OUTPUT = stdout
2009-11-13 19:54:32 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-11-13 19:54:32 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-13 19:54:32 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-11-13 19:54:35 -- info: Initiate backup for vMA-2
2009-11-13 19:54:35 -- debug: findVMDK() - Searching for VMDK: "vMA-2.vmdk" to backup
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/himalaya-local-SAS.Constellation/vMA-2/vMA-2.vmdk'...
Clone: 100% done.
2009-11-13 19:56:10 -- info: Backup Duration: 1.58 Minutes
2009-11-13 19:56:10 -- info: Successfully completed backup for vMA-2!
2009-11-13 19:56:10 -- info: ============================== ghettoVCB LOG END ================================
[root@himalaya ~]# ./ghettoVCB.sh -f vms_to_backup -c backup_config -d dryrun
2009-11-12 06:32:57 -- info: ============================== ghettoVCB LOG START ==============================
2009-11-12 06:33:01 -- info: CONFIG - USING CONFIGURATION FILE = backup_config/VCAP
2009-11-12 06:33:01 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-12 06:33:01 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-12 06:33:01 -- info: CONFIG - DISK_BACKUP_FORMAT = thin
2009-11-12 06:33:01 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-12 06:33:01 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-12 06:33:01 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-12 06:33:01 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 4
2009-11-12 06:33:01 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-12 06:33:01 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-12 06:33:01 -- info: CONFIG - LOG_LEVEL = dryrun
2009-11-12 06:33:01 -- info: CONFIG - BACKUP_LOG_OUTPUT = stdout
2009-11-12 06:33:01 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-11-12 06:33:01 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-12 06:33:01 -- info: CONFIG - VMDK_FILES_TO_BACKUP = VCAP.vmdk,VCAP_2.vmdk
2009-11-12 06:33:01 -- dryrun: ###############################################
2009-11-12 06:33:01 -- dryrun: Virtual Machine: VCAP
2009-11-12 06:33:01 -- dryrun: VM_ID: 2784
2009-11-12 06:33:01 -- dryrun: VMX_PATH: /vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP/VCAP.vmx
2009-11-12 06:33:01 -- dryrun: VMX_DIR: /vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/VCAP
2009-11-12 06:33:01 -- dryrun: VMX_CONF: VCAP/VCAP.vmx
2009-11-12 06:33:01 -- dryrun: VMFS_VOLUME: himalaya-local-SATA.RE4-GP:Storage
2009-11-12 06:33:01 -- dryrun: VMDK(s):
2009-11-12 06:33:01 -- dryrun: VCAP_2.vmdk
2009-11-12 06:33:01 -- dryrun: VCAP_1.vmdk
2009-11-12 06:33:01 -- dryrun: VCAP.vmdk
2009-11-12 06:33:01 -- dryrun: VCAP-0.vmdk
2009-11-12 06:33:01 -- dryrun: ###############################################
2009-11-12 06:33:01 -- info: CONFIG - USING CONFIGURATION FILE = backup_config/VIMA
2009-11-12 06:33:01 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-12 06:33:01 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-12 06:33:01 -- info: CONFIG - DISK_BACKUP_FORMAT = thin
2009-11-12 06:33:01 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-12 06:33:01 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-12 06:33:01 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-12 06:33:01 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 4
2009-11-12 06:33:01 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-12 06:33:01 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-12 06:33:01 -- info: CONFIG - LOG_LEVEL = dryrun
2009-11-12 06:33:01 -- info: CONFIG - BACKUP_LOG_OUTPUT = stdout
2009-11-12 06:33:01 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 1
2009-11-12 06:33:01 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-12 06:33:01 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-11-12 06:33:01 -- dryrun: ###############################################
2009-11-12 06:33:01 -- dryrun: Virtual Machine: VIMA
2009-11-12 06:33:01 -- dryrun: VM_ID: 4064
2009-11-12 06:33:01 -- dryrun: VMX_PATH: /vmfs/volumes/himalaya-local-SAS.Savvio/VIMA/VIMA.vmx
2009-11-12 06:33:01 -- dryrun: VMX_DIR: /vmfs/volumes/himalaya-local-SAS.Savvio/VIMA
2009-11-12 06:33:01 -- dryrun: VMX_CONF: VIMA/VIMA.vmx
2009-11-12 06:33:01 -- dryrun: VMFS_VOLUME: himalaya-local-SAS.Savvio
2009-11-12 06:33:01 -- dryrun: VMDK(s):
2009-11-12 06:33:01 -- dryrun: VIMA.vmdk
2009-11-12 06:33:01 -- dryrun: ###############################################
2009-11-12 06:33:01 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-12 06:33:01 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-12 06:33:01 -- info: CONFIG - DISK_BACKUP_FORMAT = thin
2009-11-12 06:33:01 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-12 06:33:01 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-12 06:33:01 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-12 06:33:01 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-11-12 06:33:01 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-12 06:33:01 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-12 06:33:01 -- info: CONFIG - LOG_LEVEL = dryrun
2009-11-12 06:33:01 -- info: CONFIG - BACKUP_LOG_OUTPUT = stdout
2009-11-12 06:33:01 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-11-12 06:33:01 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-12 06:33:01 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-11-12 06:33:01 -- dryrun: ###############################################
2009-11-12 06:33:01 -- dryrun: Virtual Machine: vMA-2
2009-11-12 06:33:01 -- dryrun: VM_ID: 4960
2009-11-12 06:33:01 -- dryrun: VMX_PATH: /vmfs/volumes/himalaya-local-SAS.Constellation/vMA-2/vMA-2.vmx
2009-11-12 06:33:01 -- dryrun: VMX_DIR: /vmfs/volumes/himalaya-local-SAS.Constellation/vMA-2
2009-11-12 06:33:01 -- dryrun: VMX_CONF: vMA-2/vMA-2.vmx
2009-11-12 06:33:01 -- dryrun: VMFS_VOLUME: himalaya-local-SAS.Constellation
2009-11-12 06:33:01 -- dryrun: VMDK(s):
2009-11-12 06:33:02 -- dryrun: vMA-2.vmdk
2009-11-12 06:33:02 -- dryrun: ###############################################
2009-11-12 06:33:02 -- info: ============================== ghettoVCB LOG END ================================
[root@himalaya ~]# crontab -e
0 0 * * 1-5 /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/ghettoVCB.sh -f /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/backuplist > /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/ghettoVCB-backup-$(date +\%s).log
[root@himalaya dlgCore-NFS-bigboi.VM-Backups]# crontab -e
no crontab for root - using an empty one
crontab: installing new crontab
[root@himalaya dlgCore-NFS-bigboi.VM-Backups]# crontab -l
0 0 * * 1-5 /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/ghettoVCB.sh -f /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/backuplist > /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/ghettoVCB-backup-$(date +\%s).log
0 0 * * 1-5 /vmfs/volumes/simplejack-local-storage/ghettoVCB.sh -f /vmfs/volumes/simplejack-local-storage/backuplist > /vmfs/volumes/simplejack-local-storage/ghettoVCB-backup-$(date +\%s).log
kill $(ps | grep crond | cut -f 1 -d ' ')
~ # kill $(pidof crond)
~ # crond
~ # kill $(cat /var/run/crond.pid)
~ # busybox crond
/bin/kill $(pidof crond)
/bin/echo "0 0 * * 1-5 /vmfs/volumes/simplejack-local-storage/ghettoVCB.sh -f /vmfs/volumes/simplejack-local-storage/backuplist > /vmfs/volumes/simplejack-local-storage/ghettoVCB-backup-\$(date +\\%s).log" >> /var/spool/cron/crontabs/root
crond
/bin/kill $(cat /var/run/crond.pid)
/bin/echo "0 0 * * 1-5 /vmfs/volumes/simplejack-local-storage/ghettoVCB.sh -f /vmfs/volumes/simplejack-local-storage/backuplist > /vmfs/volumes/simplejack-local-storage/ghettoVCB-backup-\$(date +\\%s).log" >> /var/spool/cron/crontabs/root
/bin/busybox crond
~ # cat /etc/rc.local
#! /bin/ash
export PATH=/sbin:/bin
log() {
echo "$1"
logger init "$1"
}
#execute all service retgistered in /etc/rc.local.d
if [http:// -d /etc/rc.local.d |http:// -d /etc/rc.local.d ]; then
for filename in `find /etc/rc.local.d/ | sort`
do
if [ -f $filename ] && [ -x $filename ]; then
log "running $filename"
$filename
fi
done
fi
/bin/kill $(cat /var/run/crond.pid)
/bin/echo "0 0 * * 1-5 /vmfs/volumes/simplejack-local-storage/ghettoVCB.sh -f /vmfs/volumes/simplejack-local-storage/backuplist > /vmfs/volumes/simplejack-local-storage/ghettoVCB-backup-\$(date +\\%s).log" >> /var/spool/cron/crontabs/root
/bin/busybox crond
~ # /sbin/auto-backup.sh
config implicitly loaded
local.tgz
etc/vmware/vmkiscsid/vmkiscsid.db
etc/dropbear/dropbear_dss_host_key
etc/dropbear/dropbear_rsa_host_key
etc/opt/vmware/vpxa/vpxa.cfg
etc/opt/vmware/vpxa/dasConfig.xml
etc/sysconfig/network
etc/vmware/hostd/authorization.xml
etc/vmware/hostd/hostsvc.xml
etc/vmware/hostd/pools.xml
etc/vmware/hostd/vmAutoStart.xml
etc/vmware/hostd/vmInventory.xml
etc/vmware/hostd/proxy.xml
etc/vmware/ssl/rui.crt
etc/vmware/ssl/rui.key
etc/vmware/vmkiscsid/initiatorname.iscsi
etc/vmware/vmkiscsid/iscsid.conf
etc/vmware/vmware.lic
etc/vmware/config
etc/vmware/dvsdata.db
etc/vmware/esx.conf
etc/vmware/license.cfg
etc/vmware/locker.conf
etc/vmware/snmp.xml
etc/group
etc/hosts
etc/inetd.conf
etc/rc.local
etc/chkconfig.db
etc/ntp.conf
etc/passwd
etc/random-seed
etc/resolv.conf
etc/shadow
etc/sfcb/repository/root/interop/cim_indicationfilter.idx
etc/sfcb/repository/root/interop/cim_indicationhandlercimxml.idx
etc/sfcb/repository/root/interop/cim_listenerdestinationcimxml.idx
etc/sfcb/repository/root/interop/cim_indicationsubscription.idx
Binary files /etc/vmware/dvsdata.db and /tmp/auto-backup.31345.dir/etc/vmware/dvsdata.db differ
config implicitly loaded
Saving current state in /bootbank
Clock updated.
Time: 20:40:36 Date: 08/14/2009 UTC
[root@himalaya dlgCore-NFS-bigboi.VM-Backups]# ps -ef | grep crond | grep -v grep
root 2625 1 0 Aug13 ? 00:00:00 crond
~ # ps | grep crond | grep -v grep
5196 5196 busybox crond
[root@himalaya dlgCore-NFS-bigboi.VM-Backups]# date
Fri Aug 14 23:44:47 PDT 2009
Forgot to mention, you can also find more scripts/resources located at:
http://engineering.ucsb.edu/~duonglt/vmware/
Hi Shaveht,
This script can not be locally executed on VMware VIMA, but can be remotely kicked off from VIMA or any other UNIX/Linux, even a Windows host using plink.
The process is as follows:
You store the "ghettoVCB.sh" on shared storage (FC/iSCSI SAN / NFS), including the list of Virtual Machines you would like to backup. You can then create a cron entry that will kick off the backup process say every Friday at 12am. To ensure this does not require a user to enter a password, you'll need to utilize public/private SSH Key Authentication. This would then ssh into the ESX/ESXi host(s) and execute this script passing in the list which is also stored on the shared storage and the backup process would be kicked off.
This allows you to centralize your backup process without having to create separate cron entries on each of the ESX and ESXi hosts and storing a copy on each system. This does add an additional system to the process and if you know this VIMA host will always be accessible to the ESX/ESXi cluster, you should be fine.
An entry to the cron for the command would look like the following:
ssh root@A.B.C.D "/vmfs/volumes/SOME_DATASTORE/ghettoVCB.sh /vmfs/volumes/SOME_ADMIN_DATASTORE/virtual_machine_backup_list"
Hi lamw,
Thanks for the explanation.
in effect i was confused about how to use it.
thanks again.
Hi,
I have 7 blade servers with approx 50 VM's, is it possible to run this script from just one esxi host and have it back up all the VM's that are running on it locally and also the VM's running on the other blades?
Take a look at the my previous comment. I would not suggest setting this up on an ESXi host, probably an administrative linux/windows or even VIMA host.
Nice script and Thanks for the same. The backup runs fine after few issues being faced in the start. I have the following queries.
1. Is there a way I can backup the vm's without shutting them down?
2. What is the ideal restore procedure? (assuming Its going to be a disk-to-disk restoration.)
Thanks
tux
Hi tuxfan2183,
1) The power down feature was recently added, if you want to backup your VM(s) while they're live, just ensure the flag "POWER_VM_DOWN_BEFORE_BACKUP" is set to 0=no, 1=yes. By default this option is set to 0 which is to backup while the VM is running
2) There are multitude of options, depending where and how the backups are being stored and what your backup scenario requires. You can either mount the backup datastore and register the VM either by browsing the VI Client datastore or manually using CLI tool like "vmware-cmd -s register" or "vim-cmd" for ESXi. If you do not want to directly mount your backup but rather restore back to your source ESX/ESXi host, you can just manually run "vmkfstools" copy from your backup datastore to your source datastore and then register your VM. Again, this will be environment specific, but those are your options and this can be easily scripted or done manually as this is a backup process which requires additional care.
Hope this answered your questions.
Thanks william. You are the best
does this only back up 1 vmdk file per virtual machine? I ran it and it backed up teh vmdk of a vm i have but not another vmdk that is in the same directory
No, it should backup all "valid" VMDK(s) that is associated with a VM. Yon can verify this by going into the VM's "edit virtual machine settings" and ensure that all disks are listed within the hardware tab.
When you use the VIC to delete a disk and selecting the option "Remove from virtual machine", this will only remove the disk from being accessible to the VM, but the actual disk will still be located on the datastore and within the .vmx file, the disk will have a present value of "false". If you want to truly delete the VM's disk, you need to select the other option, so be sure before doing so.
Let me know if you have any other questions
There are certain things which I as a user thought could add more value to this script. When taking backup to compress and store the backup in a compressed format in the remote location. makes sense?
That is a good suggestion, but unfortunately there are many options in terms of compression format/type/etc and I would leave that to the end user to implement if required.
Why dont you try to setup a solaris 10 or opensolaris box and use a compressed ZFS file system via NFS to ESXi host?
Its extremely easy - and no expensive hardware required.
i found the problem. here is the 2nd disk in the .vmx file. I can almost guaruntee you this wasn't modified by hand because I don't think the person who created it has no idea how to.
scsi0:1.filename = "datastore_1.vmdk"
the line in your script that finds the disks is
VMDKS=`grep scsi "${VMX_PATH}" | grep fileName | awk -F "\"" '{print $2}'`
it's a case issue. maybe that should be changed to a "grep -i fileName"
Yea it should be -i, but from the various .vmx file I've viewed in the past for both 3.0 and 3.5 it's always been "fileName". What version of ESX are you running btw? This is the first I've heard of this issue
esx server 3i 3.5.0 build 123629
i just reproduced this by adding a second hard disk with VIC to the virtual machine and it puts it in the vmx with filename not fileName
Hello,
I'm trying your script.
Thanks for your work.
Just a question relative to performance.
In fact i was using vcbMounter on a local datastore and on an nfs server.
Backup time for the same machine:
with vcbmount on local datastore: 7 min
with vcbmount on NFS: 13 min
With your script on local datastore: 5 min
With your script on NFS: 180 min
Have you got an explanation for this or any clue?
Regards
Tom
my first run of this script was really slow over nfs too, around 25GB per hour. i blamed that on my cheap nas device.
i don't know what vcbmounter is, but does it copy with a straight copy or does it do a clone disk like this script does?
I'm not familiar with the vcbMounter tool, YMMV with different environments and I've seen various postings about the different performance with NFS and it all depends on your configuration and the type of NFS server you're running. It should not differ with over 100+min so I'm not exactly sure what type of VM you're backing up/etc. Does this occur on all VM(s) or just this one?
Also and FYI, the VMware VCB tools that come installed by default on the ESX host are only available with the version of ESX w/Service Console, this is not part of the ESXi releaese.
Interesting, perhaps this is only with ESXi. I'll double check with my ESXi 3.5u3 and see if this is also the case, if so I'm surprised this is the first time it's been caught. I know there's quite a few people using this script on unlicensed version of ESXi. Thanks for the info
when I run the command sh ./ghetto.sh vm_list from path / vmfs/volumes/datastore1/ of esxi 3.5 returns the following error:
. / ghetto.sh:. / ghetto.sh: 76: Syntax error: word unexpected (expecting "do").
What could be the problem?
Thank you.
I'm not exactly sure what the issue could be. I suggest re-downloading the script and ensure the script has been set to execute. If you download to a Windows system, you might have some ^M characters if you tried to edit prior to executing on ESX/ESXi host. Make sure you edit it on the host themselves to ensure you don't run into this issue.
You can always run:
sh -x ghetto.sh vm_list
Thanks for your answer, the script has been set to execute and the file has been downloaded and modified with ubuntu desktop.
This is the result of the command:
/vmfs/volumes/4975d95d-45fc3458-7ff4-001b212e4341 # sh -x ghetto.sh vm_list
+
: not foundghetto.sh: 6:
+ VM_BACKUP_VOLUME=/vmfs/volumes/datastore2/backupvm/
+
: not foundghetto.sh: 9:
+ ENABLE_2GB_SPARSE=0
+
: not foundghetto.sh: 12:
+ VM_BACKUP_ROTATION_COUNT=3
+
: not foundghetto.sh: 15:
+ date +%F
+ VM_BACKUP_DIR_NAMING_CONVENTION=2009-01-22
: not foundghetto.sh: 17:
+
: not foundghetto.sh: 18:
+ POWER_VM_DOWN_BEFORE_BACKUP=0
+
: not foundghetto.sh: 23:
+ ENABLE_HARD_POWER_OFF=0
+
: not foundghetto.sh: 26:
+ ITER_TO_WAIT_SHUTDOWN=4
+
: not foundghetto.sh: 31:
+
: not foundghetto.sh: 36:
+ ENABLE_NON_PERSISTENT_NFS=0
+
: not foundghetto.sh: 38:
+ UNMOUNT_NFS=0
+
: not foundghetto.sh: 41:
+ NFS_SERVER=172.30.0.195
+
: not foundghetto.sh: 44:
+ NFS_MOUNT=/nfsshare
+
: not foundghetto.sh: 47:
+ NFS_LOCAL_NAME=nfs_storage_backup
+
: not foundghetto.sh: 50:
+ NFS_VM_BACKUP_DIR=mybackups
: not foundghetto.sh: 52:
+
: not foundghetto.sh: 53:
+
: not foundghetto.sh: 55:
+
: not foundghetto.sh: 57:
+ DEVEL_MODE=0
+
: not foundghetto.sh: 59:
+ basename ghetto.sh
+ SCRIPT_PATH=ghetto.sh
VM_FILE_INPUT\n ghetto.sh
VM_FILE_INPUT
+ exit
: not foundghetto.sh: 63: exit
+ }
: not foundghetto.sh: 64: }
+
: not foundghetto.sh: 65:
+ local BACKUP_DIR_PATH=vm_list
+ local BACKUP_VM_NAMING_CONVENTION=
+ ls -tr vm_list
: No such file or directory
+ LIST_BACKUPS=
+
: not foundghetto.sh: 70:
ghetto.sh: ghetto.sh: 76: Syntax error: word unexpected (expecting "do")
/vmfs/volumes/4975d95d-45fc3458-7ff4-001b212e4341 # sh -x ./ghetto.sh vm_list
+
: not found: ./ghetto.sh: 6:
+ VM_BACKUP_VOLUME=/vmfs/volumes/datastore2/backupvm/
+
: not found: ./ghetto.sh: 9:
+ ENABLE_2GB_SPARSE=0
+
: not found: ./ghetto.sh: 12:
+ VM_BACKUP_ROTATION_COUNT=3
+
: not found: ./ghetto.sh: 15:
+ date +%F
+ VM_BACKUP_DIR_NAMING_CONVENTION=2009-01-22
: not found: ./ghetto.sh: 17:
+
: not found: ./ghetto.sh: 18:
+ POWER_VM_DOWN_BEFORE_BACKUP=0
+
: not found: ./ghetto.sh: 23:
+ ENABLE_HARD_POWER_OFF=0
+
: not found: ./ghetto.sh: 26:
+ ITER_TO_WAIT_SHUTDOWN=4
+
: not found: ./ghetto.sh: 31:
+
: not found: ./ghetto.sh: 36:
+ ENABLE_NON_PERSISTENT_NFS=0
+
: not found: ./ghetto.sh: 38:
+ UNMOUNT_NFS=0
+
: not found: ./ghetto.sh: 41:
+ NFS_SERVER=172.30.0.195
+
: not found: ./ghetto.sh: 44:
+ NFS_MOUNT=/nfsshare
+
: not found: ./ghetto.sh: 47:
+ NFS_LOCAL_NAME=nfs_storage_backup
+
: not found: ./ghetto.sh: 50:
+ NFS_VM_BACKUP_DIR=mybackups
: not found: ./ghetto.sh: 52:
+
: not found: ./ghetto.sh: 53:
+
: not found: ./ghetto.sh: 55:
+
: not found: ./ghetto.sh: 57:
+ DEVEL_MODE=0
+
: not found: ./ghetto.sh: 59:
+ basename ./ghetto.sh
+ SCRIPT_PATH=ghetto.sh
VM_FILE_INPUT\n ghetto.sh
VM_FILE_INPUT
+ exit
: not found: ./ghetto.sh: 63: exit
+ }
: not found: ./ghetto.sh: 64: }
+
: not found: ./ghetto.sh: 65:
+ local BACKUP_DIR_PATH=vm_list
+ local BACKUP_VM_NAMING_CONVENTION=
+ ls -tr vm_list
: No such file or directory
+ LIST_BACKUPS=
+
: not found: ./ghetto.sh: 70:
./ghetto.sh: ./ghetto.sh: 76: Syntax error: word unexpected (expecting "do")
/vmfs/volumes/4975d95d-45fc3458-7ff4-001b212e4341 #
It's kind of hard to tell what's going on with the output. What system are you running this on? Which version of the script did you download? Can you also list the contents of your vm_list
Can you also try the following:
Change
also, you didn't remove the first line with #!/bin/bash did you? or you're not using some wierd shell are you?
I downloaded version ghettoVCB-enhance.sh. The contents of the list is as follows:
windows xp
ubuntu server 32bit
this change VM_BACKUP_VOLUME=/vmfs/volumes/datastore2/backupvm had no effect.
Aalso the change of value DEVEL_MOdE variable had no effect.
Are you running this on ESX or ESXi? I also noticed you're executing this script on one of your datastores, it should not matter but can you try to move the script to another location, perhaps /root. I just downloaded both scripts and they executed fine using the default and just modifying the backup path, the issue seems to be in your environment but I'm not sure what might be causing this issue.
Could you also run the following on the shell:
echo $SHELL
vmware -v
I have not touched the first line of the script and the shell I use is integrated into the system vmware ESXi 3.5.I try to move the script in the root.
The command echo $SHELL returns:/bin/ash
The command vmware -v returns:VMware ESX Server 3i 3.5.0 build-123629
Moving the file in the root me back the message: Operation not permitted
Okay so looks like you're running the the latest ESXi 3.5u3, which is the same release I just finished testing as well and I don't see any issues. Since you're running on ESXi, there will not be a directory /root, just /.
It's going to get pretty difficult to troubleshoot exactly what the issue is, for some reason the system isn't liking the script. If you understand what the script is doing or have some scripting experience, you can setup some basic echo statements and see exactly where the script stops execution. From the looks of it, it seems to get through all the user defined variables but halts right before the actual code starts. If you can narrow down on the junk of code that it fails on, perhaps I can assist you further.
Also, your two VM(s) have the following displayName?
# DO NOT MODIFY PAST THIS LINE #
exit
# DO NOT MODIFY PAST THIS LINE #
Hello,
I don't know really the difference between vcbmount and snapshots.
I know that vcbmount work on vmdk files to compact them.
The NFS server is a FreeNAS on a 2x3Ghz xeon with one disk of 300Gb 15K U320.
I'm using ESX 3.5.
I don't think it's related to nfs configuration or server performance because for the same vm and for the same nfs server the vcbmount take 13 min and your script take 180 min
And yes it's the same problem for all machines
I'm still investigating on this
Regards
Tom
Can you tell me what variables need to be changed (other than NFS_SERVER and VM_BACKUP_DIR) in order for this script to work?
Also, how can I create a script that will initiate a snapshot of each VM, store them in the NFS (for daily backups) and another script that will do a full backup of each VM?
We are using ESXi 3.5u3
Thanks
Please take a look at the documentation for your questions, it should answer majority of them.
I am not an expert in scripting and general Linux environment, I am a beginner.
Yes, my two VM(s) have that name.
Also by entering the command exit the error is always in the same line in the script
The "exit' you inserted, allowed me to see where the issue is occuring. It's telling to the script to basically exit once it hits that line. This means the error is caused during the variable declaration section before it even starts to execute.
This brings me to believe the file may have some additional characters that may not be part of the original script/etc, perhaps characters from a Windows system. Did you download this from your Ubuntu box and scp the script to your ESXi host?
Can you run the following:
wc -l ghettoVCB-enhance.sh
wc -c ghettoVCB-enhance.sh
I'm sorry, can you provide a link for the documentation?
Thanks
If you're posting in this section of the forum, you're already looking at the documentation. Please go over the instructions carefully, I do ask that new users read through the documentation before posting a question as you can answer most of your questions this way. You'll see that both your use cases can be solved by using this script and may require slight modifications, again this script is intended to help backup VM(s) that may reside on ESX/ESXi 3.5+. This script will not cover all processes/requirements for a backup or recovery scenario, I leave it to the discretion of the end user to understand what this script is doing and making modifications that fit your operating environment and needs.
You're welcome to post follow-up questions if you're still unsure of how the script operates or question about the functionality of the script. Hope this helps
Problem solved: the file ghettoVCB-enhance.sh downloaded from the link higher contains the end of each line the notorious ^M, while the other file ghettoVCB.sh is clean
Thanks to all.
William,
I was wondering if you could recommend teh best way for recovering a vm from a backup like this. Like say your esxi server blew up one day and you put a brand new one in it's place and hooked it up to the nas you had bacccked up your vms to.
most of hte instructions out there involve manually creating a vm in vic like the one you used to have, deleting it's hard drive, cloning the backup disk into your vm dir with vmkfstools -i and then adding it to your virtual machine.
since all the vm information is stored in a .vmx it seems like it should be easier to restore a vm, is it just that there aren't vm creation tools at the command line that can be used?
There are many scenarios in terms of recovery and this really depends on your requirements/environment. If you look at the simplest case where you have a new ESX/ESXi host and you present the NFS datastore which contains the backup VM(s) to the host. All you really need to do is just browse the datastore using the VIC and click into each of your VM(s) and right click and add to inventory. You should see your VM registered to the host and you can power them VM on. This assumes that want your recovered VM(s) running on your backup datastore, it's probably best to definitely copy the VM to your new host, register and power on. Going off of that, yes you'll need to copy the .vmx and copy the VMDK(s) associated with that VM and you should be using vmfkstools -i as you've suggested. Again once you understand this process manually, it's relatively easy to automate and script this process. Again, this process will vary from user to user and based on your requirements, you'll come up with a solution hat fits your environment.
Good morning,
I created the script backupvm in /usr/local/bin running:
#!/bin/sh
ssh root@192.168.100.165 "sh /vmfs/volumes/datastore1/ghettoVCB.sh /vmfs/volumes/datastore1/vm_list"
#invio promemoria
echo backup vm posmailbe del `date ‘+%d-%B-%Y’`|mail -s “backup vm posmailbe” \ aaaaaa@iol.it
I also assigned the permission of execution.
I changed the file cron as follows:
americo@ubuntuserver32:/usr/local/bin$ sudo crontab -l
When setting up a cron entry, make sure the paths to all the commands use are the fullpath.
Please take a look at this thread to ensure they are: http://communities.vmware.com/message/1151164#1151164
I believe the vmkfstools is not being passed in my script as the full path, so you'll probably have to fix at least that command.
Hello, I have a question: Is it possible to backup additional added disks too? We have the OS on disk1 and the files on disk2. Does this backupscript support this. I could not find anything and tying it only made a backup of disk1.
Another thing I would like to ask is if you know any troubles using this script wiht ESX Version 3.02.
Thank you very much - also for the hard work writing this script!
Regards
Yes, please download the latest script ghettoVCB-enhance.sh which will backup all valid VMDK(s) presented to the VM. This was added awhile back but I guess I must have forgotten to update the doc. I'll make sure I do that tonight and also remove the old instance of the script.
I just read in the comments about the grep -i fileName change...It now works ...
That's really great work you've done! Respect!
Thank you
Sorry one more stupid question - does it also work on ESX3.02? I see the note "You*'re not running ESX 3.5+ ....
Or are there known issues using the script with 3.02.
Thank you!
Hi ollivetti,
Sorry, this script only supports ESX 3.5+, the requirement is stated in the title and also noted in the body of the document. This was intentional since majority of the users were also using this on ESXi and the only common toolset between ESXi and ESX is vimsh. You probably can slightly modify it to support older version of ESX, as vimsh does exists going back to 3.0, but I have not tested that far back. You can uncomment the section of the code that blocks it from executing if you're not running either ESXi or ESX 3.5+.
lamw,
I was finally able to get the NFS setup working with WSFU (in case anyone's pulling their hairs out, make that when you configure User Name Mapping, you map the LOCAL ADMIN account (not a domain admin) to "root")
I tested with a live running VIMA and it did a full backup of the VM.
I want to modify the script to do regular snapshots, not clone snapshots. Where/What do I have to change on the ghettoVCB-enhanced.sh script?
Thanks
I'm not sure what you mean by regular snapshots, I'm aware of only one type and the snapshot can be taken with/without the state of the memory. Please look into script on where the snapshot is being taken, I believe it's documented in the script if you go through it.
What would be the procedure to restore the ghettoVCB backups?
the procedure i use is
If you just need to restore a vm to a state it was during the backup, and you still have your existing vm:
1. delete the hard drive of the vm from within vic, choosing to remove tne files from the disk as well.
2. clone the disk from backup to the directory of your vm with
vmkfstools -i /path/to/backup/disk.vmdk /path/to/vm/
3. add the hard drive to your vm choosing to use an existing virtual disk, select the /path/to/vm/disk.vmdk that you just made
If you need to restore the vm to another host or simply deleted it all together
1. make a directory /vmfs/volumes/whatever/vm-name
2. copy the .vmx file from backup to this dir
3. clone the disk from backup to the directory of the vm
vmkfstools -i /path/to/backup/disk.vmdk /vmfs/volumes/whatever/vm-name/
4. Browse the datastore in VIC, find the .vmx file, right click and select add to inventory.
not sure if theres a better way of doing it but it works for me.
How were you able to create a directory? When I try "mkdir whatever" I get: Operation not permitted.
I am logged in as "root". Am I missing something?
Thanks
Hi, first of all thank you again for your response! I see you have quite a lot of questions to answer. One thing I would like to ask because I have problems is: I am using 3.02 and don't have vmware-vim-cmd so I use vmware-cmd or shall I use vimsh -n -e to execute commands. Unfortunately the execution stops here: echo "Error: failed to extract VM_ID for ${VM_NAME}!" Does it mean that the script is looking for der VirtualMachine ID in /tmp/vms_list.
Regards
Please take a look at the vimsh documentation to understand how it works.
http://engineering.ucsb.edu/~duonglt/vmware/#vmware_vimsh
Hello
Thank you for this script! Really good work. The only thing that does not seem to work for me is backing up more than one vmdk in a vm. I tried several times with no luck. Do I have to do something special to get it to work?
Thank you for an answer.
Are you running ESXi? If so, you might need to change the line "grep fileName" to' grep -i fileName".
Multi-VMDK(s) are supported, so long they're valid and presented to the guestOS.
Yes, I am running ESXi. If I run the command:
VMDKS_FOUND=`grep scsi "${VMX_PATH}" | grep -i fileName | awk -F " " '{print $1}'`
on a cmd-sh, it gives me both scsi-vm-hdd... so thats all ok. But when I run your script, only the first (50G) HDD is backed-up, the second HD (300GB) not.
Do you have any ideas what could cause this problem?
Thank you very much!
you have to modify the script to have grep -i as well, it only uses grep without the -i which only returns matches to the exact case fileName. esxi servers sometimes have it as filename (lower case n)
Thank you for the response.
Of course I also modified the script... But still got only one vm-hdd backuped. I tried to troubleshoot in the script and what I found is the following. After the line:
grep "${SCSI_ID}.present" "${VMX_PATH}" | grep "true" > /dev/null 2>&1
it gives me the Value "1" for the second vm-hdd, which probably means it is not present??? But it is my data-disk which IS present in the vm... what do I have to modify?
Thank you.
if you get a value of 1 for that particular line, it means that within the .vmx file for the ${SCSI_ID}.present = "true". This means that the VMDK was either removed from the VM but not deleted from the filesystem or it was removed and deleted from the filesystem. In either case, the reference is left in the .vmx file and the flag is just changed from true to false.
To verify this, you can look at your .vmx file, and if the code is returning a 1, it means that disk is not present to the VM which means it should not be showing up in the VI Client when you go into it's properties unless the .vmx file has been manually modified without the ESX/ESXi knowing about it.
That seems to be strange... if you look at the content of my vmx-file:
/vmfs/volumes/497b9254-df6992a6-9fc0-0090270f57c5/Win2K3 TS # cat Win2K3\ TS.vmx
config.version = "8"
virtualHW.version = "4"
floppy0.present = "true"
nvram = "Win2K3 TS.nvram"
deploymentPlatform = "windows"
virtualHW.productCompatibility = "hosted"
tools.upgrade.policy = "useGlobal"
powerType.powerOff = "default"
powerType.powerOn = "default"
powerType.suspend = "default"
powerType.reset = "default"
displayName = "Win2K3 TS"
extendedConfigFile = "Win2K3 TS.vmxf"
numvcpus = "2"
scsi0.present = "true"
scsi0.sharedBus = "none"
scsi0.virtualDev = "lsilogic"
memsize = "1024"
scsi0:0.present = "true"
scsi0:0.fileName = "Win2K3 TS.vmdk"
scsi0:0.deviceType = "scsi-hardDisk"
ide0:0.present = "true"
ide0:0.clientDevice = "FALSE"
ide0:0.deviceType = "cdrom-image"
ide0:0.startConnected = "TRUE"
floppy0.startConnected = "false"
floppy0.clientDevice = "true"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.addressType = "generated"
guestOSAltName = "Microsoft Windows Server 2003, Standard Edition (32-bit)"
guestOS = "winnetstandard"
uuid.location = "56 4d 61 2a b1 4c 7f ca-b4 81 00 31 27 13 e1 0d"
uuid.bios = "56 4d 61 2a b1 4c 7f ca-b4 81 00 31 27 13 e1 0d"
toolScripts.afterPowerOn = "true"
toolScripts.afterResume = "true"
toolScripts.beforeSuspend = "true"
toolScripts.beforePowerOff = "true"
ide0:0.fileName = "/vmfs/volumes/497b9254-df6992a6-9fc0-0090270f57c5/Windows Server 2003/Windows Server 2003.Enterprise.German.ISO"
floppy0.fileName = "/dev/fd0"
scsi0:0.redo = ""
ethernet0.generatedAddress = "00:0c:29:13:e1:0d"
tools.syncTime = "FALSE"
sched.swap.derivedName = "/vmfs/volumes/497b9254-df6992a6-9fc0-0090270f57c5/Win2K3 TS/Win2K3 TS-af7ea147.vswp"
ethernet0.generatedAddressOffset = "0"
hostCPUID.0 = "0000000a756e65476c65746e49656e69"
guestCPUID.0 = "0000000a756e65476c65746e49656e69"
userCPUID.0 = "0000000a756e65476c65746e49656e69"
hostCPUID.1 = "00010676000208000008e39dbfebfbff"
guestCPUID.1 = "0001067800010800000802010febbbff"
userCPUID.1 = "0001067600020800000802010febbbff"
hostCPUID.80000001 = "00000000000000000000000120100000"
guestCPUID.80000001 = "00000000000000000000000000100000"
userCPUID.80000001 = "00000000000000000000000120100000"
evcCompatibilityMode = "FALSE"
scsi0:1.present = "TRUE"
scsi0:1.deviceType = "scsi-hardDisk"
scsi0:1.filename = "Win2K3 TS_1.vmdk"
scsi0:1.mode = "persistent"
scsi0:1.redo = ""
****************************************
Here you can see that scsi0:0 as well as scsi0:1 is present and true.... And I am working with this device every day, so it IS present...
Do you have any idea? Thank you very much for your help, I am really out of any guess....
Look at what the script is doing .... it's grepping for "true" ... looks like your .vmx has "TRUE", see the problem.
I'm curious on why some of the user's .vmx files are slightly different from the one's I've worked with. I'm not sure if this is due to any specific version or user's are manually modifying their files. I've always seen the right hand side use lower case values, but I have seen it few times in older releases where it's all caps. I'll try to find some time this weekend to fix those two issues, it should be using grep -i.
That should fix your issue
Thank you, it's now working like a charme!
But does somebody know how to start this script automatically with some kind of "cronjob" in ESXi? I tried the idea with "autobackup.sh" and included the "cron" directory in this script, but it does not seem to work... (Always get the following error:
diff: Can't stat '/tmp/auto-backup.237536.dir/var/spool/cron/crontabs/root': No such file or directory
which means this temporary directory/file has not been created by the script...
Thank you!
I did it by adding the following lines to /etc/rc.local
/bin/echo "0 19 5 * * /vmfs/volumes/vmback/ghettoVCB.sh" >> /var/spool/cron/crontabs/root
/bin/busybox crond -b
I believe these changes do not persist do a reboot? I remember talking to someone about this and on reboot these changes are reverted to their original configurations, including the cron entry. Is that correct?
the auto-backup.sh script which runs like every hour or so i think backs up a number of files in /etc to be persistant upon reboot. this is why things like modifying inetd.conf to enable ssh still work after reboot. /etc/rc.local is another one that changes will be saved. that is why i put the code in there to add the crontab entry on boot.
Ah good to know, I'm aware of the backup but I thought someone had mentioned earlier in another forum thread that files are not persisted through a reboot. That is good to hear, I'll try to find some time to update the doc stating that fact. Thanks
Hello
Yes, I can confirm the Backups are persistent when you write the stuff in rc.local. All runs without problems.
Thank you for all the good tipps!
First, thank for the great script lamw!
Everything works well when I do ghetto from SAN to local hard drive, but when I try gheto to NFS I get
"DiskLib_Check() failed for source disk The system cannot find the file specified (25)" after cloning and snapshot remove lasts about 2 mins with lot of "...missing *-delta.vmdk" in ESX's /var/log/messages. There is no difference with Windows or Linux NFS server - backed vmdk looks fine but I don't know is this only warning or something to worry about. It's same story with all my ESXs.
Usually when you get those warnings, it means it was not able to find the source VMDK for whatever reason. I know some user's have had issues in the past where their VMDK(s) were stored in other directories or if they had multiple VMDK(s), earlier versions of the script did not handle that use case.
The latest script should be validating that certain VMDK(s) exists prior to trying to take a backup, though if you've manually edited the .VMX file, there could be some inconsistencies in the .vmx itself. You can always try the script with a -x flag which gives detail verbosity of what's happening while the script execute and see if you can anything that's off. If it works for SAN to Local, then it should also work for NFS unless you some miss-configurations on your NFS Server (you can always manually take a snapshot and manually run vmkfstools copy manually to make sure it's working with your NFS Server)
(e.g.)
sh -x ghettoVCB.sh my_back_vm_list.txt
Thanks, I'll try.
Another thing; currently I do three kind of backups from san: daily to local hard drive (raid1), dayly to nfs (raid1) and weekly to tape. Since there is not enough space on local hard drives to do rotation, ghetto returns error every second day (and delete files then, so backup is ok tommorow). Rotation count is 0.
What can I do to make this backup daily?
Well nothing is stopping the script do run daily backups, that is up to the end user's and the setup of their cron schedule. If you're looking for more elaborate backup processes such as transfer from SAN to local, then to NFS, etc, etc. You'll need to script that process, this script is intended to help provide a backup solution for your VM(s), it's left open for any modifications/specific requirements one may have for their environment.
William,
Thanks for sharing your great scripts and knowledge.
Everyone,
Thanks for the great forum. I've learned a lot here.
We are using ESXi with an NFS datastore on Openfiler 2.3.
I've modified William's script to make ESXi "thin" disk format backups, as it was not too easy to add backups or clones of VMs back to the VM inventory when they were in 2gbsparse disk format, and I did not want to lose the disk space "thick" backups would have required.
The backups and restore/clone seem to work fine with thin format, but I feel it seems too easy. Am I missing something?
Is there any reason why I should not use William's ghettoVCB.sh script to do thin backups rather than thick or 2gbsparse?
(I realize the 2gbsparse format is more portable to other filesystems, other versions of VMware, etc.)
Thanks,
-David
First off, this is really some great work. Thank you for posting this.
But, unfortunately I am having some issues. I downloaded the file yesterday 2-12-2009, onto my ubuntu machine. I opened it with gedit and it had the ^M throughout the file. I dont know if Ubuntu did that or the file up there has them but either way I fixed it with dostounix. So I set it up and ran it on a VM with 1 vmdk file and it worked like a charm. HDD to HDD on a 10 GB VM takes consistently less than 5 mins, which is great.
I noticed another user had a similar issue too, I may have to look at the case when the VMDK(s) are stored in another datastore other than the root VM directory. I'm curious when it tries to backup the other drives, is the location correct? In terms of how it's able to backup VM(s) while it's still running is with a snapshot. When you take a snapshot, the main VMDK is changed to readonly and a new delta file is created which will contain all changes after the snapshot has been taken. This then releases a file lock on the main disk which allows you to backup the disk. Once the snapshot has been removed (committed), all changes will merge back with the primary disk. Then on the next backup, it'll do the same and those changes will be captured.
I'll take a look at the issue sometime next week ... need to spend sometime with the gf this weekend =)
The location is correct that it comes up with. It matches the same string thats in the vmx file so it almost knows its there it just cannot copy it.
Also is there a way to backup one vmdk to one location and a second vmdk to another, even though they are in the same VM?
I thought it was using the snapshot feature, but I wasnt sure. I appreciate the update, and have a good weekend!
hm ... that's interesting. If the snapshot was taken successfully, then both those disks should be unlocked. You can always manually do what the script is doing to just verify that it should work. In terms of your second question, you would need to modify the script to duplicate it to two destinations. You can always just re-run the script with a second destination as a work around.
Has anybody come up with a reliable method of monitoring this script for success/failure? Here's an idea off the top of my head for Windows users who use Kaseya/LPI for monitoring. I wouldn't have the expertise to write something like this but maybe somebody else would see value in this.
How do I run it with 2 destinations, wont it copy the first vmdk each time. So I would only end up with one of the 2 vmdks in 2 places?
Im not sure where in the script I should try manually.
Thanks for the help.
You'll have to add that logic into the script if you're looking to split your destination copy.
Many thanks for your great script!!
To everyone:
Everything works great except the output to a log file. I have a scheduled task on a windows 2003 server machine to run batch file which executes ghettoVCB.sh via plink.exe. Thanks to Raj Perumal for his blog guide.
The command looks like this:
plink.exe root@192.168.100.200 -pw mypassword "nohup ./vmfs/volumes/vmfs-storage/ghettoVCB.sh /vmfs/volumes/vmfs-storage/vmlist > /vmfs/volumes/vmfs-storage/backuplog.txt &"
After a successful backup the backuplog.txt contains not a single line and the file size is 0 btyes.
When I execute the command in a putty session the output to the backuplog.txt works great.
Any ideas whats wrong?
I have a problem.....
It all works find but VM_BACKUP_ROTATION_COUNT=1 does not do any thing.
I have now
.15_SpiceWorks-2009-02-17
.15_SpiceWorks-2009-02-16
as backups and if I run it now I get
.15_SpiceWorks-2009-02-18
any ideas?
Looks like something was modified in the script because the rotation count is kept track by a special extension "--X" ... I don't see that in your output, did you change something in the script?
Config part
VM_BACKUP_VOLUME=/vmfs/volumes/489326a8-7adbcdf8-a9f4-00188bf6e6f5
POWER_VM_DOWN_BEFORE_BACKUP=0
Code part
LIST_BACKUPS=$(ls -Atr ${BACKUP_DIR_PATH})
This is due to that my VM names are .15_Name_XXXX
BTW, wnat can I comment out in order to run all but the actual cloning of the folder?
OK, I recopied the original code.
this is my output.
~ # /ghettoVCB.sh /backup_vms
Ah, then I think you can just remove the -A param, as that ignores "." Any reason why you're naming convention is in that form? I would probably change that since that usually interpreted as hidden directories (just a thought).
I'm not sure what you mean by actual cloning of the folder? If you're asking about the rotation count, you'll need to set that = 1, it does not make sense to set it to 0.
You should give the script a read through, the logic should not be too difficult to follow and you're welcome to ask further questions. If you can manually run through this process, then the script will make more sense.
Again, this is probably due to your naming convention, so it's unable to rename the directory since it's looking for a "--X' extension. Please take a look at the previous reply for a fix or modify the way you VM directory.
Just changed the name of the VM. No .15_ as prefix.
Running the code.....
Lets see.
What I ment about cloning the folder... was that I would like to coment the part that actualy does the backup until I get the rotation count working
BTW, VM_BACKUP_DIR_NAMING_CONVENTION="$(date +%F)" is what is set for the naming.
is Date: 11/01/2008 the last version of the file? I see updates later than that
That is actually the date I started the project. The latest script will always be available in the download section
To your other comemnt, that is the naming convention that is appended to the backup directory, this can be anything but I thought having the date as part of the backup directory might be useful. This can be changed to any string you would like.
mmmm
now its creating
SpiceWorks-2009-02-18--1
I will rename to 02-17--1 and run again.
YES!!!!!!!!!!!!!!!!!!!!!!
Thanks!!!!!!!!
Now I need to just find a way to get the files of the ESXi server.
Glad to hear. Try setting up an NFS Server, it's pretty simple and this will allow you to get the VM(s) off the host to other backup or tape storage.
When I am running the script I am getting the following error:
DiskLib_Check() failed for source disk The system cannot find the file specified (25).
I turned on tracing on the script and discovered it is happening as a result of this command:
vmkfstools -i /vmfs/volumes/datastore2/OpenFiler//vmfs/volumes/4947b0ac-5b9a4e28-9b21-0011092a9380/OpenFiler/OpenFiler_2.vmdk /vmfs/volumes/Disk1/vmbackups/OpenFiler/OpenFiler-2009-02-19//vmfs/volumes/4947b0ac-5b9a4e28-9b21-0011092a9380/OpenFiler/OpenFiler_2.vmdk
Any ideas what is causing this?
Realy nice Work, but I found an Izzue ![]()
When you have multiple vmdks on different datastores in one vmx thd filename contains the fullpath to the vmdk
So the Script could not save this vmdk because it is not in the VMX_DIR Path.
I hope you understand this.
Same issue Im having. Im trying to modify the script but no success so far.
Nope, sorry you lost me.
I do have a couple of different VMs on different datastores, but I got this error when I tried to back up just one of them.
Are you saying that all my VMs need to be on the same datastore for the script to work?
Or am I just not understanding this...
My situation is my VM's have 2 vmdk files. They are both on different datastores. When I run the script only the vmdk that is on the same datastore as the vmx gets backed up. The vmdk on the other datastore does not and it gives me the same error.
Oh wait, I think I (might) get it!
So, yes the VM I am backing up also has a couple of disks which do reside on different data store.
Fortunately I do not actually need to back those up (they are storage for openfiler which I am spanning across a software RAID).
I really just need to backup the main disk associated with the VM.
So I am guessing I can just ignore this error.
If you do happen to extend the script to support this, you might consider allowing the user to specify which disks to back up and which to ignore...
Jepp, this is because the filename of the vmdk on the diffrent Datastore contains the fullPath.
scsi0:0.fileName = "Fileserver.vmdk"
scsi0:1.filename = "/vmfs/volumes/4982de6f-6ea7343b-c3c9-00221986180a/Fileserver/Fileserver_1.vmdk"
So you could not easily use the VMDK Name as source or target for copy.
You have to check first the path an the make 2 arrys VMDKS and VMDKFULLPATH
All, this has been acknowledged by a few as an issue, the current workaround is to only backup VM(s) that reside on the same datastore.
I've been occupied with other projects recently and when I get some time I'll take a look and provide a fix. If anyone has implemented a a working solution, feel free to post or send me a PM.
Anyone having issues downloading the ghettoVCB.sh from this page? I get it and it doesn't run. It shows a "Bad Interpreter" File Not Found error. It seems to be corrupt or have some control characters in it (^M). I can't see them in vim or vi and I only downloaded to a windows xp system, didnt edit it at all on windows.
It seems the ghettoVCB.sh on http://engineering.ucsb.edu/~duonglt/vmware/ and here on VMware site are different revisions, but the one from the ucsb site is working OK.
TIA.
Sorry about that, I must have forgotten to update the engineering account. They should be the same, I've uploaded the current version and can you try the download on the VMTN doc again?
If you do have a problem with the trailing "^M" line termination you can do the following to get a good version of the script:
Alright it seems the file from the vmware site still has the ^M somehow, tried the sed command and it was OK.
The file from the ucsb site is updated and Good still.
Thanks.
How to change the ghettoVCB.sh to delete the old backup before execute new backup?
Thanks.
I'm looking at the issue and basically it boils down to the SOURCE and DESTINATION path, the VMDKS array will contain either the local VMDK disk names with respect to the VM's folder which you'll need to append the VMX_PATH variable or if the disk is stored in another datastore, it'll contain the full path to the VMDK. A quick fix would to check the variable that goes through each for loop iteration to see if it starts with /vmfs/volumes, if so then you know it's a disk that's located in another datastore and setup the variable accordlying. Running through some print statements, I noticed an issue with the DESTINATION which also needs similar logic.
Though right now the issue from my basic test is the following: I have one Windows VM with 1 disk call it Quentin.vmdk which is the unique descriptor describing one of Quentin's disk that is stored in Datastore A. I know add a second disk and store i in Datastore B, I commit the changes and then look at the disk name from both the VIC and on the filesystem and what do I notice?
The name of the .vmdk is the same as disk 1, this will be an issue when backing up the disks to your destination as these filenames are no unique and will most likely over write one another. I then added a third disk two the VM and stored it in Datastore B and the .vmdk now has a unique name appended with _1.
The observation, at least on ESX w/SC (haven't tested on ESXi) if you have a VM with 1 disk and you add another and you're going to store it on another datastore the name will not be unique as it'll default to the VM's display name. This will cause a problem when backing up ... I'm trying to think of what changes would need to occur but it seems that it'll most likely requiring the modification of the .vmdk name's to the destination which may or may not be something end users want.
I'm still pondering over the issue right now over lunch ... if anyone has any suggestions I'm open, but this may be a feature that may not be supported due to the way the disk's are not uniquely labeled across datastores.
I think what would make sense would be to create folders for the datastores names and put the files there.
This would also make it a lot easier to restore since one can easily tell what when where...
Make sense?
Or more technically, retain the path relative to /vmfs/volumes
Unfortunately that does nothing for the current situation other than additional directories and a disconnect between what's listed in the .vmx file and the additional work a user would have to remove the disk reference and re-map on a backup/recovery. The solution would be too specific as some user's may want to mount the backup datastore directory whereas others would want to manually copy from the recovery datastore but not directly register the VM(s) from backup.
The more I think about this, the only decent solution is to automatically rename and update the backup VMDK(s) as they're being backed up and set them to be referenced locally within the VM's directory. This then allows a user to either mount the VM directly if he/she would need to recovery or restore from backup and have all VMDK(s) referenced properly. The only difference with VM(s) that were initially stored across multiple datastores will not be preserved (the ability to recovery may be more important than how the disks were initially stored). For further use cases, that'll be something end-users will need to customize for their enviornment.
Even if you retain the path ... what's to say a user can't bring up the original datastores, they're recovering to another ESX/ESXi host with another datastore or local. This really goes hand in hand with recovery which is going to be unique for each environment. This script will not be able to handle all those use cases, hence it's up to the end users to customize as needed for their enviornment. We're trying to generalize the process so that such customization is available if necessary.
How about the following as a compromise:
To preserve the functionality and familiarity of the script with user's that have already implemented a recovery/restore solution, I will continue to backup all VMDK(s) that are stored locally with the VM to the destination folder as you're aware of. The added fix would then support VMDK(s) that are not stored in the same datastore as the VM but in backing those VMDK(s) up to take into consideration of non-unique VMDK names provided by VMware, I would create an additional directory which will be the unique UUID of the original VMDK destination and then it would be up to the end user's to provide a solution on recovery/restoration.
This will preserve the original .vmx file as I have currently in the script and if a user chooses to restore a VM to it's initial configuration, the only added step would be to vmkfstools copy any VMDK(s) that were not stored with the VM to it's correct datastore. A user would also be able to directly mount the backup datastore but then would be required to manually update the location of the VMDK(s) that were not stored with the original VM ( this would have to be done even if the current script supported VMDK(s) across multiple datastores as your recovery .vmx file will not contain the correct paths )
Script has been updated, please let me for those that have multiple VMDK(s) across multiple datastores if this works. Thanks
It seemed to work good.
Now I have an backup of the vmdk which where on the second datastore
First of all.. thank you William and all others who have contributed to this. The script is sweet. Much faster than other scripts that use other backup methods. I am however getting speeds that are unusually slow for file transfer on an internal LAN.
I am running ESXi embedded on my host and I have a Allegro NFS Demo running on a physical server 2008 box (attempted to configure Unix on server 2008 using native Windows tools with no luck; authentication issues). The export is located on my local server 2008 storage. It's a 1.5TB Barracuda. Both boxes have Intel Gigabit Nics and are connected VIA a Linksys Gigabit switch. I tested my transfer speeds using wireshark at 15.8MBit/sec while running this script. I tested windows transfer from my guest VM to my Windows 2008 server at ~320MB/s. I know it's not my network configuration because of the results I get with Windows. Is allegro just slow as mollases? Server 2008 and Allegro Hate eachother? I know Server 2008 hates Unix (unless it's solaris 10), but thats another story.. What numbers should we expect/shoot for? What are other seeing backing up to NFS storage?
Feeling down? Need a good laugh? 100GB of data split between two VM's..
Start time: Wed Feb 25 00:16:28 UTC 2009
End time: Wed Feb 25 11:56:51 UTC 2009
Duration : 700.38 Minutes
Completed backing up specified Virtual Machines!
Quick question.
How do I restore form the Backup?
I currently store the Backup on the same Datastore.
Do I just add to Inventory and run from there? or do I move the files to the original Folder?
What happens with multiple vmdks?
mmm
I just did a backup of a server that has its OS on one DS and the data on a second DS.
The only vmdk that was backedup was the data disk. the the actual OS vmdk was not.
Please make sure you're using the latest version.
Restore can be either direct mount from your backup datastore and just register or replicate from your backup datastore using vmkfstools. I would recommend that latter, that way you don't use your backup for use but replicate it to the host for recovery/restore. The recovery/restoration process is something that is more manual and can be scripted but the requirement will be based around your requirements and should be implemented based on that.
no comment?
not really, I'm not familiar with NFS off of Windows, there are many configurations that could cause the speeds you're seeing. If you look in the forums, you'll find various comments on good/bad speeds. If you're running an NFS Server on VM, you may see speed decreases than on a physical. Your export options can also affect the speeds (e.g. sync vs async). There have been many individuals getting very good speeds and many that get less than up to par/expected. Your best bet is to ask the community for their configurations but can also be due to the hardware you're using... unfortunately when you're discussing performance, ymmv depending on your setup.
The script has nothing to do with your performance if that's what you're after.
hello all
I am backing up about 4 different vm-images each night with the script. But somethimes the snapshots are not removed after backing up and so the next time the backup of this vm will fail.
VM(s) w/Snapshots are not supported because snapshots in general should not be kept for long periods of time. They're meant to be used for quick testing and all changes should be merged back into the main VMDK as soon as possible. If you're looking to send email, a quick search online you'll find many solutions available including using default utilities like (mail or mutt) if you're on a UNIX/Linux system.
Thank you for your response. But somethimes the snapshots created by ghettovcb are not removed correctly and so the next backups are not performed anymore.
Is there a way to remove every snapshot automatically (in the script) before the new backups are performed? That would ensure that the backups run even if there are "old" snapshots.
Interesting, I haven't heard of any issues of snapshots not being removed. Are there any previous snapshots on the VM when running the backup? If so, that may cause some issues.
Currently with the method of using the vimsh there is not an option to remove all snapshots, you also don't want to automate that process of committing older snapshots without checking the state of those snapshots. Committing snapshots should be a manual process to ensure you don't revert or make any changes to the system that the Application/System owner is not aware of. Again, the script enforces the rule that if it finds any prior snapshots it will not continue. You should not be using snapshots for long durations and should commit the changes as soon as possible especially if you're looking to backup the VM(s).
I have a directory with my virtual disc and a snapshot created from ghettoVCB (not removed after the backup). When I try to:
${VMWARE_CMD} vmsvc/snapshot.remove ${VM_ID}
then I get a segmentation fault. So that seems to be the problem the snapshots are not correctly removed after the script terminates.
Any idea what could be the reason?
Hello lamw,
since your script is running now for a few weeks, I got two days ago this error:
on esxi1:
Clone: 100% done.
Powering back on ps1
bash: /vmfs/volumes/iscsi1backupdsa1/backups//ps1/ps1-2009-02-26: bad number
/vmfs/volumes/iso/backup/ghettoVCB-enhance-iscsi1.sh: /vmfs/volumes/iso/backup/ghettoVCB-enhance-iscsi1.sh: 323: Syntax error: /vmfs/volumes/iscsi1backupdsa1/backups//ps1/ps1-2009-02-26+1
on esxi2:
Clone: 100% done.
Powering back on exchange3
bash: /vmfs/volumes/iscsi1backupdsa1/backups//exchange3/exchange3-2009-02-26: bad number
/vmfs/volumes/iso/backup/ghettoVCB-enhance-iscsi1.sh: /vmfs/volumes/iso/backup/ghettoVCB-enhance-iscsi1.sh: 323: Syntax error: /vmfs/volumes/iscsi1backupdsa1/backups//exchange3/exchange3-2009-02-26+1
Plink error: Remote command failed
(Exit code 2)
I can see that your script was not removing the backup files: Backup rotation is set to: 2 and there are 3 directories now in the folder.
It looks like that only the last vm of my machinelist had this problem. I did not change anything in your script an machinelist since weeks.
Hope you have a answer.
Sorry, but where i can't find ghettoVCB-enhance.sh script?
Please download the current version of the script and manually try again and see if you run into the same issues, if not, then it could be some issues when remoting in with plink.
The current download is the most up to date version of the script, please look over the documentation if you have further questions.
Hello lamw
I updated to the latest version, but I got the same problem.
See:
I think you might have had some bad backups that were not rotated out properly which is causing some issues. Can you please move any previous backups whether they're good/bad out of that directory or purge them completely. Try a fresh backup
I deleted the complete folder with the backups and tried 3 backups only with this problematic machnine and they were running. So I delted also the other folders with
problematic machine. I have to wait now for a few days to see if everything is working again.
Just like you I wanted to log to a file.
This is what I came up with
http://communities.vmware.com/docs/DOC-9653
Thanks for the post, the logging feature will be available in an upcoming release. Stay tuned
First of all, i wish to thank for great script.
I have one suggestion. It is possible to add functionality to backup power off machines which have snapshots?
In some kind applications (like development) night downtime does not matter. But snapshots does. Thank you.
Hi hremul,
As mentioned in the previous posts, snapshots should not be kept for long durations. They can grow and left uncheck could cause issues on your datastores being filled up. If you're looking to backup VM(s) that have snapshots, best practice is to commit those changes and merge the delta files back to the VM then backup the virtual machine. There some complexity with the way the script handles removing snapshots if you're going to try to backup a VM with snapshots and partially it's a limitation with the vimsh and keeping track of the snapshots. It's best that you don't backup VM(s) with snapshots, but if you do, you'll need to make modifications to the script and that is an unsupported feature.
Hi lamw,
Thanks for a great script! I have one question though. Is it possible to change the script in such way that it can copy the backups to a datastore on a remote esxi host using something like scp?
You could append some scp commands and using paired SSH keys to remotely copy the backups to external storage or another host. There have been some threads regarding the implementation of scp on the unsupported console and the performance/speed in copying large files. You might want to take a look at a free tool by Veeam fastscp, I have not used it personally but I've heard many good things about their product. That might be a better approach if you need to copy files in/out of ESXi.
You also have the option to leverage vifs.pl from the VI Perl Toolkit default utilities, but again these are customizations that'll need to be added to your custom version of the script.
Thanks for your reply. Fastscp is a nice tool, but it is only a file copy-tool. It does not handle running vm's because it does not take snapshots.
There is also veeam-backup 3.0 now with support for esxi. The draw back of this tool is that it does not backup to a target esxi host, only local storage or san or iscsi storage. Veeam-backup makes use of the console of esx to make incremental backups of vm's and esxi of course does not have an esx-like console, so that is why it cannot use esxi as a target for its backups.
And then there is also an other tool, vm-explorer, which does do backups to other esxi hosts, but this tool does not run as a service. It is intended to be run as a user only.... For me that is not an option for a backup tool. I could run the tool with a service wrapper, to run it as a service, but i cannot test this scenario with the trial license because there is this annoying popup window, you have to click away every time you start the tool.
So it looks like i have to customize your script. Wish me luck ![]()
Jeroen
Compressing the backup is more than a good suggestion... here is why...
The VM filesystem is stored as a sparse file. When you copy that data to the network storage, you are un-sparsing it, unless you encapsulate the data into a compressed file, using compression that knows how to properly restore the sparse data.
So my 20g vm, that is really only using 270m of disk space in it's sparsely allocated file, will grow instantly to 20g using your backup system. If you restore it, or use the backup to clone in, you are no longer sparse... Instead you suddenly have a big file full of zeros. And those zeros take up network bandwidth.
The backup is not accurate if it fails to preserve the state of the stored data, and this includes the sparseness.
Sparse files are strange beasts, and programs like cp do not handle them correctly most of the time, so the moment you "forget" to handle the file correctly, it inflates to a non-sparse state. In a sparce file, an unallocated block of 0's is not stored on disk, rather the index points to null, which represents an unallocated data block assumed to be zeros. If you cat the file, the filesystem produces those 0's, but they don't really exist on disk. If you copy the file without an awareness of the sparse allocation, you end up with a huge file full of unneeded zeros... and this takes up network bandwidth as well as disk io. When you unsparse a file, there is a heavy performance cost and storage cost.
While some might say "use a compressed filesystem on the NFS server"... That does not deal with the whole issue. On a compressed filesystem you are still storing unneeded 0's, and when you move the file to a non-compressed filesystem, all that space is consumed, along with the disk io needed to write it all out. So you go from a vm that takes twenty seconds to move from one server to another using vmware's tools, to one that takes 3 hours to move. And if you depend on your network bandwidth to do work, now you have a whole lot less of it... not to mention the time lost. I in a day can move hundreds of vm's that only take 20 seconds to transit across the network... but that number falls to 8 when they take 3 hours each.
If you have 3 vm's to back up, it's a minor issue, especially if you do the backup when you sleep. But if you store the backup with the intent to clone it during work hours, it's is a big hit on productivity.
The backups need to preserve the sparseness, a sparse aware compression tool needs to be used. There are not a lot of compression tools on your ESXi system, there is one. So the suggestion that there are many options is wrong. And the suggestion that this is not an issue is misguided. And using a compressed filesystem to store the data on is also not addressing the main issue.
If you don't know what a sparse file is, you can read about it at:
http://administratosphere.wordpress.com/2008/05/23/sparse-files-what-why-and-how/
This does need to be addressed for this tool to be useful the the larger audience.
It is a great tool by the way, don't let my sparse rant take away from the fact that this tool is wonderful. My point is that compression in the utility is not as optional as you would like to think. Compression and correct sparse handling are critical.
Hi there and thank you for a wonderful script and contribution to the community!
I have two ESXi host machines that are colocated at a data center. There is a 3rd Linux backup computer with NFS on it, and I want to be able to backup the VMs running on these hosts on a regular basis. I have a 'public' WAN network (the VLAN provided by the data center that is public to the world) and a private LAN that is not private. All machines have dual NICs - one for the public WAN and one for the private LAN.
I would like to have it so that my NFS server runs the backups of all VMs using the LAN for this. I'm also sensitive to security concerns, particularly brute force attacks on SSH which are showing up routinely. As a result, all public servers on the WAN have their SSH ports changed from default ports to non-default ports, and Fail2Ban scripts installed to detect brute force login attacks on these boxes. This has been very successful so far.
I cannot install a firewall in this environment because the cost of doing so is prohibitive since I have about 20 WAN IP addresses on the VLAN. I may do this in the future when I work out how to set this up with pfSense but for now, its prohibitive as an option. Consequently every server that is WAN facing has their own local IPTables firewalls in place.
I understand from reading the posts and documentation on the ghettoVCB scripts that it appears to run from within a ESXi host which is made available through a SSH port enable on the box. As much as I would like to be able to do this, its not possible due to security concerns. I can't have default port 22 open like this. So is there a way that I can install it on my NFS server for the LAN only, and not have any of the ESXi boxes set with SSH at all?
Or if not, is there anyway to apply some 'best practice' security approach to enabling SSH on the ESXi hosts that allow for the use of non-default ports, and some form of script that could be run to thwart brute force attacks on the boxes?
Thanks again for your wonderful work, and I look forward to any comments or suggestions.
Myles
Hi Myles,
Thanks for the comments.
I wanted to get a few things cleared up and this may help you decide on how you go forward with implementing a backup solution. ghettoVCB can run on both ESX/ESXi as you know and specifically on ESXi, you'll need to enable the unsupported SSH console. This is not required for the backup to work but you'll need a way to execute the script from a remote system and currently SSH is the only method to communicate with the host to run the script.
You should also note that the unsupported SSH Console is unsupported by VMware, if you have a support contract this could potentially void the agreement. Best practice is not to enable the console, but there are certain things that is limited with ESXi if you were to just rely on RCLI or VIMA to manage and sometimes an admin may need to login to the console. It's best that you secure your environment and ensure that your hosts are not directly accessible to the public WAN network and only hosts within your environment can communicate to your ESXi host(s).
Hopefully this clears up a few things and good luck on your implementation.
Hi,
I am using ESXi 3.5 Update4 with the ghettoVCB.sh script downloaded from this website.
I trying to backup 3 machines: Ubuntu 8.10, Windows 2003 STD, Windows 2008 STD, on all 3 machines are the latest VMWare tools installed to a NFS share which is mounted.
I have tried to backup all 3 machines with putty connected to the ESXi server.
su root ./ghettoVCB.sh virtual_machine_backup_list
The problem now is that I would like to backup the machines while they are running (Online)
POWER_VM_DOWN_BEFORE_BACKUP=0
ENABLE_HARD_POWER_OFF=0
2 of the 3 machines are shut down immediately (not gracefully, its like power off) when I start the backup script.
Can anyone tell me where the problem can be?
Thanks in advance for any suggestions!
Your stated configurations and your expectations slightly contradict each other? Are you trying to perform the backup while the VM(s) are running? If so, the VM(s) should not be shutting down, unless there is some other issue with the VM(s) or host. If you're trying to backup the VM(s) and have them power down prior to backup, then you'll need to enable the appropriate flags. If you enable both flags to be 1 and you do not have VMware Tools installed on the guest, then the host will hard power off the VM after a certain duration.
Please clearly describe your scenario and setup.
Thanks for your quick answer, the 2 machines where the problem with the hard shutdown occurs have the current VMWare Tools installed, the two machines are also Powered On and running before starting the backu script.
hi:
thanks for your great script!
Hi,
I'm confused about the versions of this script. The version I downloaded today from the link in the "attachments" section of this page (or from "http://engineering.ucsb.edu/~duonglt/vmware/") is 11/01/2008:
#!/bin/bash
hi:
the author didn't modify the change log. but they are the latest version and can detect existing snapshot. i have tried that.
the attachment and the script at author's website is different files. but after filtering all the white spaces, they are the same.
Hi sky_li,
If you're running hight transactional databases, it's generally not recommended to use snapshots for backups due to transactions occurring within a DB. There is something called VSS which is available within VMware Tools that makes the guest aware that a snapshot is going to occur and it forces all data to be flushed from memory to disk, I've not used this personally and I believe it may only be available when VMware VCB is called, Duncan has an article at http://www.yellow-bricks.com/2008/07/26/vss-snapshots/
I would probably stay away from taking VMware snapshots and rely on database snapshots.
In terms of vimsh wrapper for creating snapshots, you won't find much information on any of the commands as these are not officially supported by VMware even though it provides a slew of advanced functionality.
You can always run the following for some basic info:
[root@himalaya scripts]# vmware-vim-cmd vmsvc/snapshot.create
Insufficient arguments.
Usage: snapshot.create vmid [snapshotName] [snapshotDescription] [includeMemory]
Creates a snapshot for the vm.
Hi Guido,
As tbsky stated, the latest script is currently available for download on this page. The date within the script may be a little miss-leading, it's actually the date that I started develoment of the script. The chanelog on the other hand is accurate in terms of the changes that have taken place since the release of the script and again the latest download will always be available on the VMTN document download page.
I'll ensure that both the script on the VMTN and on our website is the same, sorry for any confusion
Hi Guido,
As tbsky stated, the latest script is currently available for download on this page. The date within the script may be a little miss-leading, it's actually the date that I started develoment of the script. The chanelog on the other hand is accurate in terms of the changes that have taken place since the release of the script and again the latest download will always be available on the VMTN document download page.
I'll ensure that both the script on the VMTN and on our website is the same, sorry for any confusion
hello lamw
I ve got a server to backup which has only space for one backup at a time. Now your
script does first the backup and then rotates/deletes the old backups. This means, in
some time during the backup there are to backups on the disc...
Would it be possible to just move the "rotate"-function to the beginning of your script
and do the backup after rotating/deleting the old backups? Or can you see any problems?
Thank you,
ibhp
hi lamw:
i am just curios. "quiesced windows snapshot" seems become complete at 3.5 update 2 with sync+vss driver. but the link you give me tell us stay away from exchange,ad,sql. then i don't know what this "quiesce" function for.
also there seems some version of snapshot command line have "quiesce" option, like the link mentioned:
http://www.esxguide.com/esx/index.php?option=com_mambowiki&page=createsnapshot&page_heading=&show_pageheading=&allowanonymoususers=
but it seems the new command line version didn't have the "quiesce" parameter, only "memory" option is left. i wonder if the snapshot is quiesced automatically now, or the option is because "quiesced" may bring problems.
someone said that if you do a "quiesced snapshot", ms-sql log will tell you.i haven't any real ms-sql server running in the vm now. maybe i can check that in the future.
The reason I put the rotate function after the backup is to ensure we have a good backup prior to rotation, especially in the case of just rotating once. I would say please ensure that you have sufficient space for all backups
Yea I'm not too familiar with the expected behavior of VSS other than asking the VM to flush its data from memory to disk. I just know from reading on the VMTN forums from other experts it's not recommended to using VMware snapshots on VM(s) like databases and if you do, you'll need to look into VSS which is only available per VMware VCB (I think). You may need to run a few tests to see the behavior and I would actually recommend posting a question regarding this on the main VMTN forum and I'm sure an expert familiar with the process can provide further insight.
Hi lamw,
First of all, thx for this great script! I have a question though and hope that the following might also be possible with your script: can you specify a vmdk within a vm that you want to backup? I would like to backup only one vmdk of a vm that is on the same datastore. So basically I want to exclude all the other vmdk's that are attached to this vm and stored on a different datastore. Is this possible?
Thank you,
Pietcur
Specific VMDK disk(s) backups are not supported, only full backups. You're more than welcome to modify the script to fit your needs.
hi:
i am considering put all the windows pagefile and linux swap file to a separate vmdk file. so i can skip backing up them in the future. would you consider implement this feature? or would you consider receive patch?
thanks for your help!!
Thanks for the script.
Shouldn't the script bypass the creation of a snapshot if the guest is in a powered down state? Seems like extra work to take a snapshot and then merge the snapshot back into the base when the machine is already static.
Also, I got the following error while backing up a guest that was powered off:
/vmfs/volumes/datastore1/scripts # ./ghettoVCB.sh single_vm
################ Taking backup snapshot for Windows XP 32bit Base ... ################
DiskLib_Check() failed for source disk Insufficient permission to access file (38).
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/Development/Windows XP 32bit Base/winxp-32bit-base.vmdk'...
Clone: 16% done.
The clone appears to have worked, however out of all the guests that I backed up, that was the only one that echoed the DiskLib_Check() message.
I notice that the script also doesn't appear to take into consideration whether or not a vmdk is thinly provisioned. (as previously mentioned by ddigioia)
I could alter the command:
vmkfstools -i "${SOURCE_VMDK}" "${DESTIONATION_VMDK}"
to
vmkfstools -i "${SOURCE_VMDK}" -d thin "${DESTIONATION_VMDK}"
But:
a) is there a way for the script to identify if a vmdk is thin, and if so add '-d thin'
b) is there any danger in storing thin clones? maybe why the script doesn't already do the previous
You know I think this was something I had missed when dealing with the option of allowing a user to configure the shutdown of a guest, I think I might have forgotten to take into consideration the current state of the VM. You're right, this may be a bug. Majority of the user's I've spoke to that have used the script are running live backups and would not run into the issue, but it's a good point and I'll ensure the next update of the script is fixed.
Thanks for bringing it to my attention
At the time, we were not looking at using thin provision backups, it does not hurt and provides optimized storage consumption (hence probably why vSphere officially supports it now)
Your modifications will work and thinly provision disks upon backup, also a note when you're backing up to NFS datastore, it'll automatically thin provision the disk for you AFAIK
a) You can look at the descriptor file and you'll find a line that says: ddb.thinProvisioned = "1"
b) In terms of backup, there is are no dangers, better storage utilization. In terms of running thin provision VM(s), you just need to be aware of your storage utilization and with ESX 3.5, there are not sufficient monitoring on the datastores to notify you as VM(s) start to fill up, with vSphere there are better notifications/reports.
In an upcoming release of the script all 3 backup types will be supported zeroedthick, thin and 2gb sparse
Thanks for the comments
hi:
please consider add "monolithic sparse" also. with that you get a small,single vmdk file.
backup tools like rdiff-backup can compare two versions for a file and only backup the difference.
with "monolithic sparse" single vmdk file, backup tools can easily backup many versions of vms with little harddisk space.
Hello community
I have a win2k3 server running on a ESXi-host with 2 virtual harddrives attached. Now one time the backup runs correct (backing up both virtual harddrives) and the other time it backs-up only the first virtual harddrive (every second time only one virtual hdd is backed-up). This looks like this:
Failure:
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/First_750GB_HD/Win2K3 TS/Win2K3 TS_1.vmdk'...
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/First_750GB_HD/Win2K3 TS/Win2K3 TS.vmdk'...
Clone: 100% done.
*******************************
Success:
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/First_750GB_HD/Win2K3 TS/Win2K3 TS_1.vmdk'...
Clone: 100% done.
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/First_750GB_HD/Win2K3 TS/Win2K3 TS.vmdk'...
Clone: 100% done.
*******************************
Any idea what this could be caused from?
Thanks for any help!
Hi everyone,
We're proud to announce the release of ghettoVCBg2 the next gen of ghettoVCB. You can find more information located at: http://communities.vmware.com/docs/DOC-9843
Hope you guys like it!
I've just upgraded my ESXi from 3.5 to 4.0 and the old ghetto script doesn't work.
Infact if I connect with putty and launch the script:
./ghettoVCB.sh weekly
I receive
-ash: ./ghettoVCB.sh: not found
I can't use the new script ghetto2 because I have the free version of ESXi
Can someone help me?
ghettoVCB has not been tested/certified for ESX(i) 4.0, we've been pretty busy and just have not had the time to test. This holds true for variety of other scripts and some will fail due to changes in vSphere release. In general, I think the script should work and it does not utilize anything that is not already available in ESXi 4.0, make sure the permissions on your script is set to executable. I'll try to do a quick run tonight and post back.
The error is telling you that ghettoVCB.sh doesn't exist in your current directory.
Was your ghettoVCB.sh script on a datastore or on one of the OS file systems? If it wasn't on a datastore, the version 4 upgrade probably wiped it.
Copy it back to a datastore and execute it from there and see if it will work with v4.
Okay, just got ESXi 4.0 installed as a VM on our ESX 4 (physical) and I see the problem, looks like there was some change to their shell environment and if you didn't know the busybox console runs on ash ... kinda like bash. It looks like it has a problem when you try to do the following:
./ghettoVCB.sh
-ash: ./ghettoVCB.sh: not found
#!/bin/ash
ash ./ghettoVCB.sh
Ok now I can launch the script but I have these errors:
/vmfs/volumes/48c6a14e-37156b78-c647-001a925eca7c # ash ./ghettoVCB.sh weekly
Error: failed to extract VM_ID for 2008Termi!
Error: failed to extract VM_ID for al
Assiste!
Error: failed to extract VM_ID for zaVista2!
Start time: Wed May 27 06:51:45 UTC 2009
End time: Wed May 27 06:51:48 UTC 2009
Duration : 3 Seconds
Completed backing up specified Virtual Machines!
I ran a quick test earlier and realized some of the code may need to be updated. I have not had a chance to dig further on what needs to be modified.
Have you had a chance to try out ghettoVCB4i.sh to see if the issues are resolved?
Thanks for the great script. I finally have an option for backing up my ESXi (free) 4 VMs. I downloaded ghettoVCB4i.sh and attempted to use it but encountered a problem where all of my VMs with the letter 'n' in the name where causing an error. This is similar to the issue described by freez267 above. I don't fully understand why but commenting out the line
IFS=$'\n'
appeared to resolve the issue for me. I am not sure what this line does.
Thanks
Tony Russell
That's odd... it should work, I've verified on our ESXi 4 system.
I am running this on ESXi 4. I have tried to follow the directions very closely but I keep getting a Permission Denied error every time I try to actually run the script. Any suggestions?
Did you change the permissions on the script to have executable permissions?
chmod +x ghettoVCB4i.sh
I continue to have this error
Error: failed to extract VM_ID
On the VMs that have 'n' in the name. For example is impossible to backup the VM '2008Terminal' and 'AssistenzaXp' but no problem with 'W7RC'
I just created some dummy VM(s) using the names you've specified and it looks like the environment is not treating $'\n' as a newline char but the literal char 'n'. This cause the loop to break off once it sees the first char 'n' and a VM with the name: "2008Terminal" will be chompped into "2008Termin" and "al" which neither of which will match, hence it fails. If you specify a list of VM(s) w/o 'n' then the backup is successful. This is pretty odd and I'll have to look into it some more.
You said if you remove the IFS=$'\n', everything works?
That is exactly what happened in my case. If I commented out that line, it worked fine.
Looks like the newline needs to be defined in the following manner:
IFS='
'
Hi,
Thanks for a fantastic script. Works well, but I have a problem with the rotation. Anyone with a clue why it won't work? See output from a sh -x command (last bit):
Cloning disk '/vmfs/volumes/HB-ESXi2-scsi1/HB-Label/HB-Label.vmdk'...
Clone: 100% done.
+ IFS=
+ ! 0 -eq 1
+ /bin/vim-cmd vmsvc/snapshot.remove 256
+ echo Removing snapshot from HB-Label ...
+ ls /vmfs/volumes/HB-ESXi2-scsi1/HB-Label
+ grep -q delta
+ sleep 3
+ ls /vmfs/volumes/HB-ESXi2-scsi1/HB-Label
+ grep -q delta
+ sleep 3
+ ls /vmfs/volumes/HB-ESXi2-scsi1/HB-Label
+ grep -q delta
+ checkVMBackupRotation /vmfs/volumes/Thecus/Backup/HB-Label /vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-06-07
+ local BACKUP_DIR_PATH=/vmfs/volumes/Thecus/Backup/HB-Label
+ local BACKUP_VM_NAMING_CONVENTION=/vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-06-07
+ ls -tr /vmfs/volumes/Thecus/Backup/HB-Label
+ LIST_BACKUPS=HB-Label-2009-05-31
HB-Label-2009-06-05
HB-Label-2009-06-07
+ -z 4
+ TMP_DIR=/vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-05-31
+ echo /vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-05-31
+ TMP=/vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-05-31
+ /vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-05-31 = /vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-06-07
+ /vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-05-31 -ge 4
sh: /vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-05-31: bad number
+ echo /vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-05-31
+ BASE=/vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-05-31
/vmfs/volumes/Thecus/Script/HB-Label/ghettoVCB.sh: /vmfs/volumes/Thecus/Script/HB-Label/ghettoVCB.sh: 340: Syntax error: /vmfs/volumes/Thecus/Backup/HB-Label/HB-Label-2009-05-31+1
/vmfs/volumes/46df116f-b561be9a/Log #
I had a similiar Problem here an a ESX Server 3.5:
At first: Script works well from the Root-Shell...
But, when i Plan the Script via Crontab, the Script starts, make's the Snapshot, Backup the *.vmdk and *.vmx File in a newly created Folder BUT at the End of the Backup the Script don't rename the Folder in correct manner.
Script stopped working. I have to rename the Folders manually in correct Name und Numbers and have to remove the Snapshot manually from ESX Server's VI Client.
The Script only Backups the First VM in the Backup List and after Backup stopped working !
mfg
Ritchy059
I've running an ESXi 4.0 Server.
The backup does function well. But there is one problem wich is descibed by other persons above. It is the empty log file. Is there a solution for it or not? At the moment I see through all folders if the backup success. But that can't be the final solution.
Further the current version of ghettoVCB4i.sh runs great if there are no whitespaces in the vm name. Otherwise the rename after backup fails and because of that the backup rotation fails too. So I've removed all whitespaces in VM names like lamw describes as best practice ![]()
Thanks lamw for his great work... really really usefull script!!
For those interested in logging, maybe this helps you:
Run the script like this
sh ghettoVCB.sh vmlist.txt 2>&1 | busybox logger -t ghettoVCB -p 1
and then, push ESXi logs to a remote syslog-ng server.
Does this backup method copy the vmdk to the same vmfs volume and to get it offsite you would have to download the backup vmdk file from the datastore?
You could just mount a NFS volume and select that as the destination for the backup. That's what we do. Works great.
Quick question... I am running ghettoVCB.sh on ESXi 3.5 and its working great on most of my VMs. However I have a VM that seems to have a snapshot associated with it. I checked in the datastore, and there was a 'delta' file there. I powered down the VM and then deleted the delta file. Powered it back on, and then attempted to run ghettoVCB.sh. It again wouldn't do the backup because it said that there was a snapshot there. I checked it again, and the delta file had returned...
I know this isn't a specific question of ghettoVCB, but how do I get rid of these snapshots so I can do a clean backup of a live VM?
You shouldn't delete deltas by hand. Instead, remove snapshots from VIC.
Deltas track changes to the main vmdk, but information about snapshots are kept in vmsd files.
Unfortunately I only have my one ESXi box at home with 1 HDD in it and my desktop so I have no NFS volume to mount ![]()
So for me, does that mean that this script just backs up the running vmdk and I would need to manually download it?
If that is the case the primary function of the script would be to reduce downtime as otherwise I would need to power down the VM and copy the vmdk correct?
Great script! Thank you so much... We are backing up 4 ESXi 3.5 servers successfully with about 6VMs each.
There is only one problem to backup a Debian Linux 60GB virtual harddisk. Snapshot seems to be OK. Backing up the disk (one of two) failed after some time with the following error message.
Taking backup snapshot for DEASX401 ... ################
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/datastore1/DEASX401/DEASX401_2.vmdk'...
Clone: 79% done.Failed to clone disk : Insufficient permission to access file (38).
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/datastore1/DEASX401/DEASX401.vmdk'...
Clone: 100% done.
Removing snapshot from DEASX401 ...
Completed backup for DEASX401! ####################
Start time: Wed Jul 1 06:45:27 UTC 2009
End time: Wed Jul 1 09:21:51 UTC 2009
Duration : 156.40 Minutes
Completed backing up specified Virtual Machines!
Might it be possible that the disk is to big? Is there any timeout?
Here some more information:
./ghettoVCB.sh is running with root account!
backup disk mouted vie NSF from a Win2003R2 server
share is an external 1GB USB disk
nsf shared folder is windows compressed (can save until 75% of original space)
Regards,
Bjoern
Hi !
Very great Job !
I try to use it under ESXi 4.0 (last release) but I encountered a problem. I logged it :
+ SOURCE_VMDK='/vmfs/volumes/Datastore 1/Fedora 9_Nagios_Centreon//usr/lib/vmware/isoimages/linux.iso'
+ DESTIONATION_VMDK='/vmfs/volumes/NFS_GED//Fedora 9_Nagios_Centreon/Fedora 9_Nagios_Centreon-2009-07-08//usr/lib/vmware/isoimages/linux.iso'
+ ''
+ vmkfstools -i '/vmfs/volumes/Datastore 1/Fedora 9_Nagios_Centreon//usr/lib/vmware/isoimages/linux.iso' '/vmfs/volumes/NFS_GED//Fedora 9_Nagios_Centreon/Fedora 9_Nagios_Centreon-2009-07-08//usr/lib/vmware/isoimages/linux.iso'
DiskLib_Check() failed for source disk The system cannot find the file specified (25).
Someone could help me ?
Sorry for the delay of response but I've been extremely busy over the last month and I currently do not have the cycles to look into the current issues. I'm aware there are some interesting problems being faced that may all be related. I will provide some more details when I get a chance to take a look at the issue hopefully in a few weeks after my VCP4 exam. Thanks for your patience
Hello lamw,
I used your script since a long time without problems (great work any many thanks), but yesterday we changed to esxi4.0 and I changed to your latest ghettovcb4.x version.
Like others I get this error:
+ vmkfstools -i /vmfs/volumes/5fbd225c-3cf7a7b1/xpsp2.iso /vmfs/volumes/iscsi2backupdsa1/backups/endiancfg/endiancfg-2009-07-13/5fbd225c-3cf7a7b1/xpsp2.iso/xpsp2.iso
DiskLib_Check() failed for source disk The file specified is not a virtual disk (15).
your script tries to backup the iso file of the cdrom. Why ? I there a way to disable it or is it only a bug ?
Also if the cdrom is a phys. cdrom of the host I get this disklib errors.
So my workaround now is to remove the complete cdrom from the vm hardware. Not nice but working.
The harddiskbackup is still working
Hope you will find a solution, because I check my backup logs automatically for the word failed and error and that
CDrom problem will prevent my autolog check from correct running.
Hello everybody,
I am trying to do the backup of a esxi with this script, it is working perfecty, but I need to backup the vm´s with rdp too.
I have tried the ghettoVCBg2.pl without success.
Anybody has the code to add to the script to backup the vm´s ignoring the rdp?
Thanks a lot for yor help!
Regards.
Jose
Same problems with cdroms and same solution of "shechtl".
I have to delete the cdrom on some VM to complete the backup
Hello,
In terms of the strange path pointing to an ISO file I had the same behaviour and after removing all mounted CD on all VM's it was gone.
My experience about the "DiskLib_Check() failed for source disk" error message in a ESXi3.5 environment is that the error is caused when the backup loop in the script executes "vmkfstools -i "${SOURCE_VMDK}" "${DESTIONATION_VMDK}".
During first cycle in the loop of a new VM the Source_VMDK and Destination_VMDK do not point to files, they point to folders and this is causing not supported by the vmkfstools. I am not a shell developer but this is how it looks to me.
Hi.
I just upgraded the scripts for 4.0 and get this error on one of 2 VM one the box.
RDM was found for 14_MSCLink_TestOS_Win2k8, backup will not take place
ah.
Found the comment at the begining of the doc.
Sorry!
BTW, the VM has 2 disks, one virtual and one RAW. Is there a way to backup the virtual one?¿
Hi everyone, I've just pushed out an update to both ghettoVCB.sh and ghettoVCB4i which should fix the issue with the script trying to backup .iso when you have a mounted CD-ROM, this should not be an issue anymore and supports backing up w/o having to remove the CD-ROM device.
I've also added 2 additional VMDK output format and added a new variable to support the various types:
# Format output of VMDK backup
# 1 = zeroedthick
# 2 = 2gbsparse
# 3 = thin
# 4 = eagerzeroedthick
VMDK_OUTPUT_FORMAT=1
I am running this script with VMWare ESXi 3.5 and it works great. Well almost. One of my VMs is a Linux based file server that has a small vmdk for itself, and also uses NFS mounted disk storage for the bulk of its storage. I only want the local vmdk to be backed up in this case. Is there a way, on a per VM basis, that you can set preferences to only backup the local vmdk of a vm with this script if there are remote storage (NFS or iSCSI) for the vm that you don't want backed up?
Hope that makes sense.
Myles
Not a supported feature of the script, you're more than welcome to modify to fit your needs or create separate backup jobs. Remember, the script itself is providing a generic backup solution, if you need something more specific you'll need to make those changes.
I can certainly create separate backup jobs for this particular VM, but if I understand the way this works, I'd have to not only create a separate file with the target VM to backup, but I'd also have to create a modified ghettoVCB.sh script to tell it to only backup the specified vmdk files, right? That's ok, but it obviously requires a programming change in the way that the script determines what to backup by VM. Just before I launch down that path (which I'm fine with doing), I just wanted to make sure that there wasn't a preference property already available in the standard ghettoVCB.sh script that would cater for this...
Myles
Yes, you'll need to add some type of logic to on figuring out which VMDKs to backup and not backup and have a way to specify that in either a local configuration file stored within each VM or a config file read into the script. There's nothing in the script today that supports the request you're talking about, good luck.
Hello,
Can anyone tell me best way to determine a ghettoVCB backup is running on a ESXi?
Beside this what is the best way to stop a backup process and how do I have to performe this?
I do not have any problems with the scripts so far, but would like to know how to kill things without messing up my whole ESXi.
Thanks in advance for a reply.
maweko
To check if the process is running, from ssh:
ps|grep ghettoVCB.sh
To kill the process:
kill -9 id_from_above
If you kill it, remember to manually remove snapshots using VirtualCenter or whatever you use, don't delete snapshot files by hand.
Thank's for the info.
Tested it on my ESXi 3.5 U4 and although a backup process is actually running the ps does not display any process with name "ghettoVCB.sh" .
That's a bit confusing.
I started the backup with ./ghettoVCB.sh "vmlist file"
Any ideas
I've tested the new version of the script. I try to create thin format for the backup. But although it creates flat format vmdk's. Where could be problem?
thanks in advance for a reply.
Adrian
I think "thin" provisioning for post vSphere ESX(i) 4.0 may not act in the way people expect, I certainly haven't played with thin provisioning too much. I need you to do the following two things:
1) What is the script configured to, meaning what value did you set the VMDK_OUTPUT_FORMAT, default is 1 which is zeroedthick
2) On the VM that was backed up thin, can you go into the folder and cat out the .vmdk file and NOT the *-flat.vmdk
3) When running the backup, can you do it manually and see if you see a screen output similar to this:
~ # ./ghettoVCB4i.sh vmbackuplist
################ Taking backup snapshot for ghettoVCB4i-test-vm-backup ... ################
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/datastore1/ghettoVCB4i-test-vm-backup/ghettoVCB4i-test-vm-backup.vmdk'...
Clone: 100% done.
Removing snapshot from ghettoVCB4i-test-vm-backup ...
#################### Completed backup for ghettoVCB4i-test-vm-backup! ####################
Hi Lamw,
I changed now to your new version with the cdrom fix. It works with most of our machines, but there is one vm where I got problems.
Its the only VM with Win98 and a ide hdd (I know Win98 but its a must)
If I start the script, the scripts makes a snapshot and removes the snapshot after that immediately, but no disks will be copied.
I think the problem is ide. With the old version backup is running but only without the cdrom.
Here is the relevant part of the log:
+ IFS=
+ echo ide0:0
+ SCSI_ID=ide0:0
+ grep -i ide0:0.present /vmfs/volumes/iscsi2dsa1/samwin/samwin.vmx
+ grep -i true
+ 0 -eq 0
+ grep -i ide0:0.deviceType /vmfs/volumes/iscsi2dsa1/samwin/samwin.vmx
+ grep -i scsi-hardDisk
+ 1 -eq 0
+ IFS=
+ vim-cmd vmsvc/power.getstate 224
+ tail -1
+ ORGINAL_VM_POWER_STATE=Powered on
+ 0 -eq 1
+ [ ! 0 -eq 1 ]
+ [ Powered on != Powered off ]
+ echo ################ Taking backup snapshot for samwin ... ################
+ date +%F
+ vim-cmd vmsvc/snapshot.create 224 vcb_snap VCB_BACKUP_samwin_2009-07-21
+ OLD_IFS=
+ IFS=:
+ IFS=
+ [ ! 0 -eq 1 ]
+ [ Powered on == Powered on ]
+ vim-cmd vmsvc/snapshot.remove 224
+ echo Removing snapshot from samwin ...
Removing snapshot from samwin ...
+ ls /vmfs/volumes/iscsi2dsa1/samwin
+ grep -q delta
ls: /vmfs/volumes/iscsi2dsa1/samwin/samwin-000001.vmdk.lck: No such file or directory
+ sleep 3
+ ls /vmfs/volumes/iscsi2dsa1/samwin
+ grep -q delta
+ [ 0 -eq 1 ]
+ TMP_IFS=
Okay, I see the issue. This should hopefully be fixed now in the latest version of the script. Give it a run and let me know how it goes.
/vmfs/volumes/4965afe0-76fbdae2-48e3-00221952c5db # ls
ANTHEAFILESThin PieraVMThin TimbratureVMThin
ANTHEAR10TEST R10INTERNO ghettoVCB4i.sh
AntheaDom R9SVP weekly
IvanoVMThin RosalbaVMVistaThin weekly2
/vmfs/volumes/4965afe0-76fbdae2-48e3-00221952c5db # sh ghettoVCB4i.sh weekly2
Are you using the latest version of the script? Also if you have the right permissions set, you don't need to execute with "sh", you should do something like this:
./ghettoVCB4i.sh weekly2
First of all, thanks to all who have had a part putting this script together. I'm very new to VMWare and Linux, and this has all been such a huge help. However, I'm having the same issue as adiXSG. I have a Linux VM that I have given a thin disk, and I have uploaded the most recent version of the ghettoVCB4i.sh script, choosing option 3 for thin disk format. However, the output is "servername-flat.vmdk" and the file size is 100 gigs, not the 5.2 or so gigs that it should be (the size of the original thin .vmdk file).
I hope I'm describing this properly, does anyone know what the problem could be? Thanks!
Please take a look at this response http://communities.vmware.com/docs/DOC-8760#comments-11794 and provide the requested output
I'm running the latest version of the script. I tried with ./ghetto..... but the problem remain.
The file have the rights "rwxr-xr-x"
If I change DEVEL_MODE I receive this information
/vmfs/volumes/4965afe0-76fbdae2-48e3-00221952c5db # ./ghettoVCB4i.sh weekly2
(vim.fault.DuplicateName) {
dynamicType = <unset>,
faultCause = (vmodl.MethodFault) null,
name = "VMBACKUP",
object = 'vim.Datastore:192.168.111.23:/VMBACKUP',
msg = "The name 'VMBACKUP' already exists.",
}
##########################################
Virtual Machine: IvanoVMThin
VM_ID: 448
VMX_PATH: /vmfs/volumes/datastore1/IvanoVMThin/IvanoVMThin.vmx
VMX_DIR: /vmfs/volumes/datastore1/IvanoVMThin
VMX_CONF: IvanoVMThin/IvanoVMThin.vmx
VMFS_VOLUME: datastore1
##########################################
##########################################
Virtual Machine: PieraVMThin
VM_ID: 432
VMX_PATH: /vmfs/volumes/datastore1/PieraVMThin/PieraVMThin.vmx
VMX_DIR: /vmfs/volumes/datastore1/PieraVMThin
VMX_CONF: PieraVMThin/PieraVMThin.vmx
VMFS_VOLUME: datastore1
##########################################
##########################################
Virtual Machine: TimbratureVMThin
VM_ID: 400
VMX_PATH: /vmfs/volumes/datastore1/TimbratureVMThin/TimbratureVMThin.vmx
VMX_DIR: /vmfs/volumes/datastore1/TimbratureVMThin
VMX_CONF: TimbratureVMThin/TimbratureVMThin.vmx
VMFS_VOLUME: datastore1
##########################################
##########################################
Virtual Machine: RosalbaVMVistaThin
VM_ID: 416
VMX_PATH: /vmfs/volumes/datastore1/RosalbaVMVistaThin/RosalbaVMVistaThin.vmx
VMX_DIR: /vmfs/volumes/datastore1/RosalbaVMVistaThin
VMX_CONF: RosalbaVMVistaThin/RosalbaVMVistaThin.vmx
VMFS_VOLUME: datastore1
##########################################
I don't see anything wrong from the output, is this the only VM you're having problems with? Can you ensure there are no left over snapshots from the script?
Ok, I hope I'm being clear, please let me know if you need clarification:
1) For VMDK_OUTPUT_FORMAT, I set the value to 3 for thin disk
2) I'm not sure what you mean by this. Can you provide instructions on how to "cat out" the .vmdk file? I do see two vmdk files, one is the -flat file (100 gigs) the other is servername.vmdk but is only 1k.
3) When running the script, I do see that output and the line "Destination disk format: VMFS thin-provisioned"
I also was able to clone the disk manually using the following command, which appears in the ghettoVCB4i.sh script:
#vmkfstools -i /vmfs/volumes/san_vmfs/my_vm/large_disk.vmdk -d thin /vmfs/volumes/san_vmfs/my_vm/new_thin_disk.vmdk
That command worked in converting the vmdk to a thin disk, so I'm not sure why the script isn't.
I'm sure no snapshot on the VM.
I have the same problem on another VM with different OS.
The backup process seems to work fine. Infact it arrive at 100% and the file created seems correct.
Maybe the problem is when try to cancel the old folder backup or the snapshot.
I've spent the past 2 hours or so reading through this thread from start to finish!! Incredibly valuable help from all!
However, I have a few questions that I feel have not been asked/answered.
1. I access my ESXi host remotely with HP iLO via VPN. Am I correct in saying that I can copy the script from my remote system to the ESXi system WITHOUT enabling the unsupported mode and/or SSH if I use vCLI with command vifs?
2. Maybe I have missed something, but where do you actually store the ghettoVCB script? It seems that you can choose to store it on external or internal storage. I am interested in internal, but where is the appropriate location?
3. I understand that most users are starting the script from another system via SSH. This is well explained, but I am interested in scheduling the script from within the ESXi host. Now there are a few references to crontab (new to me) and some suggestions on how to set this up. Some say edit rc.local and others are doing something like this
*echo "0 2 * * 6 /vmfs/volumes/vmiscsi/tools/ghettoVCB4i.sh" > /var/spool/cron/crontabs/root*
However, the different approaches have me confused, so William could you please add a section at the top with the "best practice" of configuring a crontab to run the script or post a recommendation?
Thanks for an excellent free backup solution!!
voro can you please elaborate on how to push ESXi logs to a syslog server and what the advantages are (I'm new to this)? I found a virtual appliance http://www.syslogappliance.de/en/ would this work if it resides on the same ESXi host?
Thanks
3) If you want to schedule it without keeping a ssh session open or using a remote system, you have to use ESXi's crond. Busybox's crond is limited and adding that line in /var/spool/cron/crontabs/root is the only way, but it will be lost upon rebot. That's why some suggest adding that echo in rc.local
About Remote logging
When looking at the actual size of thin provisioned disk, if you do 'ls -lha', it will not show you the actual disk consumption. So by running the conversion in a script or from the CLI, it should yield the same results. Are you sure you're using the same VM and doing one backup and then doing it from the CLI to ensure you're looking at the same VM? You'll be able to see the actual consumption if you do something like 'du -h' since ESXi unsupported console does not have 'du' nor 'vdf'.
Here is an example:
I have a VM that is allocated thick with 8gb:
/vmfs/volumes/4a59c382-f2feee8e-0280-005056825b84/ide-vm # ls -Falh
drwxr-xr-x 1 root root 980 Jul 25 12:06 ./
drwxr-xr-t 1 root root 1.2k Jul 25 12:03 ../
-rw------- 1 root root 8.0G Jul 21 19:36 ide-vm-flat.vmdk
-rw------- 1 root root 440 Jul 21 19:36 ide-vm.vmdk
-rw------- 1 root root 0 Jul 21 19:36 ide-vm.vmsd
-rwxr-xr-x 1 root root 1.5k Jul 21 19:36 ide-vm.vmx*
-rw------- 1 root root 261 Jul 21 19:36 ide-vm.vmxf
/vmfs/volumes/4a59c382-f2feee8e-0280-005056825b84/ide-vm # df -h
Filesystem Size Used Available Use% Mounted on
visorfs 278.2M 243.3M 34.9M 87% /
nfs 1.3T 789.7G 558.7G 59% /vmfs/volumes/d32c5a97-e039bdbf
vfat 4.0G 384.0k 4.0G 0% /vmfs/volumes/4a59c381-8059e09f-33a3-005056825b84
vfat 249.7M 76.2M 173.5M 31% /vmfs/volumes/7db9337b-a328f52c-2a05-87d4ed7807df
vfat 249.7M 4.0k 249.7M 0% /vmfs/volumes/eb676f73-6dd0961e-3224-09791e2c7199
vfat 285.9M 230.2M 55.7M 81% /vmfs/volumes/c2a427e4-2d317086-fef9-b5750d88536c
vmfs3 15.0G 9.4G 5.6G 62% /vmfs/volumes/4a59c382-f2feee8e-0280-005056825b84
/vmfs/volumes/4a59c382-f2feee8e-0280-005056825b84/ide-vm # vmkfstools -i ide-vm.vmdk -d thin ide-vm-THIN.vmdk
Destination disk format: VMFS thin-provisioned
Cloning disk 'ide-vm.vmdk'...
Clone: 100% done.
/vmfs/volumes/4a59c382-f2feee8e-0280-005056825b84/ide-vm # ls -Falh
drwxr-xr-x 1 root root 1.2k Jul 25 12:08 ./
drwxr-xr-t 1 root root 1.2k Jul 25 12:03 ../
-rw------- 1 root root 8.0G Jul 25 12:08 ide-vm-THIN-flat.vmdk
-rw------- 1 root root 494 Jul 25 12:08 ide-vm-THIN.vmdk
-rw------- 1 root root 8.0G Jul 21 19:36 ide-vm-flat.vmdk
-rw------- 1 root root 440 Jul 21 19:36 ide-vm.vmdk
-rw------- 1 root root 0 Jul 21 19:36 ide-vm.vmsd
-rwxr-xr-x 1 root root 1.5k Jul 21 19:36 ide-vm.vmx*
-rw------- 1 root root 261 Jul 21 19:36 ide-vm.vmxf
/vmfs/volumes/4a59c382-f2feee8e-0280-005056825b84/ide-vm # df -h
Filesystem Size Used Available Use% Mounted on
visorfs 278.2M 243.3M 34.9M 87% /
nfs 1.3T 789.7G 558.7G 59% /vmfs/volumes/d32c5a97-e039bdbf
vfat 4.0G 384.0k 4.0G 0% /vmfs/volumes/4a59c381-8059e09f-33a3-005056825b84
vfat 249.7M 76.2M 173.5M 31% /vmfs/volumes/7db9337b-a328f52c-2a05-87d4ed7807df
vfat 249.7M 4.0k 249.7M 0% /vmfs/volumes/eb676f73-6dd0961e-3224-09791e2c7199
vfat 285.9M 230.2M 55.7M 81% /vmfs/volumes/c2a427e4-2d317086-fef9-b5750d88536c
vmfs3 15.0G 9.4G 5.6G 62% /vmfs/volumes/4a59c382-f2feee8e-0280-005056825b84
/vmfs/volumes/4a59c382-f2feee8e-0280-005056825b84/ide-vm # vmkfstools -i ide-vm.vmdk ide-vm-THICK.vmdk
Destination disk format: VMFS zeroedthick
Cloning disk 'ide-vm.vmdk'...
Failed to clone disk : There is not enough space on the file system for the selected operation (13).
Question: I know that ghettoVCB.sh will skip a backup if any snapshots exist. We have a couple of ESXi servers that we never use snapshots on. Is there any danger in modifying the script to forcibly remove any snapshots with the script if it finds any and then do the backups? I know that the script can remove snapshots - I just don't want backups skipped if they were attempted before, and the script failed for some reason, leaving the VMs in a state where they can be never backed up afterwards unless there is some manual intervention to remove the snapshots.
Myles
The script should always remove all snapshots that 'it' creates so long as you don't intervene or manually tweak with a VM during the backup process. I'm not exactly sure what you mean your initial statement, of ESXi servers that never use snapshots. The backup process requires snapshots as you know OR you have the option of powering off the VM before backup. If you're worried for some reason that snapshots may be left behind for whatever reason, you of course could modify the script in such a way to loop through all VMs and removeallsnapshots, but you will receive no support if you do make such modifications. If you follow all requirements and you've verified before implementing ghettoVCB, you should not have any issues with VMs having snapshots in the first place and they should all be removed prior to moving to the next VM.
Hopefully this cleared up your concerns, also if this was an issue, I'm sure I would have heard from many others about it ![]()
Thanks again.
Hmm, are my questions too trivial that no one wants to respond? I'm not asking just for the sake of it. There are many repeat questions/ answers not just here, but on any forum. However, like I said I have gone through this thread diligently and I couldn't find answers to what may be simple questions. I'm sure others would benefit.
Well, I look forward to some response, so I can better understand how to use this. Thanks
Hello Lamw,
thanks for your work. All backups are running ok now.
The best free backup script ever written was the VISBU
The main important features were
1. Backup vm mentioned based on criteria powered on or off only
2. compress the backup
3. restore script included
Important features
1. Specify which vmdk's can be backed up in a vm for example we have a few vm's that have vmdk and an rdm so we specify the backup to only backup the vmdk and skip the rdm from the vm
2. CIFS/NFS/LOCAL DESTINATION
Unfortunately its no longer available, will this script have all the features and become the best free script to work on esx/esxi without any license needed from vmware ?
Please take a look at the documentation (this document) for the features provided with this script, if you can not find it, then it does not exists.
"Error: failed to extract VM_ID"
The solution is:
Check this fields on the VMX file:
displayName = "Vmname"
extendedConfigFile = "vmname.vmxf"
Both need be the same, example:
displayName = "vmname"
extendedConfigFile = "vmname.vmxf"
Hi,
i am using ghettoVCB4i.sh on ESXi 4.0.0 171294 and have some problemes with white spaces in VMs names.
While executing the Script i get the following errors:
ls: /vmfs/volumes/Storagesrv01_backups//itorga: No such file or directory
ls: backuptrigger: No such file or directory
ls: /vmfs/volumes/Storagesrv01_backups//dnie: No such file or directory
ls: workstation: No such file or directory
The names of the virtual machines are: "itorga backuptrigger" and "dnie workstation"
I checked the IFS:
IFS='
'
I think that the error occures in Line 314:
echo "Removing snapshot from ${VM_NAME} ..."
while ls "${VMX_DIR}" | grep -q delta;
do
sleep 3
done
Does anybody has an idea how to fix this? I can't rename all VMs.
Thanks,
Stephan
For those of you who are trying to run the script via chronjob:
The problem is the empty space, on the name of virtual machines. Remove it.
Hi tnol2,
as i said: i can't rename all the VMs
Hi!
Since there much more activity now here I want to ask you again if there is any idea about the problem posted several weeks ago.
We are using the 3.5 version of ghettoVCB.sh. If you need any more details - just let me know....
*-------
We are backing up 4 ESXi 3.5 servers successfully with about 6VMs each.
There is only one problem to backup a Debian Linux 60GB virtual harddisk. Snapshot seems to be OK. Backing up the disk (one of two) failed after some time with the following error message.
Taking backup snapshot for DEASX401 ... ################
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/datastore1/DEASX401/DEASX401_2.vmdk'...
Clone: 79% done.Failed to clone disk : Insufficient permission to access file (38).
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/datastore1/DEASX401/DEASX401.vmdk'...
Clone: 100% done.
Removing snapshot from DEASX401 ...
Completed backup for DEASX401! ####################
Start time: Wed Jul 1 06:45:27 UTC 2009
End time: Wed Jul 1 09:21:51 UTC 2009
Duration : 156.40 Minutes
Completed backing up specified Virtual Machines!
Might it be possible that the disk is to big? Is there any timeout?
Here some more information:
./ghettoVCB.sh is running with root account!
backup disk mouted vie NSF from a Win2003R2 server
share is an external 1GB USB disk
nsf shared folder is windows compressed (can save until 75% of original space)
*------
Again, I'll tell you the same thing I told you awhile back, there are no known issues of timeout or VMDK being too large so long as you're under the < 2TB range.
The error dictates this to be a permission issue and not anything with the script. I would highly recommend you manually do a backup by hand to ensure that you are in fact able to backup using vmkfstools and isolate the problem that may be occuring.
Thank you. It seems I was not able to read your answer before.
I will try to do it manually using vmkfstools and give you feedback.
Hi,
I think you can greatly reduce the down time of a VM when you power it off before doing the backup by doing this:
1 - take down the VM
2 - create a snapshot
3 - restart the VM
4 - start the backup (without the snapshot files)
5 - remove the snapshot while the VM is on
The VM is down only the time to do the snapshot
what do you think of this ?
Majority of the use cases is live backup of a running VM, I don't know of many environments that can actually afford to take down their VMs/physical systems for backups. Again this option is present in the script if you wish to power down your VM, in which case a snapshot is NOT required as the VMDK is not locked. A snapshot is only necessary when it's running and a VMFS lock is issued and a snapshot will create a delta in which the main VMDK will be set to read-only allowing for the backup.
I do agree with you that usually, it's not possible to stop VM to do backups.
But you're script give the option to stop VM before backing up.
My post was just a little idea to try to minimize the down time of a VM IF you can stop it, and don't have to wait that the tons of gigs of the VMDK files be copied before restarting the VM.
How does GhettoVCB handle VMs that have virtual hard disks on two different volumes?
Thanks!
ghettoVCB handles it like a champ ![]()
If you take a look at this document, it provides a list of features, one of which is:
Normally the vmdks are stored with the VMs. When the backup of a VM with a second vmdk on a different disk, does ghetto move the secondary vmdk files into the same directory as the other vmdk?
It moves the VM's VMDK(s) to the backup datastore, it does not matter if the VMs disk is spread across multiple datastores. The way it's stored in the final backup is if the original disk reside on multiple datastores, the backup folder will have a directory for each of the datastore and the disk will be backed up into that directory.
I would highly recommend trying the script out on a dummy/test VM to see what the script is capable of.
I think there has been quite a bit of confusion on Thin Provisioning, not only with this script which has supported this feature for awhile but also in the general forums.
Within the guestOS, it may show free/unsused space but it does not mean that blocks have not been allocated in the past that could have used up more space than it's showing. Remember, when you delete something, you're just not referencing it anymore, it's still there. Blocks within the OS needs to be zeroed out and this is explained in detail from Mr. 007 himself Duncan Epping at: http://www.yellow-bricks.com/2009/07/31/storage-vmotion-and-moving-to-a-thin-provisioned-disk/
Thin provisioning does work using vmkfstools but you need to ensure you've zeroed out any unused blocks before actually see this when trying to backup or even convert a VMDK.
Hopefully this clears things up
Hi,
i am using ghettoVCB4i.sh on ESXi 4.0.0 171294 and have some problemes with white spaces in VMs names.
While executing the Script i get the following errors:
ls: /vmfs/volumes/Storagesrv01_backups//itorga: No such file or directory
ls: backuptrigger: No such file or directory
ls: /vmfs/volumes/Storagesrv01_backups//dnie: No such file or directory
ls: workstation: No such file or directory
Any ideas?
Tanks, Stephan
Hi William,
Thanks for such a great script!
Were using it in an ESXi 3.5 environment. I have presented 380GB iSCSI storage to the host as a datastore.
Ive used Starwind to create the iSCSI target.
When I run the script I get:
/bin # ./ghettoVCB4i.sh servers.txt
Invalid desination disk format 'zeroedthick'
Removing snapshot from (servername)
The remove snapshot hangs.
There are no lingering snapshots or backups on the server Im testing.
Ive tried changing the format output but get same message with relevent storage type name instead of zeroedthick.
Any clues as to why this is failing?
Thanks,
Perry.
Well one thing that should worry you is Invalid desination disk format 'zeroedthick', it looks like you might have not setup the right destination format. Please take a look at the document for instructions on how to set the output VMDK format (note, it's configured as 1,2,3,4)
Hi William,
Thanks for such a great script!
Were using it in an ESXi 3.5 environment. I have presented 380GB iSCSI storage to the host as a datastore.
Ive used Starwind to create the iSCSI target.
When I run the script I get:
/bin # ./ghettoVCB4i.sh servers.txt
Invalid desination disk format 'zeroedthick'
Removing snapshot from (servername)
The remove snapshot hangs.
There are no lingering snapshots or backups on the server Im testing.
Ive tried changing the format output but get same message with relevent storage type name instead of zeroedthick.
Any clues as to why this is failing?
Thanks,
Perry.
Spaces in a VM name is bad! ![]()
Anyway, I think I know is wrong and I just uploaded a new revision of ghettoVCB4i.sh which should fix the issue.
Here is a sample run in our development environment:
/vmfs/volumes/4a59c382-f2feee8e-0280-005056825b84 # ./ghettoVCB4i.sh backuplist
################## Starting backup for ghettoVCB4i-test-vm-backup ... #####################
Destination disk format: VMFS zeroedthick
Cloning disk '/vmfs/volumes/datastore1/ghettoVCB4i-test-vm-backup/ghettoVCB4i-test-vm-backup.vmdk'...
Clone: 100% done.
#################### Completed backup for ghettoVCB4i-test-vm-backup! ####################
################## Starting backup for itorga backuptrigger ... #####################
Destination disk format: VMFS zeroedthick
Cloning disk '/vmfs/volumes/datastore1/itorga backuptrigger/itorga backuptrigger.vmdk'...
Clone: 100% done.
#################### Completed backup for itorga backuptrigger! ####################
################## Starting backup for dnie workstation ... #####################
Destination disk format: VMFS zeroedthick
Cloning disk '/vmfs/volumes/datastore1/dnie workstation/dnie workstation.vmdk'...
Clone: 100% done.
#################### Completed backup for dnie workstation! ####################
Thank you! There are no more error messages.
Has anybody seen this message?
ls: /vmfs/volumes/raid/bktst1/bktst1-Snapshot148.vmem.MULTILOCK: No such file or directory
However, backup gets done (snapshots are created and deleted successfully and the disk image can be added to the inventory)
so I guess ESXi is to blame rather than the script.
Backup log file containing no information problem
The problem is in the Windows batch file. Do something like this and it will work:
"C:\Program Files\PuTTY\plink.exe" root@xxx.xxx.xxx.xxx -pw MyPassword "/vmfs/volumes/datastore1/ghettoVCB/ghettoVCB4i.sh /vmfs/volumes/datastore1/ghettoVCB/backup_list > /vmfs/volumes/datastore1/ghettoVCB/backuplog.txt &"
nohup is the problem
Hi,
I'm trying to get the script up and runing and already took some hurdles but now I'm getting the following error while trying to backup first vm :
Failed to open '/vmfs/....mydisk.vmdk' file : failed to lock the file ( 16392 )
I have ESXi 4.0. The VM I'm trying to backup is located on a separate NFS box ( netgear readynas pro ). The vm is not powered on.
Any ideas ?
thx
Resolved: The VM I tried to backup as test was actually booted on the main ESXi host ! ( Oops..).
When I use one that is not in use, the script runs correctly.
Dirk
Is anyone else getting the ^M characters on the downloaded script? I downloaded it onto my NFS share and when I open it up in VI from ESXi, it shows all the lines have the ^M characters in them - it has never been opened on Windows. It is the script straight from this website. Otherwise, any ideas on removing them?
Should mention it is the ghettoVCB.sh script.
I'm using ESXi and I was using one NFS datastore for backups successfully. I recently switched the NFS storage to a new server, but I'm getting an error. I've tried doing just one server at a time, from 3 different esxi boxes, but it always fails after a few minutes. Are there any logs I can check to get a better idea of what's happening, or whether this is a network issue? thanks. Here is what I get:
/vmfs/volumes/4a6efadf-c0cc9be4-7146-000d601a03f2 # ./ghettoVCB4i.sh vmbackups
1. Taking backup snapshot for myserver... ################
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/datastore1/myserver/myserver.vmdk'...
Clone: 66% done.Failed to clone disk : Input/output error (327689).
Removing snapshot from myserver...
ls: /vmfs/volumes/VM_Backups/myserver: Input/output error
1. Completed backup for myserver! ####################
Start time: Thu Aug 13 19:02:33 UTC 2009
End time: Thu Aug 13 19:22:47 UTC 2009
Duration : 20.23 Minutes
Completed backing up specified Virtual Machines!
One other note:
I am getting an error saying I am not running 3.5 or 4. (I am running 3.5.0, 158869).
It appears that modifying the version check in the script to use print $5 instead of print $4 has fixed the problem.
dos2unix.org works good to remove the ^M characters.
This should not be the case, I've downloaded the most recent version directly to the ESX(i) host several times and it's been fine. Are you using ESXi 3.5 or ESXi 4.0? With 4.0, it comes with 'curl' and you can donwload it to the host directly.
This is due to a network connectivity issue, ensure you're not saturating your NFS link. Take a look at this VMware KB: http://kb.vmware.com/kb/2116375
I am using 3.5, so I am downloading it on a Windows host NFS share (not opening it).
I had the old script working fine, but am just upgrading to support my future 4 upgrade. Using that website, I did get it to work, just wanted to make sure the file on the server was correct. I'll just chalk it up to my Windows machine somehow.
Which script is giving you this issue? I think this was fixed in the latest ghettoVCB.sh
It's good if you're downloading from this VMTN document.
Hi
I am using your script to backup thin provisioned disks to an NFS on a windows machine however when they are backed to the nfs datastore they switch to flat full size vmdk files. I have tried the sdelete script as suggested to zero out all the data and also created new virtual machines however it still does the same. Is this set-up supported or is there anything I could be doing wrong.
Thanks
What version of ESX(i) are you running and how big is the VMDK allocated and how much is actually being consumed from the guestOS perspective? afaik, when transferring to NFS datastore, it'll alaways be thin provisioned. One other thing I would double check is to check the NFS datastore free space before the backup and then after and see if it's changed, even if the VMDK shows the full size when doing 'ls -lha'
Is there a modification where we can backup other vmdk in a vm and skipping only rdm disk instead of skipping the whole vm.
It was ghettoVCB.sh downloaded from above on 8/13/09.
You've only answered the first question .... what about the rest?
I would like to propose the addition of a RUN_AFTER variable. The ability to serialize operations is invaluable.
Example: After the first set of backups you need another that backs up to a different destination and you want to append the output to the same log. After the final backup, you want to sendmail the log content. etc.
The current as of 8/16 script checks the ESXi version. It appears to reject ESXi 3.5 or 4.
Also I have a three disk VM. The vmx file contains the path (/vmfs/volumes/9d044c9e-6965e94b etc) to the original third disk. The third disk was cloned to the 9d044c9e-6965e94b folder within the backup folder. I will run it again to make sure.
You can easily create something similar by setting up a cronjob that executes a file that contains the various backups that you've defined, which can be in a sequential order which accomplishes what you're looking for. This is not a backup request but a scheduling request.
e.g.
cat my_backups
/root/ghettoVCB.sh /root/backuplist1
/root/ghettoVCB.sh /root/backuplist2
/root/ghettoVCB.sh /root/backuplist3
The code check might be denying 3i, but 4i is working. I'll have a fix for the string later this evening.
What version of ESX(i) 3.5 and 4.0 are you using?
Can you please output the following for ALL ESX(i) host's you're using the script against by doing the following"
vmware -v
I noticed it on 4 with the latest patches. Sorry I can't get to the 4 server right now.
on the 3 server VMware ESX Server 3i 3.5.0 build-120505
Not my server but I will update and re run.
Just updated the server.
VMware ESX Server 3i 3.5.0 build-176894
/vmfs/volumes/4d074c9e-6965e94b/scripts # ./ghettoVCB.sh backup.daily
You're not running ESX(i) 3.5+ or 4.0+!
ESX_VERSION=$(vmware -v | awk '{print $3}') Should be print $5
Yes, I'm aware of the 3i issue and I'll have an update later this evening. I'll still be using $3 but doing a different check for 3i since with 4i, they've gone back to the version number.
I have a vm with 2 vmdks one of them is a raw disk , how can I only skip that disk instead of skipping the whole vm ?
A terrific script lamw. thanks very much for posting. I am using the latest script and cannot get it to backup BOTH VMDKs for a VM. The script will always backup the 'myvmname.vmdk' but not the 'myvmname_1.vmdk'. After injecting some echo's in the script I have learning the following:
The VMDKS_FOUND variable returns the follwoing: scsi0:0.filename scsi0:1.filename ide0:0.filename
This is a known issue, I'll be pushing a fix later this week. Sorry for the inconvenience. The reason this is occurring is due to a variable declaration that is not defined within the script and this definition is crucial to the looping of the VMDK(s) within the script. If you would like to remediate this yourselves, you can edit the script and add the following to line 193:
original code:
IFS='
'
ORIG_IFS=${IFS}
IFS='
'
Thanks William - this appears to work perfectly!
Appreciate your time in posting
Anyone know why I would get a Your not running ESX(i) 3.5 or 4.0 when running the ghetoVCB.sh script. I am running Esxi 3.5 update 176894? This should work right?
Yes, see comments above:
DSTAVERT says: in response to: DSTAVERT
ESX_VERSION=$(vmware -v | awk '{print $3}') Should be print $5
That did not work, I still get:
ghettoVCB.sh: ghettoVCB.sh: 460 : 3i: not found
You're not running ESX(i) 3.5+ or 4.0+
The logic regarding the version check is as the following:
Pre-ESX(i) 4.0, the text would read something like the following when executing vmware -v "VMware ESX Server 3.5.0 build-163429", to get the major release you'll print out column #4
Post-ESX(i) 4.0, VMware decided to rebrand their hypervisor and remove the word Server from vmware -v and if you run this on 4.0 box you'll get "VMware ESX 4.0.0 build-164009" and as you can see, you'll need to now print out column #3
This gets interesting as with 3i, the version was not 3.5.0 but "3i" and again with 4i, this was not the case and we're back to just "4.0.0".
I have 4 ESX systems I use to verify/test this script agains, unless this oddity is occuring in another release, I've tested this against:
ESX 3.5u4
ESXi 3.5u4
ESX 4.0
ESXi 4.0
and they all sucessfully pass the check and execute backups.
Let me explain the logic, so everyone can understand, since others are thinking we need to print out other columns which is not the case:
First off, I check for 4.0.0 which uses col #3, since both ESX and ESXi 4.0 use the same version (no 4i crap), I first see if it's 4.0. If it's not, then I assume it's running 3.5 which can be any of the various flavor/updates + ESXi, in which case, it's column #4. I redefine the ESX_VERSION variable to capture the new version and then check for either 3.5.0 (classic ESX 3.5) or 3i (ESXi) and this should cover all the use cases.
ESX_VERSION=$(vmware -v | awk '{print $3}')
if [ "${ESX_VERSION}" == "4.0.0" ]; then
VER=4
else
ESX_VERSION=$(vmware -v | awk '{print $4}')
if [[ "${ESX_VERSION}" == "3.5.0" || "${ESX_VERSION}" == "3i" ]]; then
VER=3
else
echo "You're not running ESX(i) 3.5+ or 4.0+!"
exit
fi
fi
Hi William,
vmware -v outputs VMware ESX Server 3i 3.5.0 build-153875
Code i'm running looks like
ESX_VERSION=$(vmware -v | awk '{print $3}')
if [; then
VER=4
else
ESX_VERSION=$(vmware -v | awk '{print $4}')
if [ || [; then
VER=3
else
echo "You're not running ESX(i) 3.5+ or 4.0+!"
exit
fi
fi
Can you please wrap your text output in \{code\} tags and actually do the following instead:
sh -x ./ghettoVCB.sh <your_input_list>
Unmodified script outputs following:
/scripts # sh -x ghettoVCB1.sh backup_list
+ VM_BACKUP_VOLUME=/vmfs/volumes/backup/tempest
+ VMDK_OUTPUT_FORMAT=1
+ VM_BACKUP_ROTATION_COUNT=3
+ date +%F
+ VM_BACKUP_DIR_NAMING_CONVENTION=2009-08-19
+ POWER_VM_DOWN_BEFORE_BACKUP=0
+ ENABLE_HARD_POWER_OFF=0
+ ITER_TO_WAIT_SHUTDOWN=4
+ ENABLE_COMPRESSION=0
+ ENABLE_NON_PERSISTENT_NFS=0
+ UNMOUNT_NFS=0
+ NFS_SERVER=172.30.0.195
+ NFS_MOUNT=/nfsshare
+ NFS_LOCAL_NAME=nfs_storage_backup
+ NFS_VM_BACKUP_DIR=mybackups
+ DEVEL_MODE=1
+ IS_4I=0
+ [ ! -f /bin/bash ]
+ sanityCheck 1
+ NUM_OF_ARGS=1
+ [ ! 1 == 1 ]
+ [ -f /usr/bin/vmware-vim-cmd ]
+ [ -f /bin/vim-cmd ]
+ VMWARE_CMD=/bin/vim-cmd
+ VMKFSTOOLS_CMD=/sbin/vmkfstools
+ vmware -v
+ awk {print $3}
+ ESX_VERSION=Server
+ [ Server == 4.0.0 ]
+ vmware -v
+ awk {print $4}
+ ESX_VERSION=3i
+ [[ 3i == 3.5.0
sh: missing ]]
+ 3i == 3i ]]
ghettoVCB1.sh: ghettoVCB1.sh: 460: 3i: not found
+ echo You're not running ESX(i) 3.5+ or 4.0+!
You're not running ESX(i) 3.5+ or 4.0+!
+ exit
Sorry to double post here, but I seem to fail at editing ![]()
Currently running code
ESX_VERSION=$(vmware -v | awk '{print $3}')
if [ "${ESX_VERSION}" == "4.0.0" ]; then
VER=4
else
ESX_VERSION=$(vmware -v | awk '{print $4}')
if [ "${ESX_VERSION}" == "3.5.0" ] || [ "${ESX_VERSION}" == "3i" ]; then
VER=3
else
echo "You're not running ESX(i) 3.5+ or 4.0+!"
exit
fi
fi
+ VM_BACKUP_VOLUME=/vmfs/volumes/backup/tempest
+ VMDK_OUTPUT_FORMAT=1
+ VM_BACKUP_ROTATION_COUNT=3
+ date +%F
+ VM_BACKUP_DIR_NAMING_CONVENTION=2009-08-19
+ POWER_VM_DOWN_BEFORE_BACKUP=0
+ ENABLE_HARD_POWER_OFF=0
+ ITER_TO_WAIT_SHUTDOWN=4
+ ENABLE_COMPRESSION=0
+ ENABLE_NON_PERSISTENT_NFS=0
+ UNMOUNT_NFS=0
+ NFS_SERVER=commander.swerve.co.nz
+ NFS_MOUNT=/nfsshare
+ NFS_LOCAL_NAME=nfs_storage_backup
+ NFS_VM_BACKUP_DIR=mybackups
+ DEVEL_MODE=1
+ IS_4I=0
+ [ ! -f /bin/bash ]
+ sanityCheck 1
+ NUM_OF_ARGS=1
+ [ ! 1 == 1 ]
+ [ -f /usr/bin/vmware-vim-cmd ]
+ [ -f /bin/vim-cmd ]
+ VMWARE_CMD=/bin/vim-cmd
+ VMKFSTOOLS_CMD=/sbin/vmkfstools
+ vmware -v
+ awk {print $3}
+ ESX_VERSION=Server
+ [ Server == 4.0.0 ]
+ vmware -v
+ awk {print $4}
+ ESX_VERSION=3i
+ [ 3i == 3.5.0 ]
+ [ 3i == 3i ]
+ VER=3
+ [ 0 -eq 1 ]
+ [ ! -f ]
+ whoami
+ [ ! root == root ]
+ ghettoVCB backup_list
+ VM_INPUT=backup_list
+ date
+ START_TIME=Wed Aug 19 00:38:32 UTC 2009
*snip*
Completed backing up specified Virtual Machines
The output for my version
VMware ESX Server 3i 3.5.0 build-120505
3.5 is in the fifth column not fourth. It could be that VMware is "messin witcha".
That's precisely why the code checks for both "3.5.0" (4th column on ESX) and "3i" (4th column on ESXi)
The code didn't check for 3i and 3.5. When I reported a problem on the 16th the code read
if ; then VER=3
Okay, I see what's going on and I've pushed a 'fix' for the issue.
Looks like I had two internal versions and the one I was working on had the following (which works):
if [ "${ESX_VERSION}" == "3.5.0" ] || [ "${ESX_VERSION}" == "3i" ];
if [[ "${ESX_VERSION}" == "3.5.0" || "${ESX_VERSION}" == "3i" ]];
Here is my output
+ VM_BACKUP_VOLUME=/vmfs/volumes/Backup/VMBack_Daily
+ VMDK_OUTPUT_FORMAT=2
+ VM_BACKUP_ROTATION_COUNT=1
+ date +%F
+ VM_BACKUP_DIR_NAMING_CONVENTION=2009-08-19
+ POWER_VM_DOWN_BEFORE_BACKUP=0
+ ENABLE_HARD_POWER_OFF=0
+ ITER_TO_WAIT_SHUTDOWN=4
+ ENABLE_COMPRESSION=1
+ ENABLE_NON_PERSISTENT_NFS=0
+ UNMOUNT_NFS=0
+ NFS_SERVER=172.30.0.195
+ NFS_MOUNT=/nfsshare
+ NFS_LOCAL_NAME=nfs_storage_backup
+ NFS_VM_BACKUP_DIR=mybackups
+ DEVEL_MODE=1
+ IS_4I=0
+ ! -f /bin/bash
+ sanityCheck 1
+ NUM_OF_ARGS=1
+ ! 1 == 1
+ -f /usr/bin/vmware-vim-cmd
+ -f /bin/vim-cmd
+ VMWARE_CMD=/bin/vim-cmd
+ VMKFSTOOLS_CMD=/sbin/vmkfstools
+ awk {print $5}
+ vmware -v
+ ESX_VERSION=3.5.0
+ http:// 3.5.0 == 4.0.0
+ vmware -v
+ awk {print $5}
+ ESX_VERSION=3.5.0
+ [[ 3.5.0 == 3.5.0
sh: missing ]]
+ 3.5.0 == 3i ]]
ghettoVCB1.sh: ghettoVCB1.sh: 460: 3.5.0: not found
+ echo You're not running ESX(i) 3.5+ or 4.0+!
You're not running ESX(i) 3.5+ or 4.0+!
+ exit
Great script. Has been really useful. I particularly like the new output format option.
New Script works like a charm, thanks very much for the assistance
np. Thanks for the feedback
awesome to hear! Thanks for your feedback
Lamw is there a way to only backup the root disks? I have some VM's with disks on different datastores which I do not want to include in the backup, as they only contain user data and get backed up with a regular windows backup agent.
I agree that would be a helpful addition.
For vmdks that are on different datastores it would be useful to run sed against the vmx file to remove the "/vmfs/volumes/${DS_UUID}/" so that the vmx file doesn't point to the original disk.
Really sorry that this probably keeps you up nights. I do voluntary support for a small college and I know that they really appreciate your efforts. I do as well.
Thanks
You can easily create something similar by setting up a cronjob
When I try to do something like this work from a batch file, and schedule it, the second backup never executes.
"C:\Program Files\PuTTY\plink.exe" root@10.17.127.132 -pw MM6ufG6eg "/vmfs/volumes/datastore1/ghettoVCB/ghettoVCB4i.sh
/vmfs/volumes/datastore1/ghettoVCB/backup_list > /vmfs/volumes/nas-2/log/s2-backuplog.txt2 &"
"/vmfs/volumes/datastore1/ghettoVCB/ghettoVCB4iSingle.sh" "/vmfs/volumes/datastore1/ghettoVCB/backupSingle_list >>
/vmfs/volumes/nas-2/log/s2-backuplog.txt &"
If I do them in two separate batch files, and call plink a second time and guess how much time I need for the first one before calling the second one, these same commands work, but that's not reliable since it's tough to know how long the first one will take.
A) You're using an old version of the script, I would highly recommend using the latest as it has fixes/updates to any previous issues/bugs.
B) If you can do this manually and it's successful, then this is an issue with your scheduling.
C) I don't know how you're scheduling them on Windows, but to avoid contention, you should schedule these to be in sequential order and as I've suggested several times, instead of manually calling each of these backups, have a script that call these two backups sequentially and all you run is just one single script which contains these two within the file.
>You're using an old version of the script<
The script was downloaded from here on August 6. I'll check if you have anything more current than that. It's so named to match the calls in the batch file that was created for an earlier version of the script.
>one single script which contains these two within the file<
Rather than both in the same batch file script. I could try that.
Thanks!
T_Architect
You could add some simple conditional things to the ghettoVCB script. I add the following to the ghettoVCB script to have a weekly copy in another datastore. It wouldn't be hard for you to add other conditionals.
if [ "$(date +%A)" = "Saturday" ]; then
VM_BACKUP_VOLUME=/vmfs/volumes/somewhere_else
else VM_BACKUP_VOLUME=/vmfs/volumes/sameplace
fi
# start
rm /tmp/list
vim-cmd vmsvc/getallvms | awk -F " " '{print $2}' | sed '1,1d' > /tmp/currentvms
for i in `cat /tmp/currentvms` ;do
awk -v var=$i -F, '$1==var' /vmfs/volumes/nfs-datastore/scripts/globaltobecloned >> /tmp/list
done
/vmfs/volumes/nfs-datastore/scripts/ghettoVCB.sh /tmp/list
This will not be supported, that is what cron and other scheduling tools are for. As you've said, it's trivial to add 'your' own 'personal' modification, but when you need to support this in the general community, this task becomes much larger. Your simplest example is using a breakdown of the week M-S. What is someone wants it by the hour, that is a huge amount of conditions you're adding ... then what if someone wants it hourly or every other day except for odd months out,etc,etc...this list can get infinite and adds unnecessary logic to the backup script, which can potentially lead to other issues/bugs.
Again, I've said this several times and I'll continue saying it, the purpose of this script is to provide a free generic backup solution that individuals can utilize in their ESX(i) environment. Any other requirements that fall outside of the actual backup process, users are more than welcome to modify/customize the script to fit their needs/requirements in their environment. You can easily set this up using cron and executing various scheduled backups and why re-invent the wheel when a tools such as cron or Windows scheduler is available?
Thanks for sharing your work but this feature will not be integrated into the script.
I had no intention of suggesting that this be included at all. My comments were directed at IT_Architect who had posted a few steps back that they wanted different datastores and different outcomes. I appreciate the basic nature of the script and wouldn't want it to become otherwise. I was saddened by the need to accommodate spaces in VM names but such is life.
Thanks.
I run ghettoVCB from a script and that script generates the list of VMs to clone...This way if I move a VM from one host to another I don't need to edit a list for each host.
Great idea! In my situation, I have two servers that cross-backup to each other, each with a Windows VM with a NAS on a second virtual disk for the backups. Backing up the two Windows VMs then becomes a special case where I must only backup the first virtual disk to avoid storing backups of backups on the host they came from. Thus, I made copy of the ghetto script and added a break to the virtual disk loop. After the restore of a Windows VM and before starting it, one must first delete the second virtual disk and then re-add it. The procedure works perfectly and there are no issues.
Against all logic and after several attempts, I was unable to come up with a syntax that would enable both backups to execute when stacked in a batch file. Adding an intermediate script as suggested did fix the problem and made the batch file syntax a lot less touchy.
Thanks all!
Where is the ghettoVCB4i file download?
Please download the latest version of the script on this document which is just ghettoVCB.sh. Take a look at the change log for more details on the updates.
Hey Lamn!
Your script is really nice!! Thanks a lot for it!
Now to my little problem:
Situation as it is now: I'm using an ESXi 3.5 153875. I edited the /var/spool/cron/crontabs/root as mentioned by you (see below). And i asured that it would survice a reboot.
If I start yout script manually it works fine.
But if the crond runs your script I got the following output in /var/log/messages
_______________________
Aug 25 23:55:01 crond1472: USER root pid 124920 cmd /vmfs/volumes/volume01/ghettoVCB.sh /vmfs/volumes/volume01/backuplist 2>&1 | busybox logger -t ghettoVCB4i -p 1
Aug 25 23:55:01 crond1289: USER root pid 132147 cmd /vmfs/volumes/volume01/ghettoVCB.sh /vmfs/volumes/volume01/backuplist 2>&1 | busybox logger -t ghettoVCB4i -p 1
_______________________
If I now do a 'ps|grep cron*' I get this: 1289 1289 busybox crond
What is this second crond with PID 1472??? And why does it always start just nanoseconds after the 'real'(?!) crond with PID 1289?
I observed that this second crond is also comming up with another task defined in the crontab.
________________________
Aug 26 14:40:01 crond1289: USER root pid 360693 cmd /sbin/decodeSel.sh #Every 10 minutes, translate the latest IPMI SEL data
Aug 26 14:40:01 crond1472: USER root pid 360695 cmd /sbin/decodeSel.sh #Every 10 minutes, translate the latest IPMI SEL data
________________________
Here's my crontab as it is right now:
________________________
#syntax : minute hour day month dayofweek command
01 01 * * * /sbin/tmpwatch.sh
01 * * * * /sbin/auto-backup.sh #first minute of every hour (run every hour)
00,10,20,30,40,50 * * * * /sbin/decodeSel.sh #Every 10 minutes, translate the latest IPMI SEL data
01 * * * * /sbin/vmwarerootwatch.sh #first minute of every hour.
55 23 * * * /vmfs/volumes/volume01/ghettoVCB.sh /vmfs/volumes/volume01/backuplist 2>&1 | busybox logger -t ghettoVCB4i -p 1
________________________
Do you have a clue why this second crond is running? It's causing me massive problems with my backups! The script runs twice but there's just one backup and even worse the backuprotation routine is used twice --> so there's just one backup left instead of three.
Hope you can provide me with some ideas!
Best regards
Grimes
I recommend you change the time of your backup so you don't run into these issues. The IPMI deals with health monitoring of the server and this is a default script from VMware and would not recommend modifying/changing it.
(ESXi)
The script seems to backup okay, but it always hangs at "Removing snapshot". The code loops looking for a file with the word "delta" in it. This file is never created though so the loop is infinite. At least that is what the problem seems to be. Am i the only one having this problem?
That's actually incorrect, what the script does is takes a snapshot in which a *-delta.vmdk should be created, upon successful backup, the script will remove the snapshot. You're right that there is a loop but it will only loop if it continues to find a file in the VM directory with name "delta".
When you kick off the script, is the snapshot being taken? Can you verify that it has been removed? It could be the case that your snapshot is very large and it's taking some time to commmit the changes. Is this the only VM with issues? Can you provide some background on this specific VM? Size? Are the VMDK(s) all located within the same datastore, do you have them spanned over multiple datastores?
When commenting on an issue, please be diligent in providing additional information other than "its not working" so that I can further assist. Thanks
I would like to propose for consideration that ghettoVCB use a configuration file that was fed on the command line. All editable variables would be contained in the config file. Multiple config files could be used for different destinations, different backup lists, different nfs stores etc. One script could satisfy any host or destination and no direct editing of the script.
One small tweak I made is to move the start time to a couple different places to include the time to make the snapshot. The log still ends up looking the same.
I just tried it again and it seems to be working. I have no idea what I did differently, but it looks good. The only thing is I never see the "-delta.vmdk" mine are named "-0001.vmdk". And the removing snapshot didn't take long at all, and the snapshot files were indeed removed.
What is the process for deleting unwanted backups? I've tried deleting them through the NFS store machine, through the ssh connection, and with WinSCP and no matter what it tells me access is denied or that the file is in use. It doesn't matter if I've unshared the store. Any ideas?
Since we often create new machines and move machines around between ESX:es we want to make sure ALL machines present on the ESX are backed up. Is there any way (or plan) to enable the script to backup ALL machines running on the ESX rather then the need to specify all VMs manually (like putting "ALL" or "*" in the server list file).
jonasb
I have that problem as well. I now use a generic script script directory that all ESXi hosts have access to. I use a generic script that I add to the rc.local on each host. That script generates a new ghettoVCB launch script specific to that ESXi host. The launch script first generates the list of guests to backup. I have a global list of machines to clone and the launch script compares the global list to the local list. If a local machine is on the global list I add it to the daily backup list and then launch ghettoVCB using that daily list.
Just a simple script (no error checking or provisions for spaces in names) that would create a local list.
vim-cmd vmsvc/getallvms | awk -F " " '{print $2}' | sed '1,1d' > /tmp/local_vms
ghettoVCB.sh /tmp/local_vms
Thanks lamw and others for ghettoVCb - after getting all the errors listed on this page it is now running like a dream.
I have several large (500GB+) vms on ESXi and use ghettoVCB to backup to a 2003 NFS ds. Obviously this takes many hours so i installed rsync (daemon mode) and this also works well manually.
Being a noob as well as being a bit thick I would ask for some assistance to hack rsync into ghettoVCB since the cloning only really needs to be done once - differences after that. I can see that i do not need rotation anymore but i still need snapshotting.
Anyone done this?
I am having a problems running the script (ESX 3.5). I downloaded it via lwp-download, set it to execute and get the following when I try to run it.
root@virt-07 xxx# ./ghettoVCB.sh
: command not founde 5:
: command not founde 8:
: command not founde 15:
: command not founde 18:
: command not founde 20:
: command not founde 21:
: command not founde 26:
: command not founde 29:
: command not founde 34:
: command not founde 37:
: command not founde 42:
: command not founde 44:
: command not founde 47:
: command not founde 50:
: command not founde 53:
: command not founde 56:
: command not founde 58:
: command not founde 59:
: command not founde 61:
: command not founde 63:
: command not founde 65:
'/ghettoVCB.sh: line 66: syntax error near unexpected token `{
'/ghettoVCB.sh: line 66: `printUsage() {
I think it's because the ghettoVCB.sh file is in DOS format (with ^M characters at the end of each line)
yes you are correct, I ran the script through dos2unix on a linux machine and it now works. Isnt this script designed to be run on a linux system anyway? Why would it be in dos format?
The method in which you downloaded the script using lwp-download probably caused the ^M character to show up versus LF. The script by default will work off the bat if downloaded properly and edited within ESX(i) console.
Great Script, thank you. Though I am having some difficutly getting it to work properly while scheduled with cron.
Running ESXi 4.0 - duplicated on two different machines.
If I run the script manually, exaclty copying the command I have in the crontab, everything runs OK and completes OK.
However, when the job is run from cron, it fails to remove the snapshot and then of course subsequent jobs will not run. Also the backup folder is missing the --x naming and the old backups in the rotation are not deleted. The backup log for the job is question shows - "removing snapshot", and there is a large number of additional backup logs saying "snapshot found, backup will not take place".
If i go into the vSphere client the snapshot is not visible to delete until I restart the management services. Then the snapshot appears as "Consolidate Helper 0". When I delete the snapshot, the log changes to "Complete backing up...." with a duration of the time between the scheduled start and when I deleted the snapshot. Also the backup is then named with the --x and the rotation is completed.
So it looks like for some reason the process is unable to delete the snapshot and waits until it is manually deleted before finishing, though I don't know why the other logs are appearing.
I need to only backup the first harddisk which has the OS using the ghettoVCB script. I read earlier version can do this. Is there any way to do the same with the current version of the script? Anybody can help?
Are the compressed backups not supposed to be overwritten after a certain number of days specified in the file? I have noticed that the compressed files just continue on.
Nope, you miss-read, this is not a supported feature.
It should be rotating based on your rotation settings, default 3 backups before removing older backups.
Are you running the latest version of the script? If it works manually it should work, verify that your cronjob has been setup correctly.
It is not working for compressed files. I have it set to 3 and I have 11 backups for one vm showing.
AFAIK it is the latest version of the script. I downloaded it from the link on this page, thought the date at the top of the script is 11/01/2008.
My cronjob is as follows(minus the quotes):
"* 22 * * * /vmfs/volumes/datastore1/ghettoVCB.sh /vmfs/volumes/datastore1/ghettobackups > /vmfs/volumes/datastore1/ghettoVCB-bakcup-$(date +\%s).log"
I'm confused by your recent comment, your original post asked about 'compressed files' and now you're saying you're not using compression? Are you or are you not enabling compression on the backups? If the answer is no, then it should rotate properly. Also a note, if you try to manually delete backups, you could screw up the counters. I would suggest trying to a new backup and perhaps move the current backups to another folder and change the value of rotation to see if it's working properly.
I've come acrros another issue as well. I have a newly createed linux VM, with a thin provisioned 40GB disk. Currently it is using 2.7 GB. When I run the script, with the option set to thin provisioned and backing up to a SFU 3.5 NFS server, the backup still comes out to 40GB.
Sorry. Bad use of words. I said it is not working FOR compressed files. I am not deleting files manually but will clear out the folder and start out with a fresh run.
Please re-read this document and specifically the change log on Update (08/08/2009)
It depends on where you view the files as to whether you see the true size. I had the same problem, but I was looking at the files under the shell using ssh. The shell displays the size that it could expand to over time. If you browse the data store using the vSphere client, you will see the true size stored.
So, I am having the same problem where a Snapshot gets stuck in the system using the cron job and fails every night. I can run the script manually and everything runs fine, but it only backs up once and then fails due to an existing snapshot. One thing I noticed was 60 log files for each day the cron job tried to run. The cron and crontab discussion above may be in error. If you want it to run once a day during the week at a certain time the entry above says:
"* 0 * * 1-5"
but in reality that means to run it every minute with an hour that equals 0. So it will run at 12:00, 12:01, 12:02, etc. I'm not positive, but I think the problem with the extra snapshot may be due to multiple instances running 60 seconds apart. Shouldn't it be:
"01 0 * * 1-5"
Which would run one time at 12:01 AM? I'll let you know if it resolves the snapshot issue I was having similar to Rob98.
Hi winterg,
yes, you're right, however I have setting the cron like this:
5 4 * * 2-6
and I have problem as Rob98 still.
I am not sure but i think that cron job worked without any problems if not exist previous backup directory...
Yeah, I think vlho is on to something. I tried the cron with the minute specifed, but that didn't sovle the problem. Then I noticed that my file listing the vm's had a blank line in it. So I recreated the file making sure there where no blank lines. I thought this had fixed the problem as the first scheduled backup ran fine. However, subsequent ones failed and I beleive I changed the output format at the same time as I recreated the backup list, which would have caused it to start the backups fresh. So the first backup succeded, but everything since then has changed. I'll try changing the backup format again on one of my machines and see what the result is.
So it still leaves the -delta and -00001 files behind in the consolidate-helper snapshot, preventing future backups. So, a little more about my set-up:
Hi all,
one relevant thing
I see in my logs (/var/log/messages etc.) this records:
Sep 10 04:05:01 crond5319: USER root pid 3976380 cmd /vmfs/volumes/local/_prog/ghettoDS ...
Sep 10 04:05:01 crond5287: USER root pid 3980501 cmd /vmfs/volumes/local/_prog/ghettoDS ...
I don't see why job run twice but I'd say he that this is reason for described problem.
File /var/spool/cron/crontabs/root contains only this lines:
#syntax : minute hour day month dayofweek command
01 01 * * * /sbin/tmpwatch.sh
01 * * * * /sbin/auto-backup.sh #first minute of every hour (run every hour)
5 4 * * 2-6 /vmfs/volumes/local/_prog/ghettoDS ...
Any idea?
Thanks.
So, based on your reply, I checked the processes running via the ssh console using ps -c | grep crond. The output is:
5120 5120 busybox crond
5141 5141 busybox /bin/busybox crond -b
I think the rc.local entry above in the article might be in error. I don't think "crond -b" is accomplishing the intended goal. It appears to run a second copy of crond, which may be causing the problem. I'm testing again with only one copy runnning. I deleted the crond -b from the rc.local and instead did a kill -HUP (process id of crond) to re-read the crontab file. I'll let you know how it turns out.
Shutting down the guest O/S avoided the problems with the snapshot lingering, but I'd rather leave the guest running.
So, after manually killing both crond processes and starting only one copy seemed to work this time. If I didn't kill off both, the old crond did not re-read the crontab file into memory. So, how do we modify the /etc/rc.local entries above to adjust for this? One thought is to get rid of the crond -b in the rc.local and kill the original crond only to restart it immediately using the following in rc.local:
kill `cat /var/run/crond.pid` ; crond
I haven't tried this yet, but will add it in and see what happens tomorrow.
Thanks for all your investigations, been really busy these last few days. I think that definitely makes sense and you're right when you issue crond -b (-b runs in the background, which you probably want when restarting), creates another cron daemon process. Let me know what you end up finding out and I'll be more than happy to update the documentation.
The line you probably want to add at the end of rc.local including the cron job is:
kill $(cat /var/run/crond.pid)
crond -b
~ # busybox crond --help
BusyBox v1.9.1-VMware-visor-654 (2008-12-17 10:01:32 PST) multi-call binary
Usage: crond -d[#] -c crondir -f -b
-d [#] -l [#] -S -L logfile -f -b -c dir
-d num Debug level
-l num Log level (8 - default)
-S Log to syslog (default)
-L file Log to file
-f Run in foreground
-b Run in background (default)
-c dir Working dir
Hi winterg
your solution is works (only ESXi 4), thanks !
For ESXi 3.5 you usage:
kill `pidof crond` ; crond -b
Hi all,
next option for restart crond
kill -HUP `pidof crond`
i.e. without crond -b
I think that this is better and cleaner than the last...
Either works fine to kill the running process, I'm just glad it works. It has run two nights in a row without fail. I restart crond without the -b for two reasons:
I can confirm that compression works without problems in esxi 4.0.0 181792 but I do not use it because of the extra time it adds to the backup process. You don't say what the error is?
winterg, thanks for all the feedback and work you've put in, I'll update the document tonight if I get some time.
Regarding compression, it should work, I know few people out there that are using it including my colleague in UCSB
What issues are you having? Can you elaborate?
So every time I try to backup I get the following. There is plenty of storage available according to df -k.
"################ Taking backup snapshot for hostname.temp-dom.local ... ################"
Start time: Thu Sep 17 03:36:16 UTC 2009
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/SAS-Datastore1/hostname.temp-dom.local/hostname.temp-dom.local.vmdk'...
Clone: 100% done.
Removing snapshot from hostname.temp-dom.local ...
Compressing VM backup "/vmfs/volumes/External-eSata1/host-backups/hostname.temp-dom.local/hostname.temp-dom.local-2009-09-17.gz"...
tar: cannot store file 'hostname.temp-dom.local-2009-09-17/hostname.temp-dom.local-flat.vmdk' of size 107389255680, aborting
End time: Thu Sep 17 03:49:09 UTC 2009
"#################### Completed backup for hostname.temp-dom.local! ####################"
I would suggest in the future if you post output to wrap it in code tags, makes it much more readable ![]()
Regarding thin provisioning, take a look at my response back on Aug 6:
hello,
i use esxi 4.0 and want to set up the cronejob correct. when i use the script manual it woks fine.
when i make a cronjob now an then add the necessary lines in the /etc/rc.local is this example correct?
~ # cat /etc/rc.local
#! /bin/ash
export PATH=/sbin:/bin
log() {
echo "$1"
logger init "$1"
}
#execute all service retgistered in /etc/rc.local.d
if http:// -d /etc/rc.local.d; then
for filename in `find /etc/rc.local.d/ | sort`
do
if -f $filename && -x $filename ; then
log "running $filename"
$filename
fi
done
fi
/bin/echo "* 0 * * 1-5 /vmfs/volumes/simplejack-local-storage/ghettoVCB.sh /vmfs/volumes/simplejack-local-storage/backuplist > /vmfs/volumes/simplejack-local-storage/ghettoVCB-backup-\$(date +
%s).log" >> /var/spool/cron/crontabs/root
/bin/busybox crond -b
kill `cat /var/run/crond.pid` ; crond
Please always use code tags to wrap your console output, makes reading much easier.
I haven't had time to update the document with the latest changes mentioned in the last few replies, I'm currently out of town.
Regarding the changes for cron to work, you need to first kill the cron daemon first ... then issue the updates and restart (without -b)
kill $(cat /var/run/crond.pid)
/bin/echo "* 0 * * 1-5 /vmfs/volumes/simplejack-local-storage/ghettoVCB.sh /vmfs/volumes/simplejack-local-storage/backuplist > /vmfs/volumes/simplejack-local-storage/ghettoVCB-backup-\$(date +
%s).log" >> /var/spool/cron/crontabs/root
/bin/busybox crond
I try to use this scipt to do backup with compression enabled.
Howerver, I cannot uncompress "filename".gz as it show "tar: Invalid tar magic".
Currently, I use ESX 3.5i U4 free edition and backup it to local drive of ESX server itself.
Any thought about the issue?
Thank you
Can you please provide the full command you're using to uncompress the backup?
1.) # gunzip < /vmfs/volumes/datastore1/backup/vm1/vm1-2009-09-22--1.gz | tar xvf - -C /vmfs/volumes/datastore1/restore
and
2.) # gunzip < /vmfs/volumes/nfs/backup/vm1/vm1-2009-09-22--1.gz | tar xvf - -C /vmfs/volumes/datastore
I try to backup and uncompress in 2 scenarios 1.) on local hard disk, 2.) on nfsshare
both give me "tar: Invalid tar magic"
Thank you
Perhaps tar changed between ESXi 3.5u4 and ESXi 4.0 .... I would need to replicate this in our dev environment and see what I get. I'll get back to you on this one, need to find some free cycles to test.
Thanks for reporting this.
hi,
backup and cronjob with esxi 4.0 works great.
thanks
kanngoo
Thanks for the comments and glad it's working!
Interesting, it works for me on ESXi 3.5u4
~ # vmware -v
VMware ESX Server 3i 3.5.0 build-153875
~ # gunzip < /vmfs/volumes/datastore1/WILLIAM_BACKUPS/test/test-2009-09-22--1.gz | tar xvf - -C /vmfs/volumes/datastore1/
test-2009-09-22/
test-2009-09-22/test.vmx
test-2009-09-22/test-flat.vmdk
test-2009-09-22/test.vmdk
~ # gunzip -v
gunzip: invalid option -- v
BusyBox v1.2.1 (2008.06.26-17:58+0000) multi-call binary
Usage: gunzip [OPTION]... FILE
Uncompress FILE (or standard input if FILE is '-').
Options:
-c Write output to standard output
-f Force read when source is a terminal
-t Test compressed file integrity
~ # tar -v
BusyBox v1.2.1 (2008.06.26-17:58+0000) multi-call binary
Usage: tar -[czxtvO] [-f TARFILE] [-C DIR] [FILE(s)] ...
Create, extract, or list files from a tar file.
Options:
c create
x extract
t list
Archive format selection:
z Filter the archive through gzip
File selection:
f name of TARFILE or "-" for stdin
O extract to stdout
C change to directory DIR before operation
v verbosely list files processed
Hi William,
thank you for the nice script. There is just something wrong with my settings. Can you help me please?
I get the following message, what does it mean:
DEVEL_MODE=0
printUsage() {
SCRIPT_PATH=$(basename $0)
echo -e "\nUsage: ${SCRIPT_PATH} VM_FILE_INPUT\n"
/vmfs/volumes/4a3bec10-5b0ef122-e3cb-001777642eb1/backupscript # ./ghettoVCB.sh vmbackups
(vim.fault.AlreadyExists) {
dynamicType = <unset>,
faultCause = (vmodl.MethodFault) null,
name = "/vmfs/volumes/b22ca6b3-931cd49f",
msg = "The specified key, name, or identifier already exists.",
}
Snapshot found for xvm3_1, backup will not take place
It looks like the error is:
Snapshot found for xvm3_1, backup will not take place
Is it possible to remotely kick-off the script from an Ubuntu VM with vCLI installed instead of enabling SSH through the unsupported mode? The reason I'm asking is that with your ghettoVCBg2 script you are using the vMA which has vi-fastpass for authentication and so does not require SSH. So without vMA and fastpass is there a command in the vCLI that can run the script located on the local datastore or shared storage although it might prompt for credentials?
Thanks
Hi,
here is my VMWare Version
~ # vmware -v
VMware ESX Server 3i 3.5.0 build-153875
Thought I share with everyone that ghettoVCB just hit 100,000+ views! Thanks to everyone for their contributions, comments and use of the script!

You're posting in the wrong forum, this is not ghettoVCBg2 forum and No you can not. The script is written specifically to work with vMA and vi-fastpass.
Nope, the VMDK format does not matter with respect to extracting the contents. Curious, how big is the VM that you backed up and how big is the file after compression?
Not sure what to tell you, it works fine on our system ... the only thing I can think of is there might be a size limitation when trying to extract from within Busybox and it would not surprise me at all if this was a tar limitation within Busybox confines.
tar size is 8 GB
backup size after compression is around 750 MB
Let me create a dummy VM that is 8GB using eagerzeroedthick and try backing it up with compression enabled and see if I run into the same issue. Post back shortly
Hi,
I just recreate dummy VM with 2 GB size do backup with compression. it is running smooth without a problem. So, I think the problem as you mentioned about tar file size limitation.
I will try to find server to put VMWare ESX 4 and try whether will give me the same issue. And, will let you know the result.
Thank you very much for your assistance.
Unfortunately the backup does not work properly for me.
The only file that gets copied by backup process is the *.vmx file.
The second problem is, that there will no further backup take place when there already exists one *.vmx copy.
The error message i get:
Error: failed to lookup testvm!
It would be great if you could help me.
Please take a look at FAQ #9 and also edit the script and look for the variable DEVEL_MODE and change that from 0 to a 1 and provide the output and remember to wrap the output from the console using code tags to make it readable.
Excuse me if that isn't the right way to ask such a simple question but I did not find another way.
The only downloadable version of ghettovcb on this page is dated on 11/01/2008.
Is that truely the latest version esx-i 4?
I've been searching high and but could not find an newer one to download.
Once again I hope tah this was the right place to ask such a question
Sincerely
Ralf Oertner
The download link is for the latest version.
Thank you for your quick reply.
The link is located before the known issues section.
Underneath the "Attachment" Section.
Is that the right link?
Sorry my question may sound stupid but I am truely confused about that.
Ralf Oertner
There is only one download link.
So nothing from the output is showing me there were any errors and if you look at the duration it was pretty quick to finish and I can see that all the params were validated. So, my question, is there an actual VMDK that is valid and attached to this VM?
Also when I mentioned code tags, there were specific ones for the Jive forums, take a look at this page: http://communities.vmware.com/markuphelpfull.jspa
Problem cleared, i have deleted accidently a " in the source code and a part of the script has been commented out.
Thank you for support.
I think I have found an issue with huge notes in Annotations. I downloaded the ntop appliance and the output from vim-cmd vmsvc/getallvms generates a bunch of junk lines. I haven't been able to test the script and it may not affect anything. The output looks like:
"112";"ntop";"[storage]";"ntop/ntop.vmx"
" VirtualAppliances.net NTOP Appliance for realtime network monitoring.";"";""
" To monitor your network's traffic usage, simply start this appliance.";"";""
" It will automatically begin collecting traffic statistics from your";"";""
" network. To view statistics, simply use your web browser to visit";"";""
" the NTOP interface at http://ntop.local.:3000 or the IP Address given";"";""
" on the console. NTOP is excellent for collecting statistics for ";"";""
" trouble shooting your network as well as longer range monitoring and";"";""
" planning activities. Visit http://ntop.org for more information about";"";""
" the ntop application. Community support available at http://forums.virtualappliances.net ";"";""
Yes, annotations with the VM will cause the input to be captured when dumping out all VM(s), it'll pretty much fail on the lines where it contains the annotation since each line is suppose to represent a VM entry.
Did finally get to test it and at least in my test environment it doesn't appear to affect anything. Screen output doesn't seem to be affected either. Sorry to have caused unnecessary concern.
Hi,
I need to do a small modification to the script, to skip both virtual and Physical RDMs (I need the VM backed up but not the RDMs).
I'm going to change this bit of code:
\{code\}
#support for vRDM and deny pRDM
grep "vmfsPassthroughRawDeviceMap" "${SOURCE_VMDK}" > /dev/null 2>&1
\{code\}
with this:
\{code\}
#support for vRDM and deny pRDM
grep "RawDeviceMap" "${SOURCE_VMDK}" > /dev/null 2>&1
\{code\}
You can do that OR you can just deny both types of RDMs: physical and virtual by doing the following:
grep -E '(vmfsPassthroughRawDeviceMap|RawDeviceMap)' "${SOURCE_VMDK}" > /dev/null 2>&1
run backup with this script on ESX 4.0.
Have no problme so far.
Thanks
Dear GhettoVCBackup Experts,
First of all many thanks for the excellent script!
I have a few questions regarding ghettoVCB on ESX-I 3.5 and ESX-I 4.0 both used with the "free" license.
I use the script with the "plink-method" but I am having trouble with the log file. I am using the following commnandline to start the script:
c:\programme\putty\plink.exe root@192.168.110.3 -pw password "cd /vmfs/volumes/store-VMs/ && ./ghettoVCB.sh servers > ghettobackup-server.log &"
The log file is created as expected but sometimes lines are missing or the logging stops before the scriptrun has ended. For that reason I am often unsure if the script is still running or not.
Is there any way to make sure the script is finished or not? How can I fix the "logging-problem"? Is the plink-method the best way or is it better to use crontab (maybe logging works better that way)? When I look at the backup-destination during the script is runnning the file sizes are not changing. They are set to the file size of the original vmdk as soon as the script is running. What happens if the script ist failing in the middle of the copy process. Do I end with a copy of a vmdk which is just "halffull" and the other half is filled probably with zeros.
A lot of questions I hope you can help and many thanks once again!
Hi William,
My client has 3 ESXi machines hosting 19 virtual servers, all Windows XP or 2003 machines. The ghettoVCB.sh script runs on the 3 ESXi machines and backs-up the 19 servers to one large NFS share.
The script regularly hangs while removing snapshots. The symptom of the problem is that the last line of the logfile reads "Removing snapshot from " (vnname) followed by no further activity. The manual workaround involves using vSphere to create then remove a snapshot, at which point the script continues working its charm.
The problem apparently stems from the following codeblock from ghettoVCB.sh (line numbers added for clarity):
385 #powered on VMs only w/snapshots
386 if [ ! ${POWER_VM_DOWN_BEFORE_BACKUP} -eq 1 ] && [; then
387 ${VMWARE_CMD} vmsvc/snapshot.remove ${VM_ID} > /dev/null 2>&1
388
389 #do not continue until all snapshots have been committed
390 echo "Removing snapshot from ${VM_NAME} ..."
391 while ls "${VMX_DIR}" | grep -q delta;
392 do
393 sleep 3
394 done
395 fi
As long as there are delta files in the VM's directory, lines 392 to 394 loop perpetually. My contribution to your excellent script is to suggest a modification to line 387 to use vmsvc's snapshot.removeall command instead of snashot.remove. Line 387 would then look like this:
387 ${VMWARE_CMD} vmsvc/snapshot.removeall ${VM_ID} > /dev/null 2>&1
This enhancement removes all snapshots in the form of delta files, and allows the script to continue its work.
Cheers!
Dave
Not sure about the plink solution, I don't use that personally with ghettoVCB, I know it works great for others. You also have another logging possiblity as you've mentioned is to setup a cronjob and have it log locally, take a look at Advanced Logging setup in this document.
Regarding your destination disk, you'll want to take a look at your *-flat.vmdk and not your .vmdk as that is just the descriptor and not the actual disk and the final output will also be determined based on how you're backing up your VM, whether that is thin/thick or any other supported format. If something were to error, you'll see something logged and you'll end up with a bad backup.
Thanks for the comments, unfortunately your solution is not a valid work around. The script does not support any VM(s) with snapshots, but I also do not make the assumption that a user may or may not modify the script. Having said that, I will only remove the most recent snapshot which should have been generated by my script only and hence it will continue to loop to ensure that the *-delta-XXXXX.vmdk are gone. The other thing that I'm not 100% sure is if snapshot.removeall is a blocking function because snapshot.remove is not and you could run into a situation where you'll have multiple backups completing and committing multiple snapshots which could hinder performance. This will guarantee that each VM is back into a consistent state before moving onto the next VM if something were to go wrong.
I've not heard others having issues with removing the snapshots.
Hi Everybody,
Lamw, I like your script! Great work!
I am backing up 5 VMs (on a ESXi 3.5u2 Free) to a Windows NFS Store. Works great.
Now I want to use a NAS-Box (QNAP 509 pro) as a NFS Storage. Connected allright. First 3 Backups ok, but the time it comes to deleting files we have a Problem:
Hello
I am backing up my VM's since a few months with ghettoVCB.sh. It is great. Since yesterday I got a problem: The script runs without errors, but no VM's are backed-up anymore. I am running ESXi v3.5 build: 153840.
Until yesterday my log looked like this:
*****************************************
VM is still on - Iteration: 0 - waiting 3secs
VM is off
Starting backup for khtsbs01 ...
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/4895d67c-fc7a4da0-09b6-00215ad1fa42/khtsbs01_1/khtsbs01_1_1.vmdk'...
Clone: 0% done.Clone: 1% done... Clone: 99% done.Clone: 100% done.
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/R3_KHTSBS01/khtsbs01/khtsbs01_2.vmdk'...
Clone: 0% done.Clone: 1% done...Clone: 99% done.Clone: 100% done.
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/R3_KHTSBS01/khtsbs01/khtsbs01_1.vmdk'...
Clone: 0% done.Clone: 1% done....Clone: 99% done.Clone: 100% done.
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/R3_KHTSBS01/khtsbs01/khtsbs01.vmdk'...
Clone: 0% done.Clone: 1% done...Clone: 99% done.Clone: 100% done.
Powering back on khtsbs01
Completed backup for khtsbs01!
*******************************
And since today it is only this (VMs are not backuped):
********************************
VM is still on - Iteration: 0 - waiting 3secs
VM is off
Starting backup for khtts01 ...
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/4895d67c-fc7a4da0-09b6-00215ad1fa42/khtts01/khtts01_1.vmdk'...
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/R2_KHTTS01/khtts01/khtts01.vmdk'...
Powering back on khtts01
Completed backup for khtts01!
*******************************
Any ideas what could cause this problem?
Thank you very much,
ibhp
This sounds like an issue with your NFS server...you could add an additional wait by inserting a sleep(XX) into the script before it gets to the rotation code. This value may just be some arbitrary number since different size VM(s) will probably delete faster or slower based on their size.
Good luck
If things have been working for a few months, then I would start looking at the changes that could have occurred in your environment, if the script has changed, then it's probably something else. Make sure no changes were done or if any of the virtual disks have been removed from the VM, etc,etc. You will need to do some troubleshooting
Hi,
first thanks for this great script, seems to be the only alternative for using VCB on Windows.
One small question / feature request:
Would it not minize the downtime if the script shuts down a VM, take the snapshot, Power the VM back on again, clone the disk and then remove the snapshot ? So the downtime would be time requied for shutting down, take Sanpshot and start again. No matter how big the disks are.
Thanks in advantage.
I second the request to shut down the VM, take a snapshot, power the VM back up, while cloning the disk and remove the snapshot afterwards. I have modified the scripts in the past to get close to this functionality, but of course I have to re-edit them anytime the upstream GhettoVCB is modified. I feel more confident when I can do pristine copies of the VMs, but it is inconvenient for the downtime required. Maybe a new toggle in the script file? The one problem with this behavior would be if you provided a list of VMs..... do you cycle each off, snapshot, power back on, backup, remove snapshot, THEN do the next for the next VM or do you take snapshots of ALL the VMs you listed first, THEN backup each one and delete the snapshot before moving to the next vm, backup then delete snapshot, etc..... I understand there would be performance impacts due to more than one snapshot in play... but that would be the user's responsibility. They still could pass a single VM to the script (my favorite is echo "vmname" | sh ghettoVCB.sh - ) which reads the VM from the command line vs a config file.
I've made the changes with about 10 lines of code. (one if statement needs a condition added as well) The evolution of ghetoVCB has actually made it easier to implement part of this. Right now the behavior works best with one VM at a time. If you are backing up multiple VMs, it will wait till the last backup is done, then power that VM off, snapshot, power back on (waiting x seconds), then backup/clone, then delete snapshot. It would take a good deal of rewriting the ghettoVCB flow to handle snapshots first for all VMs. I'll post my changes as soon as I run a few more tests.
Guys – got a problem with the ghetto backup script. It runs OK for a few backups then complains that it cannot create the directory /vmfs/volumes/BACKUP (see below).
In the script I define:
VM_BACKUP_VOLUME=/vmfs/volumes/BACKUP/ESXIDMZ01
BACKUP is an NFS share mounted as a datastore on the ESXi server. This is actually drive F: on the backup server and on that drive I have pre-created the ESXIDMZ01 folder. I have tried also pre-creating the VM folder below that “OCSEDGE” but it fails with or without that directory existing. There seems to be no consistency.
I also see that “ls” error at the end of the backing up of EXCHEDGE01 (below)
Any ideas?
Follow these steps to modify the current ghettoVCB.sh to support what was discussed above: (I just fixed a minor issue if you run the script with this enabled and the VM off... it wouldn't be able to startup since the disk would be locked)
1. Add the following code at the top of the program before the # DO NOT MODIFY LINE
# 1=on, 0 = off
POWER_OFF_SNAPSHOT_ON=1
# Time to wait after powering on the VM before starting the backup/clone process
POWER_ON_WAIT=120
2. Next, replace the if statement directly following "#section that will power down a VM prior to taking a snapshot and backup and power it back on" with this:
if [[ ${POWER_VM_DOWN_BEFORE_BACKUP} -eq 1 ]] || [[ ${POWER_OFF_SNAPSHOT_ON} -eq 1 ]]; then
3. Add this code directly after the section for
#If we need to power the VM back on before backup (POWER_OFF_SNAPSHOT_ON = 1)
if [[${POWER_OFF_SNAPSHOT_ON} -eq 1 ]] && [[ "${ORGINAL_VM_POWER_STATE}" != "Powered off" ]]; then
echo "Powering back on ${VM_NAME} before backing up (waiting ${POWER_ON_WAIT} seconds before copying)"
${VMWARE_CMD} vmsvc/power.on ${VM_ID} > /dev/null
sleep ${POWER_ON_WAIT}
fi
That is it! I've tested this on a only a non-critical system, and since you are modifying your existing ghettoVCB.sh script, please be careful and test completely before using in production.
I'm not sure which use case you're trying to accomplish with the suggested solution.
I see basically 2:
A) Backup while the VM is online
B) Backup while the VM is offline
The solutions to the following are:
A) Take a snapshot while the VM is running, backup the disk and commit the snapshot (no downtime)
B) Power down the VM, no snapshot is needed and backup the disk and power VM
I'm assuming you're referring to case B, you may minimize the actual downtime of the VM by doing an offline snapshot but unfortunately you introduce a snapshot which needs to be committed which turns out to be a similar use case as A, so why not just backup the VM while it's running?
I've had the same request than someone98 a few weeks ago...
The reason of this request is :
-It's safer to make a backup of a VM while it's off because databases are closed, files are closed, nothing is in the memory of the VM and in fact you are sure that you won't have any surprise (database inconsistency, files truncated, and so on) when you will use this backup.
-In this case, if you power down a VM and wait until the backup is done before powering it on, it can take HOURS to complete (lots of gigs to transfer)
-so it would be nice to have the ability to shutdown a VM, take a snapshot, power it on, make the backup and delete the snapshot.
problem I have does not seem to be with taking the online snapshot etc. The problem seems to be with the target datastore where the files get moved to. For some reason I fails after backing up 1 or 2 VMs OK saying that it can't create a specific directory for the next VM. However, it managed to do it fine for the first 2 so why fail now?
Hi,
for reference when setting up a persistent cron job in ESXi 3.5 update 4 i had to use the following commands to stop and restart crond in my /etc/rc.local
kill $(pidof crond)
crond
not
busybox crond
as mentioned in the help. Other than that all working great.
Definitely understandable with databases, but that's why VMware has the option of quiescing the filesystem to have all it's data flushed to disk prior to taking a snapshot. The only requirement is to have the latest version of VMware Tools running and when a snapshot is taken, there is a few options to include memory and also to quiesce the fileystem.
[root@himalaya ~]# vmware-vim-cmd vmsvc/snapshot.create
Insufficient arguments.
Usage: snapshot.create vmid [snapshotName] [snapshotDescription] [includeMemory] [quiesced]
Creates a snapshot for the vm.
What are the differences between the first 2 VMs and the third? I've seen this issue once or twice in the forums and it all goes back to the NFS server as you've mentioned with the timeout. I would say that either the size of the VM differs significantly or the snapshot is much larger than the first two and hence it's failing. Also is the link to your NFS server being saturated, are there other data going through it? 1gb link to NFS server vs 10gb link vs 4/8gb FC link will all act very different and also the storage on the backend and how many spindles/disk are being accessed.
This is more of an environmental issue than with the script, we've backed up VMs in the hundreds of gig without any issue against an NFS.
Thanks for the information, I'll update the document tonight with the correct params.
Has anybody encountered the following error when running the script?
mkdir: cannot create directory `/vmfs/volumes/nfs_storage_backup': Operation not permitted
what do you have for the VM_BACKUP_VOLUME=
The backup volume must point to a mounted datastore (unless you are using non persistent storage) and the path must exist.
Well, the script was working fine then I changed the NFS share name. I am using non persistent storage. This is going to a VMWare Cluster and I noticed that on 3 of the hosts now, it was mounting to nfs_storage_backup and now its going to nfs_storage_backup (1). Because of the (1) the path wasn't working for the compression. So I removed the nfs_storage_backup (1)...now when I go to run the script i get the above error. Any suggestions? Thanks!
NO spaces in the path. or special caharacters.
The system created the nfs_storage_backup (1) on its own... i don't know why it used that when its defined as NFS_LOCAL_NAME=nfs_storage_backup in the script.
Can you mount that share on your ESXi host as you have it listed in the script under persistent.
I'm not sure. All I know was the script was working fine on each host in the cluster and for some reason it stopped with the Operation Not Permitted Error. I would like to know what caused this error to occur. Is it plausible that only 1 HOST in the cluster can be mounted to the NFS share at a time? Because currently there is 1 of the 4 HOSTS in the Cluster that work fine and mount to this location without a problem and STILL works fine.
As long as there are fewer than 8 NFS shares on a host (the default but can have been changed) an NFS share can be be add to as many ESXi hosts as you have. When you say that the system made the change what do you mean "what system?". Is the NFS share already present on the host? Again I ask can you mount the share as is is under the non persistent settings of the script. If it can't then the script won't either. You did say that it was working and then you changed something. Check your editing.
I believe someone here or in the general forums ran into something similar when using vimsh to mount an NFS datastore, it seems to remember the original label, hence when you try to re-mount as something else it'll think it already exists. I think the user had to manually re-add with the same name, delete the NFS datastore and then manually re-mount using the new name.
Would this also eliminate the mkdir: cannot create directory `/vmfs/volumes/nfs_storage_backup': Operation not permitted, that I've been starting to get? I never got this error before, and for some reason I started getting it today and I'm not sure whats causing it?
Also,
When I goto mount it manually via "/usr/bin/vmware-vim-cmd hostsvc/datastore/nas_create nfs_storage_backup x.x.x.x /NFS_SHARE 0" I get a message saying this already exists below:
First, thanks for this awesome script and for updating/answering questions. We have Enterprise licensing, including the "official" VCB, but were looking for something simpler than a VCB proxy setup for our ESXi servers. This fits the bill perfectly.
Second, rather than using a manually maintained list of machines to include in a backup we do something a little different and I figured I'd offer to share it in case anyone finds it interesting...
Due to various factors ( vmotion, VMs added/removed, VMs moved from dev to production, new hosts added/removed etc. ) our inventory is constantly changing on all hosts and manually updating a list of VMs to backup in multiple locations got to be a bit much.
Therefore we found it easier to maintain a single file of machines to exclude from backup, rather than multiple files of VMs to include.
Basically, we assume the VM should be backed up unless it's specifically excluded.
To accomplish this on ESX using vcbMounter, I get the VM names from /etc/vmware/hostd/vmInventory.xml ignoring any that are listed in a specified "exclude" file and passing the rest to vcbMounter to be backed up.
I modified this for ESXi/ghettoVCB.sh to write the VM name(s) to the file used as the argument to ghettoVCB.sh.
It still requires maintaining the exclude list, so it's possible to miss something. But in our environment this has proven to be easier/more effective, and all ESX(i) machines in our environment look at the same exclude file. Or if you don't want to exclude any VMs, leaving the exclude file blank means you no longer have to manually maintain any files.
So, if anyone is interested, I can post what passes for my "code".
Disclaimer...I am not a shell programmer. I know there are cleaner/more graceful ways of doing this than the hack I threw together. real programmers will probably laugh or throw rocks at me. But it works for us, it's only a few lines and it is probably easy to clean up/condense by someone with more experience.
Thanks for your help and the script!!
Hi everyone,
I'm currently in development (as time permits) on some new features for the ghettoVCB script and I'm looking for some individuals that may be interested in taking part in a BETA. The requirement is pretty simple, willing to help test and provide feedback on the next version of the script (remember to test on non-production VMs) ![]()
If you're interested, please PM on VTMN with your email address and the script you would like to take part in and I'll be selecting a group users and send out email notification in the coming weeks.
Thanks
I would dearly love to participate but fundamentally refuse to use twitter or expose an email address to it.
I can help if you want. I have a spare R200 with latest ESXi 3.5 and a V4 Essential license for it.
Oh, I can't DM you on twitter, probably cause you're not following me
Drop me your email via PM on VMTN.
Drop me your email via PM on VMTN.
This is a really great extension to ESXi.
The only thing missing IMHO is the ability to exclude certain vmdks from backup.
You very often have setups where you only want to backup the system volumes of machines via image and not the datavolumes which are sometimes 100GB+ in size. These are most often beeing backed up by different systems with a more granular backup technology.
There is a BETA in the coming weeks, if you're interested drop me your email via VMTN PM
for pb with 100GB+ (for data volume) I use an independant disk (wich is not affected by snapshot) and I use a modified GhettoVCB script : I add a BACKUP_INDEPENDENT_DISK option and if set to 0 , I exclude "independent" disk when the script "browse" all vmdk
It works fine until a new version of GhettoVCB comes with this option ! ![]()
lamw, i'm interested by your beta ![]()
Sebastien
If you're interested in the BETA, please send me a PM on VMTN with your email.
First off thank you, and great work on your scripts.
I recently upgraded to ESX4 and ESXi4 and would like to try using one of the scripts either ghettoVCB or ghettoVCB2 to copy vms from our ESX4 cluster to an ESXi server that has plenty of local storage. Would you recommend the newer script or the older script? I was hoping to use compression but did not see that feature in the new script. Also I would be willing to test any beta scripts since I am starting out with our test server. Thanks
ESX(i) 4.0 is supported by both ghettoVCB and ghettoVCBg2, please go over the documentation carefully and you'll see the use cases for each depending on the environment you're in. Compression is only available with ghettoVCB and it's not available for a certain reason in ghettoVCBg2.
Regarding the BETA, if you're interested please follow the directions in an earlier comment that specifies on how to apply.
Thanks a mill for this cost saving solution William. I have everything up on my ESXi host, tied my NFS datastore to it, edited the VM_BACKUP_VOLUME variable appropriately, created the vm list file and changed permissions on the ghettoVCB.sh all using Putty on my windows machine to ssh into the ESXi host. But when i try to run the script, i still get the:
-ash: ./ghettoVCB.sh: not found
error.Can i get any help here. Thnx so much.
Make sure you're downloading the latest version which is attached to this VMTN document. Make sure you've edited the script directly on ESX(i) host (not with Windows system such as notepad). These are generally the issues people run into if they're hitting this error. How did you upload the script to your ESX(i) host?
I edited the script on the ESXi host using Putty.I uploaded the script to the ESXi host using WinSCP transfer(in text mode).I probably will go ahead and download the latest version attached to this VMTN document, edit and make the changes in the morning.I will let you know how this goes.Thanks a million again.
Thanks William.Everything's on track now. Apparently the original download was corrupt.Thanks again.
BETA email invitations will be going out this weekend ... keep an eye out ![]()
Since we are getting close to Halloween walking around with an eye out won't be that noticeable. Good timing.
---
I found the ghettoVCB.sh to work great!
But how can I automaticlly generate the vm_backup_list.. so that the ghettoVCB.sh through cron will backup every vmware that is running on the VMWare ESXI 4.0 server ?
I tried using "cat /tmp/vms_list | grep vmware | sed ....something " > new_file_backup_list
(but I cant get this to work..)
---
This code will generate a list of all VMs on the host.
vim-cmd vmsvc/getallvms | awk -F " " '{print $2}' | sed '1,1d' > /tmp/currentvms
ghettoVCB.sh /tmp/currentvms
Hi,
Your command works perfect with the images-names that do not have spaces in the name.
But the images with spaces, i.e. "WIN 2K3 PRODUCTION" will not be in the list properly..
Is there a command that could cut out the "WIN 2K3 PRODUCTION" line in this /tmp/vms_list :
"";"";""
"Windows user/pass: administrator/<Blank>";" ";""
"576";"WIN 2K3 PRODUCTION";"vmware";"WIN 2K3 PRODUCTION/Win2k3 32 bit.vmx"
"";"";""
The command provided by @DSTAVERT is not correct ... it's way more complicated than that when you have spaces/etc. that needs to be taken into consideration. The actual command is actually within the ghettoVCB script if anyone has taken a look at the source.
vmware-vim-cmd vmsvc/getallvms | sed 's/[[:blank:]]\{3,\}/ /g' | awk -F' ' '{print "\""$1"\";\""$2"\";\""$3"\""}' | sed 's/\] /\]\";\"/g' | sed '1,1d'
stighenning
I am sorry.
I keep forgetting that people do use spaces in names.
This command feeds the /tmp/vms_list with data.
But this list is filled with lines like:
"16";"Windows XP";"vmware";"Windows XP/WindowsXP.vmx"
..so a command that pulls out the word(s) before ";"vmware and put this into a new file.
replace the
{print "\""$1"\";\""$2"\";\""$3"\""}
{print $2)
Aha.. made it ![]()
1. touch /tmp/vm_backup_list (so the file actually exists!)
2. edit the ghettoVCB.sh and add this to the script:
vim-cmd vmsvc/getallvms | sed 's/[[:blank:]]\{3,\}/ /g' | awk -F' ' '{print $2}' | sed '/^ *$/d' | sed '1d' > /tmp/vm_backup_list
??
How can I paste "code" so that it does not edit the code ? (so you can read the code wihtout icon and blue letters)
??
use {code} before and after your code.
not like html no / in the code tag
..
..script been running good, backing up alot of my vmware that are stopped.. but when it came to an image that was running, it fails:
I found there where an old folder with the same name in the "target".
I deleted this folder on the target system, and ran the ghettoVCB.sh vm_backup_list again.. and this time it worked.
I just downloaded the script to test it and cannot run. I get this message
root@esx01 ghettovcb# ./ghettoVCB.sh backuplist
-bash: ./ghettoVCB.sh: /bin/bash^M: bad interpreter: No such file or directory
I am running VMware ESX 4.0.0 build-164009
Did you edit the script in any way/shape or form on a Windows system? That is why you're seeing the ^M character when using something like a notepad program. Re-download and upload the script directly to the ESX(i) host and make your edits using VI
I downloaded it to a windows PC. I then used vSphere client to upload it to a datastore.
I ssh to the esx server and edited the file via VI.
I did open it using notepad to see the text but did not save anything I simply closed it.
I will try again. Thanks
I suggest uploading the file with WinSCP as text and editing in using the vi editor in Putty.
To remove the ^M from the file, do this;
sed 's/.$//' ghettoVBC.sh > NewghettoVCB.sh
..it will work
Thank you guys for your suggestions, they were very helpful.
The script now runs and works great however I get this message below. Is this something that I can fix?
DiskLib_Check() failed for source disk The system cannot find the file specified (25).
Hi S3BAST13N. I am also looking to exclude backup od "independent" disk. Can you share with us how to modify the script to do so. Thanks.
FYI - Independent disk logic will be added to the next release of ghettoVCB ![]()
Great. Is this also in the beta. Can I have a copy to test. Thx.
Yea that'll be in the next release and sorry the BETA is closed. I should have a new release of the script soon enough ![]()
Hi,
How is ghettoVCB supposed to handle VMs that are in a suspended state ? I'm just starting to play around with ghettoVCB now, and I'm finding that when ghettoVCB hits a machine which:
1/ is suspended, and
2/ has no snapshots
It takes snapshot, backs it up, but DOES NOT delete the snapshot it took as part of the backup.
Consequently, next time I try to backup the machine, when it is in a powered on state, the backup fails since there is a pre-existing snapshot (called vcb_snap).
Am I missing something ?
Yep, the logic when taking the snapshot is correct, but upon removal it only checks for "Powered On" VMs only, this has been fixed and will be ported to the next release of the script. In the meantime, if you would like to update the script just search for the section where the snapshot is removed and add and "OR" statement that says:
\[\[ "${ORGINAL_VM_POWER_STATE}" == "Suspended" \]\]
I have been testing the script for a couple days, and it seems to work fine. I have a couple questions:
1) Should the nvram and log files be also backed up? I only see the .vmx and .vmdk files
2) In some VMs I get this message but the backup still works
DiskLib_Check() failed for source disk The system cannot find the file specified (25).
Thanks
1) No, these files are not explicitly required (nvram will be generated upon boot up if not there) The logs may or may not be useful, depends on what you'll use them for and you could have quit a few logs. This can easily be added as a additional files but won't be part of this script
2) Can you provide more information about the environment, the VMDK(s) you're trying to backup? There's probably something going on with the disk it's trying to clone either at the source or destination. Would be helpful to provide some output from your run, as your error is vague in general. Remember to wrap all output in {code} tags
My backups only contain the .vmdk and .vmx files. Consequently, when I restore the machine using vmkfstools, the resultant machine is in a powered off state. This took me a little by surprise, since the machine was powered on when the backup was taken, and I'd expected it to be restored in exactly the same state.
As a result, my questions are:
1/ is this the intended behaviour
2/ is there any risk of memory resident or cached data that has not been written to the VMs disk being lost ? For example, an unsaved file that is open when the backup is taken, or data that has been saved but is in the VMs operating system cache, and not actually written to the VMs disk ?
Thanks.
1) Yes that is the intended behavior as stated in the previous reply
2) Using the quiesce option would solve this problem, take a look here for more details: http://virtualizationreview.com/Blogs/Everyday-Virtualization/2009/08/Quiesced-Snapshots.aspx
As of today, this is disabled by default but in the next release of the script, a user can configure both the quiesce and memory option of a VM when specifying a backup snapshot prior to backup. You can manually change the value in the script but it'll be a manual process.
Regarding "If you find this information useful, please award points for "correct" or "helpful"."...
How do I do this ?
I'd like to, but can't see where to do it !
Will,
1) Thanks for your responses. Agreed. nvram and log files may not be useful. If I wanted to copy the log files and nvram I could only add 2 lines in your script after line 266 correct?
cp "${VMX_PATH}" "${VM_BACKUP_DIR}"
cp ${VMX_DIR}/*.log ${VM_BACKUP_DIR}
cp ${VMX_DIR}/*.nvram ${VM_BACKUP_DIR}
1) That should work, you'll want to test and verify.
3) Snapshots are not meant to be kept for long durations of time, there is a miss-conceptions on what snapashots are used for. They should be short lived and hence I will ignore any VMs with prior snapshots, you're more than welcome to modify the script to support this, but I will provide 0 support on this type of configuration.
1) After line 266
cp "${VMX_PATH}" "${VM_BACKUP_DIR}"
cp ${VMX_DIR}/*.log ${VM_BACKUP_DIR}
cp ${VMX_DIR}/*.nvram ${VM_BACKUP_DIR}
${VMWARE_CMD} vmsvc/snapshot.remove ${VM_ID} > /dev/null 2>&1
${VMWARE_CMD} vmsvc/snapshot.removeall ${VM_ID} > /dev/null 2>&1
${VMWARE_CMD} vmsvc/snapshot.create ${VM_ID} vcb_snap VCB_BACKUP_${VM_NAME}_`date +%F` ${SNAP_MEMORY} > /dev/null 2>&1
chmod -R +rw ${VM_BACKUP_VOLUME}
There are actually 2 reasons why I don't support backup of VMs w/snapshots
1) Reason from previous reply
2) It's not easy using vimsh ... having said that, it's stupid simple using the official VI/vSphere API's which allows you to remove a snapshot based on a name. This can be seen with ghettoVCBg2 - Free alternative for backing up VMs in ESX(i) 3.5 and 4.x (no SSH console required!) if you take a look at the code, but again even with this version I do not support backups of a VMs with snapshots (going back to reason #1)
Having said all that, it's definitely possible with vimsh but you just have to figure out the index/child values which I thought I had figured out but it's really not worth it and again goes back to my reason #1
Glad the script is working out for you and the customization you're implementing for your specific environment.
Definitely keep an eye out in next few weeks for the next release, it'll be introducing some nice features ![]()
--William
Hi,
thanks a lot for this script.
It's working fine in our environnment but it take so long to backup.
In fact, i backup vms to an nfs share on a little nas (iomega storcenter pro ix4-100) which is very slow for read and write (even in ftp or smb mode).
so i realize that ghettoVCB.sh does the backup directly to this share and then compress the vm on the share (when i enable compress of course).
Is it possible to do the snapshot locally, compress the backup and then send it to share (then delete the local compressed backup). In this order, i will gain some time to backup vms.
The only thing i need is enough space for locally backing up the biggest vm.
thanks by advance.
ben
I've used a Iom200rl in the past and their NFS performance is not great. You should check how fast it transfers from the esx console (without using the script). Also you can tweak nas' exports config (async, no_wdelay, etc, but be careful with this, use at you own risk!) or try using jumbo frames, if your hardware supports it. I've experienced a huge increase of transfer rate with these.
Hi,
the transfer rate is not really a problem. The real problem of the iomega is the I/O of the disks.
The best solution will be to compress before send the backup to the nas. (if space is available of course)
with this, less data to send to the nas, less time to send it.
i will look for jumbo frame too (the esxi nic, the switch and the nas have to support it)
When I said transfer rate I didn't mean "network bandwidth". Jumbo frames can improve the situation if its related to network. Poor NFS performance can be related to network and to storage I/O; async and no_wdelay can improve the NFS performance when saving data.
To see which one you have to tweak you could do some testing with cat or dd with /dev/zero and /dev/null with ssh without compression and nfs. If it's fast (well, fast enough for a storcenter) then the bottleneck it's the NFS saving data and then those params I said above can make things a little better.
I think your proposal would require a major overhaul of the script. Meanwhile, if you have enough local space, you can set a local dir as VM_BACKUP_VOLUME, and after the script has ended, move the backups to the storcenter with a different script (quite easy to code because you can copy the rotation procedure from the original script).
thanks.
i will look deep in this jumbo frame. easy on the iomega (just one click to activate jumbo frame support), i've read that i need to create a new virtual switch on esxi and define the mtu size for frame. sounds a bit more complex.
i've just ended trying to backup four vms to the little nas, compressing each one.
i got a big vmdk that was not stored in the gzipped file, the script return this error: tar: cannot store file 'XXXXXXX/xxxx-flat.vmdk' of size 107374182400, aborting.
so i ended with a gzipped file of 104 Bytes.
i will look into the script to see how i can do a local save then copy over the nfs share, as you suggest.
Hi William,
I have the exact same problem as Davidpyper described in his post from 28 Sep 2009. I have been using your script for a while now and never had any problems. Since a couple of weeks the script sometimes "hangs" while removing a snapshot. If I look in VC I see a snapshot in the snapshot manager of that particulary date. If I remove the snapshot the script continues and starts snapshotting the upcoming VM's. Before the script starts there are NO snapshot present in VC. It is not consistent so I don't know where to look. Any idea where to look?
Thanks for the script.
Christian
I've not seen this issue from others and haven't been able to reproduce. Are there anything specific with this VM in particular or set of VMs? Have you tried to backup other VMs except for this one to see if it's only this VM?
Hmm - OK looking into this again. It always fails on the 3rd VM regardless of size of that VM or the preceeding VM.
I'm trying to backup one VM with two vmdk files. I've installed the latest GhettoVCB, but when I try to run "./GhettoVCB.sh serverlist" I get the following error:
/vmfs/volumes/48f62e13-c6958ca2-6bc2-0022198dec59 # ./ghettoVCB.sh serverlist
Skipping invalid VM '368'
Skipping invalid VM '384'
Skipping invalid VM '400'
Segmentation fault
1) Please wrap any output you have in code tags, makes it much more readable on the forums. Please refer to this document if you have any questions: http://communities.vmware.com/markuphelpfull.jspa
2) How many VMs do you have on this host?
3) Is this ESX(i) and what build/version?
4) Can you please run the following command and paste the results:
ESX
vmware-vim-cmd vmsvc/getallvms
vim-cmd vmsvc/getallvms
Hopefully this paste works better:
Great that policy based backup has been added.
The only thing still missing IMHO is the possibility to take a snapshort in powerdown state before backup. Depending on guest OS and running apps this is the only way to get a reliable backup. How about an additional setting TAKE_SNAPSHOT_ON_POWER_DOWN=1. Then the sequence would be as follows:
Power machine down,
Take snapshot,
Power up,
Take backup,
Remove snapshot
Taking a backup only with the setting POWER_VM_DOWN_BEFORE_BACKUP=1 can be quite time consuming and is not always an option.
IIRC this feature has been requested by two others. So how about?
Thanks again for that great software.
I've just released a new version of the script, please download this version and go over the documentation as there have been some changes on using the script. There were some issues that may have been fixed which might help resolve the issue you're running.
If you're still seeing the issue, please provide an execution run on the vm that is failing with both dryrun and debug mode.
Thanks
Sorry this feature will not be supported as mentioned in the past, there are no significant advantages to this and I'm not exactly sure what you're deeming "reliable backup". You're more than welcome to look at other Enterprise ready solutions if you need something more reliable ... and of course you're more than welcome to edit the script to fit your environment.
Thanks
I did not realize that it was mentioned in the past that it will not be supported, so I'm sorry for missing that. With "reliable backup" I don't want to say that ghettoVCB is not reliable, so don't feel offended. However depending on the apps and the os you are running you cannot always be sure that you have a consitent state on disk when taking a snapshot while the machine is running.
This is a similar thing like with VSS on MS Windows. Without apropriate VSS writer for certain apps you are running you cannot be sure that a consitent state is written on disk when you take a snapshot. As this mechanism (IPC between app, os and vmware) is missing on VMware (or at least I'm not aware of it) with certain apps (e.g. dbms) a snapshot will have a good chance to be corrupt on application level (on filesystem level it will be intact of course).
If I'm missing anything obvious please let me know.
Regards
I agree, but that's where enabling the quiesce of the snapshot comes into play and of course this is also OS dependent and if you have VMware Tools installed. You'll either use the default filesystem sync driver or VSS if you're on a Windows OS. Even with using other solutions like Veeam or vDR, you're still using a snapshot like solution and they also rely on quiescing the filesystem to ensure that you have a consistent backup.
Hope this helps
Ok not sure how exactly quiesce works with VMware. From what I found so far it seems that it triggers all VSS writers and so tries to ensure all data is written to disk before taking the snapshot. So if you have a system with VSS writers for all apps properly set up this should work. I will make some tests with that option to see if it works reliable. However I thik I will modify the scripts to support taking snapshots on power down state just to be on the safe side. Seems to be possible without big changes. IMHO this is still a good option as it ensures integrity and dramatically reduces downtime compared to taking a backup in power down state.
Thanks again for developing ghettoVCB and sharing it with the community.
Regards,
goppi.
That did it. I'm backing it up now. Thanks for your help on this and the new features.
I haven't tried the snapshot quiesce or snapshot memory, but if I'm running MS-SQL on this server is there a reason why I wouldn't use it? ( I already have VSS turned on)
Oh, one minor typo I found in the ghettVCB.sh file. You have "VMDK_FILES_TO_BACKUP=" inside the area that says not to edit below this line. No big deal, just thought you might want to know.
I work for a non-profit so we have little funds for IT. Your script has allowed us to evaluate Vmware and virtualization options. Thanks again.
Glad to hear the new release fixed the issues.
I would definitely do some research on backing up any database systems, but there shouldn't be any reason why it won't work and I'm sure others have done it. If you already have VMware Tools installed and have VSS enabled, then yes you should be using snapshot quiesce option, the memory really is more for testing purposes and since the .vmsd and .vmss is not backed up as it only pertains to the snaspshot created.
For a deep dive on how VMware snapshots works, take a look at this VMware KB: http://kb.vmware.com/kb/1015180
Regarding the variable, I meant to put it there ![]()
The reason is by default if you don't use individual VM backup policy, it'll backup all "valid" VMDK(s) ... there is no concept of an exclusion/inclusion list as that is only supported with backup policy for each VM.
The new script is very slick - thanks very much.
Just curious about these two lines from std out:
sleep: Interrupted system call
wc: standard input: Interrupted system call
Edit: I also note that the cron faq has not been updated to the new syntax e.g. "ghettoVCB.sh -f vmlist"
Glad to hear you're enjoying the new features of the script!
Regarding the output, I'm not sure where thats coming from ... sounds like something might have interrupted the syscall and hence the output. Could you provide more details about your environment, ESX(i) host, version, etc...? Are you able to consistently reproduce, without reproducibility, it'll be very hard for me to help troubleshoot.
Thanks for the doc info, I'll get that updated as soon as I get a chance.
I can reproduce my stupidity at will ![]()
As you can see below setting quiesce for a vm that is not enabled will give that type of output.
Not sure why it is a bit different to the original post.
Perhaps the script could read:
Quiesce snapshot option and the method in which the flushing occurs is dependent on OS and whether or not you have VMware Tools installed. There's actually 3 methods and VSS is Windows only, for a deep dive on how VMware snapshots works, take a look at this VMware KB: http://kb.vmware.com/kb/1015180
The interrupt you're seeing is within the busybox console (unspported shell). Have you tried disable VM_SNAPSHOT_MEMORY and just enabling VM_SNAPSHOT_QUIESCE?
Note: VM_SNAPSHOT_MEMORY will dump the VMs state at the time of the snapshot but is not used for the backup, this is primarily for testing purposes and with this option enabled your snapshot takes longer to create + additional room for the memory state file. Generally you'll just enable VM_SNAPSHOT_QUIESCE
Is this occurring with only this VM or others? How large is the VM and what is it's OS?
Here is the test run as you suggested - memory snap=off and quiesce =on
This is a centos 5.3 x86_64 approx 10GB - Vmware tools installed but not sync driver (i have to find out what that is ![]()
As you said it is quite a bit quicker with memory_snap off
esxi logs show:
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.497 116C0B90 info 'vm:/vmfs/volumes/4a7bc59f-d1dd8294-90ca-0019d1010534/PMOSTEST/PMOS.vmx' Trying quiesced snapshot via SYNC driver...
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.498 116C0B90 info 'DictionaryOptionsProvider(Config.GlobalSettings.)' Set called with key 'Config.GlobalSettings.guest.commands.sharedPolicyRefCount' value '1'
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.514 116C0B90 verbose 'vm:/vmfs/volumes/4a7bc59f-d1dd8294-90ca-0019d1010534/PMOSTEST/PMOS.vmx' Logging into guest.
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.516 11701B90 verbose 'vm:/vmfs/volumes/4a7bc59f-d1dd8294-90ca-0019d1010534/PMOSTEST/PMOS.vmx' Dummy foundry callback #0
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.516 116C0B90 verbose 'vm:/vmfs/volumes/4a7bc59f-d1dd8294-90ca-0019d1010534/PMOSTEST/PMOS.vmx' About to run script: /usr/sbin/pre-freeze-script all
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.520 2D3C2B90 verbose 'vm:/vmfs/volumes/4a7bc59f-d1dd8294-90ca-0019d1010534/PMOSTEST/PMOS.vmx' Dummy foundry callback #1
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.520 116C0B90 info 'vm:/vmfs/volumes/4a7bc59f-d1dd8294-90ca-0019d1010534/PMOSTEST/PMOS.vmx' Script /usr/sbin/pre-freeze-script not found in VM.
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.530 11701B90 verbose 'vm:/vmfs/volumes/4a7bc59f-d1dd8294-90ca-0019d1010534/PMOSTEST/PMOS.vmx' Dummy foundry callback #2
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.530 116C0B90 info 'vm:/vmfs/volumes/4a7bc59f-d1dd8294-90ca-0019d1010534/PMOSTEST/PMOS.vmx' About to engage SYNC driver, freeze Timeout 15 sec.
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.540 11701B90 verbose 'vm:/vmfs/volumes/4a7bc59f-d1dd8294-90ca-0019d1010534/PMOSTEST/PMOS.vmx' Dummy foundry callback #3
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.540 116C0B90 info 'vm:/vmfs/volumes/4a7bc59f-d1dd8294-90ca-0019d1010534/PMOSTEST/PMOS.vmx' Sync driver not installed or not supported in guest.
Nov 19 21:50:15 Hostd: 2009-11-19 21:50:15.541 116C0B90 info 'vm:/vmfs/volumes/4a7bc59f-d1dd8294-90ca-0019d1010534/PMOSTEST/PMOS.vmx' Starting to snapshot VM.
Yea when using the quiesce, it'll definitely be OS dependent. Look like in this case it was not able to use any of the drivers ...
Hi William,
I started using your backup/restore script some days ago. I'm using thick disks, backup up to thin disks. I've noticed that shrinking in the VMWare Tools decreases backupsize alot:
9,0G ./Test-1/Test-1-2009-11-22--1
12G ./Test-1/Test-1-2009-11-22--2
Where --2 is before shrinking in vmware tools and --1 after. Is there a chance to get the shrink process in your Backup script? I searched your script repository but didn't find a script to run before the backup.
Greets
Peter
any update on this? I still can't back up more than 2 VMs at a time.
Last week the Backup didn't complete, probably because I did not have sufficient disk space on the backup destination. I had to kill the ghettoVCB process. According to the Log it was stuck with removing the snapshot, but the VM still is snapshotted and I can't remove the snapshot with the VI client. How can I remove the snapshot manually?
Ok, just created a new snapshot manually and deleted all after it.
Can you define what you mean by shrinking of VMware Tools? Are you using all default backup options
VMs will always be backed up one at a time, since the backup is occurring on the Service Console or busybox console, resources are being taken up and you don't want to impact the performance of your hypervisor across other VMs during backups. There was never any plans to do simultaneous VM backups
right - I understand that. and the script is doing these sequentially so there should never be an issue - this is why I don't understand why it fails on VM #3.
Hi William,
Is in the vmware tools: http://www.vmware.com/support/ws5/doc/img/w_tools_shrink_supportedand.png
(Not my pic, googled it)
Using the "prepare to shrink" the Backup shrinks as seen above.
I found this thread - but I'm not sure how to wrap this up in a script...
http://communities.vmware.com/thread/230108
Greets
Peter
Edit:
And yes, i'm using all default - except for the location
Hi pebr,
A Workaround to "shrink" disks is to use "2gbsparse" as disk format for backup.
Yes, you will have many files but you will not have "empty space" ![]()
Seb = = = o>°o
Hi Sebastian,
I use thin as a target-disk - this should "shrink" to the same size as "2gbsparse" - unless the shrink-method is called before backup. Ether by hand or by script
Or should 2gbsparse be really "thiner" than thin?
Greets
Peter
This depends on the target. From my experience you will not see reduced size with thin when using Win2k3 NFS services as target. With 2gbsparse in contrast you do.
Regards
goppi
I'm using Linux as Target.
I see reduced size! Even with Thin:
Disk: 40GB
Backup before "Shrink" in VMWare Tools: 12GB
Backup after "Shrink" in VMWare Tools: 9GB
Source: Thick
Destination: Thin (both times)
Nobody but me was using the virtual machine at this time, no files deleted, backup started directly before and after "Shrink" - so the reduced size must be from this.
Greets
Peter
From the link you reference, it sounds like this is something thats available via the APIs ... but probably not directly available on the Service Console or busybox console. I'll take a look as time permits
You'll need to locate the vmid by running the following command:
vmware-vim-cmd vmsvc/getallvms | grep -i <vmname> | awk '{print $1}'
vmware-vim-cmd vmsvc/snapshot.remove <vmid>
vmware-vim-cmd vmsvc/snapshot.removeall
Please provide detail information about your environment and VM and run the backup with both debug and dryrun modes and remember to enclose the output in {code} tags. Can't help without more information and remember to always provide this if you run into any issues/bugs, "not working" is not sufficient.
Also have you tried re-arranging the order of the VMs, is it always the 3rd one? Any issues with storage connectivity? Please do some level of troubleshooting prior to the run to ensure this is not environment issues.
Thanks
Please advise on enabling debug AND dryrun modes.
FYI - have tested many potential issues, network etc. All looks OK. It is always the 3rd VM, regardless of the order of VMs and size of VMs
Hi,
I'm having some problems with the sleep iterations - its too fast...
2009-11-25 17:16:54 -- info: VM is still on - Iteration: 0 - sleeping for 60secs (Duration: 0 seconds)
2009-11-25 17:17:25 -- info: VM is still on - Iteration: 1 - sleeping for 60secs (Duration: 60 seconds)
Thanks for the info, I've just updated the script, it'll be sleep for 60seconds now per iteration. Remember this is controllable by modifying the variable called ITER_TO_WAIT_SHUTDOWN, by default it's set to 3 which means it'll sleep for 3 60-second iterations (3min) and you'll need to modify this based on your VMs/environment. If you need it to wait longer, go ahead and do a test manually and then configure it.
OK - latest update. I have pulled the very latest version of ghettoVCB.sh and the problem has gone away. All VMs are backing up 100% OK.
Hi,
I would like to backup a VM that has 2 vmdk on differents datastores. Is it possible?
I made the configuration file with the option: VMDK_FILES_TO_BACKUP = "all" and I got the backup of the vmdk on the VMX_DIR, only.
How can I do it?
Congratulations for your great job!!
As mentioned before this is supported. The question is .. do you actually have the other VMDK attached to the VM?
Please re-run the backup but with the dry run flag.
e.g.
[root@himalaya ~]# ./ghettoVCB.sh -f recoveryvm -d dryrun
2009-11-26 08:51:29 -- info: ============================== ghettoVCB LOG START ==============================
2009-11-26 08:51:29 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-26 08:51:29 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-26 08:51:29 -- info: CONFIG - DISK_BACKUP_FORMAT = zeroedthick
2009-11-26 08:51:29 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-26 08:51:29 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-26 08:51:29 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-26 08:51:29 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-11-26 08:51:29 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-26 08:51:29 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-26 08:51:29 -- info: CONFIG - LOG_LEVEL = dryrun
2009-11-26 08:51:29 -- info: CONFIG - BACKUP_LOG_OUTPUT = stdout
2009-11-26 08:51:29 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-11-26 08:51:29 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-26 08:51:29 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-11-26 08:51:33 -- dryrun: ###############################################
2009-11-26 08:51:33 -- dryrun: Virtual Machine: vm-1
2009-11-26 08:51:33 -- dryrun: VM_ID: 5584
2009-11-26 08:51:33 -- dryrun: VMX_PATH: /vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/vm-1/vm-1.vmx
2009-11-26 08:51:33 -- dryrun: VMX_DIR: /vmfs/volumes/himalaya-local-SATA.RE4-GP:Storage/vm-1
2009-11-26 08:51:33 -- dryrun: VMX_CONF: vm-1/vm-1.vmx
2009-11-26 08:51:33 -- dryrun: VMFS_VOLUME: himalaya-local-SATA.RE4-GP:Storage
2009-11-26 08:51:33 -- dryrun: VMDK(s):
2009-11-26 08:51:33 -- dryrun: /vmfs/volumes/4aa95d52-c297af51-90e2-003048d9586a/vm-1/vm-1.vmdk
2009-11-26 08:51:33 -- dryrun: vm-1.vmdk
2009-11-26 08:51:33 -- dryrun: ###############################################
2009-11-26 08:51:33 -- info: ============================== ghettoVCB LOG END ================================
Thanks for your reply.
I see only one VMDK as you can see:
19 -- info: ============================== ghettoVCB LOG START ==============================
2009-11-26 18:21:21 -- info: CONFIG - USING CONFIGURATION FILE = backup_config/Virtual Center Server
2009-11-26 18:21:21 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/Backup Storage/VMS_BACKUP
2009-11-26 18:21:21 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-26 18:21:21 -- info: CONFIG - DISK_BACKUP_FORMAT = thin
2009-11-26 18:21:21 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-26 18:21:22 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-26 18:21:22 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-26 18:21:22 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 4
2009-11-26 18:21:22 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-26 18:21:22 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-26 18:21:22 -- info: CONFIG - LOG_LEVEL = dryrun
2009-11-26 18:21:22 -- info: CONFIG - BACKUP_LOG_OUTPUT = /vmfs/volumes/Backup Storage/VMS_BACKUP/ghettoVCB.log
2009-11-26 18:21:22 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 1
2009-11-26 18:21:22 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-26 18:21:22 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-11-26 18:21:22 -- dryrun: ###############################################
2009-11-26 18:21:22 -- dryrun: Virtual Machine: Virtual Center Server
2009-11-26 18:21:22 -- dryrun: VM_ID: 32
2009-11-26 18:21:22 -- dryrun: VMX_PATH: /vmfs/volumes/VirtualMachines Storage/Virtual Center Server/Virtual Center Server.vmx
2009-11-26 18:21:22 -- dryrun: VMX_DIR: /vmfs/volumes/VirtualMachines Storage/Virtual Center Server
2009-11-26 18:21:22 -- dryrun: VMX_CONF: Virtual Center Server/Virtual Center Server.vmx
2009-11-26 18:21:22 -- dryrun: VMFS_VOLUME: VirtualMachines Storage
2009-11-26 18:21:22 -- dryrun: VMDK(s):
2009-11-26 18:21:23 -- dryrun: Virtual Center Server.vmdk
2009-11-26 18:21:23 -- dryrun: ###############################################
2009-11-26 18:21:23 -- info: ============================== ghettoVCB LOG END ================================
I don't know why the other VMDK, called "Virtual Center Server_1.vmdk", is not listed.
The location of the other VMDK is "/vmfs/volumes/System Storage/Virtual Center Server/Virtual Center Server_1.vmdk"
Are you 100% sure that the VM actually has the 2nd VMDK attached? If it's been removed, but not deleted it will not be enabled within the .vmx and the script will not see the 2nd VMDK.
I've just replicated a VM with a similar setup as yours and I'm able to see both VMDK(s) which is stored on two different datastores:
[root@himalaya ~]# ./ghettoVCB.sh -f recoveryvm -d dryrun
2009-11-26 10:26:21 -- info: ============================== ghettoVCB LOG START ==============================
2009-11-26 10:26:21 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-11-26 10:26:21 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-11-26 10:26:21 -- info: CONFIG - DISK_BACKUP_FORMAT = zeroedthick
2009-11-26 10:26:21 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-11-26 10:26:21 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-11-26 10:26:21 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-11-26 10:26:21 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-11-26 10:26:21 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-11-26 10:26:21 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-11-26 10:26:21 -- info: CONFIG - LOG_LEVEL = dryrun
2009-11-26 10:26:21 -- info: CONFIG - BACKUP_LOG_OUTPUT = stdout
2009-11-26 10:26:21 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-11-26 10:26:21 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-11-26 10:26:21 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-11-26 10:26:25 -- dryrun: ###############################################
2009-11-26 10:26:25 -- dryrun: Virtual Machine: stupid vm with spaces
2009-11-26 10:26:25 -- dryrun: VM_ID: 5616
2009-11-26 10:26:25 -- dryrun: VMX_PATH: /vmfs/volumes/himalaya-local-SAS.Savvio/VirtualMachines Storage/stupid vm with spaces/stupid vm with spaces.vmx
2009-11-26 10:26:25 -- dryrun: VMX_DIR: /vmfs/volumes/himalaya-local-SAS.Savvio/VirtualMachines Storage/stupid vm with spaces
2009-11-26 10:26:25 -- dryrun: VMX_CONF: VirtualMachines Storage/stupid vm with spaces/stupid vm with spaces.vmx
2009-11-26 10:26:25 -- dryrun: VMFS_VOLUME: himalaya-local-SAS.Savvio
2009-11-26 10:26:25 -- dryrun: VMDK(s):
2009-11-26 10:26:25 -- dryrun: /vmfs/volumes/4a48004d-f9af7fa0-5bbf-003048d9586b/System Storage/stupid vm with spaces/stupid vm with spaces_1.vmdk
2009-11-26 10:26:25 -- dryrun: stupid vm with spaces.vmdk
2009-11-26 10:26:25 -- dryrun: ###############################################
2009-11-26 10:26:25 -- info: ============================== ghettoVCB LOG END ================================
I've got it. The disk is independent, and the ghettoVCB doesn't let you backup independent disks (independent VMDKs).
Thank you, very much!!
I like to e-mail the logfile to mysefl so i check up on it, instead of manually go looking for it.
I have ESXI and i don't know wether it can e-mail by itself. But i used a linux VM i am running to pull the logfile and mail it to me. The linux VM is set up with sendmail and mailhost is configured.
I have altered the GhettoVCB script to make the backups & logiles use this date syntax date +%F. I find it easier to read for humans. Please adjust the youruser and yourpass to valid login credentials for browsing the datastore trough https. Usually the user you login with directly on the ESXi. Also adjust the you@domain.tld, place your e-mail address. Pretty simple & basic but it works excellent. Last point, adjust the 192.168.1.253 to your ESXi's IP address.
#grab esxi backup log file and mail it v0.1
#Note the WGET part should be 1 line, no line breaks
#- Adjust the youruser & yourpass to valid credentials for logging in to ESXi (browse the datastore)
#- Adjust the IP address (192.168.1.253) to your ESXi ip address
#- In the wget line below my logs where located in a folder called backup on a datastore called 750GBdisk2
#- You could check the syntax of the link by browsing to your datastore and locate the backup log files then look at the addressbar
cd /tmp
wget "https://192.168.1.253/folder/backup/ghettoVCB-backup-$(date +\%F).log?dcPath=ha-datacenter&dsName=750GBdisk2" --user youruser --password yourpass --no-check-certificate
cat /tmp/ghettoVCB* | mail -s "Backup log ESXi4" you@domain.tld
rm -rf /tmp/ghettoVCB*
3 3 * * * /root/mailesxilog > /dev/null 2>&1
Hi lamw,
I started using the script on a regular base now and started to use Stangobien's (thanks!) script to pull the logfiles. Is there a way to add a loglevel not writing every %-step to the logfile? I'm backing up 5 machines - and just the %-lines are 500 lines... Getting a bit hard to read ![]()
Greets
Peter
I primarily have that information when users run into problems or provide a little bit more detail over the debugging mode. The default info mode is pretty quiet minus the configuration dump at the top, you can always parse out any lines that contains CONFIG which should reduce the number of the lines OR you can comment out the function call dumpVMConfigurations() depending if you're using individual VM backup policy or not.
I'm using the latest version of ghettVCB.sh, but my script will only backup the first VM in the list. I've tried changing the order in my server list, but still will only backup first VM. I can run a dryrun of the script and it sees the other VMs. I created the server list in Vi so I don't think it's a formatting issue.
I'm running ESXi 3.5
Please edit your response before I take a look, no need to paste my entire script. You can say specify that you're using the latest version which can also be confirmed by looking at the modified date when running the script w/o any parameters.
Nope - working like a dream
Hi, thanks for you reply, just removed my comment, it was me s******* up, sorry :o)
I'm still a little confused on why you're having this peculiar issue .... I'm going back through the replies and I see a message from you on Nov 18, 2009 6:59 AM stating that the new script has resolved the problem and you were able to take successful backups?
It sounds like this is may be something new? Can you take backups of each individual VM? If so, please to a full run and provide the output with debug mode enabled, I'll need to see what errors you're seeing and remember to wrap you output in {code} tags
The problem I had 11/18 was related to multiple vmdk files not backing up. I didn't test the script with more than one VM until now. It appears that after the first VM backups up and compresses that the PUTTY session times out.
Here is my output:
I already see a problem and this looks like an environment issue:
I also encounter sporadic input/output errors and try to trackdown the problem.
Could you try the following and report back:
Do not us a persistent NFS datastore configured from within VI-Client but let it mount by the script using the ENABLE_NON_PERSISTENT_NFS variable.
So far it seems that this cured the problem in our case.
BTW: Has anybody successfully mounted an NFS datastore by using the busybox mount command. The reason is that the mount command supports async mode which could help increasing backup throughput.
goppi.
hi,
first: please excuse my english, it´s not very well.
second: thanks for the script to backup vms on an esxi.
i have a problem with the script:
i loaded the script (date 11/01/2008) and made my changes (nfs, rotation, compression,...). i thougt the script works fine, but after three days the script stopped.
in log-file i found "Snapshot found for VM01, backup will not take place". i found an answer which describes, i have to create a snapshot in vSphere and than remove all snapshots.
after this, the backup worked for two days and i got the same error.
i never made a snapshot manually. so it looks like the snapshot which is created by the script will not be removed.
i found a workaround from davidpyper (Sep 28, 2009) but i did not try this.
i will not make snapshots manually in future, so i think, i can try this workaround, can´t i?
i have to add i´m a unix noob.
but lamw writes "...snapshot.removeall is a blocking function because snapshot.remove is not and you could run into a situation where you'll have multiple backups completing and committing multiple snapshots which could hinder performance."
im not shure if i shoud try this...
but i don´t know why the snapshots created by the script will not be removed and i can´t remove these snapshots every day manually...
so, has anyone an idea what i can do?
(i hope my english was good enough that anyone understand my problem)
Hi,
I think I understand the general issue, snapshots not being removed ... I ask that issues, you run the script in debugging mode and dryrun mode and paste the output ENSURING you wrap them in {code} tags for readability. Without any logs, I can't really help you and also make sure you're using the latest version of the script AND that if enable VM_SNAPSHOT_MEMORY, both the creation/commit of the snapshot may take much longer and in general, this should be disabled. I only bring this up because there might be something funky going on when comitting the snapshot and perhaps it never finishes and hence the snapshot is left behind.
In general, this should not be the case as in the current implementation of the script, it should loop in definite to try to commit the snapshot but if it runs out of space or something, it may not finish the commit.
Thanks
goppi - That worked! I enabled the non persistent settings for NFS.
I also turned off compression so I'll turn that back on a test again to make sure, but it seems to be working.
thanks.
Thankyou, Thankyou, Thankyou!
This script does exactly what I needed, I have just backed up my entire VM Inventory on My ESXi 4 server in less than 15 minutes and it didn't cost me anything!
I really appreciate all your hard work on this script, your community salutes you!
Your new biggest fan
Scott
Glad to hear everything is working out
hi lamw,
thanks für yoru response and help.
i saw, i had a very old version from the script.
now i downloaded the newest from here. but i get errors when i try to execute the script:
/backup # ./ghettoVCB.sh -f vmserver.list
: not found.sh: line 6:
: not found.sh: line 8:
: not found.sh: line 11:
: not found.sh: line 18:
: not found.sh: line 21:
: not found.sh: line 26:
: not found.sh: line 29:
: not found.sh: line 34:
: not found.sh: line 38:
: not found.sh: line 41:
: not found.sh: line 45:
: not found.sh: line 48:
: not found.sh: line 51:
: not found.sh: line 54:
: not found.sh: line 59:
: not found.sh: line 61:
: not found.sh: line 64:
: not found.sh: line 67:
: not found.sh: line 70:
: not found.sh: line 73:
: not found.sh: line 75:
: not found.sh: line 76:
: not found.sh: line 78:
: not found.sh: line 83:
: not found.sh: line 86:
: not found.sh: line 87:
###############################################################################
#
Hello everybody!
First of all: Thank you for that script.
But I have a problem with it:
I have a backup list with the following content:
VM1
VM2
VM3
Without compression everything works fine.
But if I enabel compression, only the first vm in the list is backuped.
The last entry of the logfiles shows:
"Compressing..."
After this there is no more entry for another vm and the script seems to stop.
What could be the reason?
Greetz,
Wolfsrudel
Please post the full debug / dry run log, without additional information, it's hard to help. Also remember to wrap the output in {code} tags that is ... use "squiggly braces"
How big are each of the VM backups? We've verified compression up an initial VM up to 100GB but nothing larger, the other thing is are you doing this manually or automating it through a cron or scheduled task, ensure you're not getting disconnected due to any type of timeouts as the compression does take awhile and ensure you have sufficient space on your destination storage
I'm trying to backup a VM with Win03Server but I have some problem.
It has just one thik hard disk.
This is the debug log
2009-12-10 11:38:55 -- info: ============================== ghettoVCB LOG START ==============================
2009-12-10 11:38:55 -- debug: HOST BUILD: VMware ESXi 4.0.0 build-181792
2009-12-10 11:38:55 -- debug: HOSTNAME: DELLESX.gruppoanthea.local
2009-12-10 11:38:56 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-12-10 11:38:56 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 1
2009-12-10 11:38:56 -- info: CONFIG - DISK_BACKUP_FORMAT = zeroedthick
2009-12-10 11:38:56 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-12-10 11:38:56 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-12-10 11:38:56 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-12-10 11:38:57 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-12-10 11:38:57 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-12-10 11:38:57 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-12-10 11:38:57 -- info: CONFIG - LOG_LEVEL = debug
2009-12-10 11:38:57 -- info: CONFIG - BACKUP_LOG_OUTPUT = web01.log
2009-12-10 11:38:58 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-12-10 11:38:58 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-12-10 11:38:58 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-12-10 11:39:01 -- info: Initiate backup for web01
2009-12-10 11:39:01 -- info: Creating Snapshot "ghettoVCB-snapshot-2009-12-10" for web01
2009-12-10 11:39:03 -- debug: Waiting for snapshot "ghettoVCB-snapshot-2009-12-10" to be created
2009-12-10 11:39:03 -- debug: Snapshot timeout set to: 900 seconds
2009-12-10 11:39:05 -- debug: Waiting for snapshot creation to be completed - Iteration: 0 - sleeping for 60secs (Duration: 0 seconds)
Failed to clone disk : The file already exists (39).
Destination disk format: VMFS zeroedthick
Cloning disk '/vmfs/volumes/datastore1/web01/web01.vmdk'...
2009-12-10 11:40:11 -- info: Removing snapshot from web01 ...
P.s. I backup other 10 VMs on the same ESX without problems
Looks like the issue is that the VM is taking way to long on creating the snapshot and the default timeout is set to 900secs (15min). How much memory does this VM have? Can you try to manually create a snapshot and monitor the time of the request and the time of completion. This is why it's failing the backup
The VM has only 512 Mb of RAM
I manually created a snapshot in less than 3 minutes so no timeout problems
Interesting, something must have caused it to fail on the snapshot creation. You mentioned you backed up 10 other VMs perfectly fine, when this issue occurred was this part of an overall backup with 10 systems within a list? Have you tried to isolate it down to just this VM and do a single backup with just this VM?
Yes it is a part of an overall backup with 10 VMs.
I tried to isolate it but the problem still remain
Please post a an execute run with only this single VM with both debug and dryrun mode. Could you also elaborate on what this VM is running? OS, etc?
The VM is Windows server 2003 enterprise with 512 mb ram
I isolated the backup
In debug the log seems ok
2009-12-14 07:33:28 -- info: ============================== ghettoVCB LOG START ==============================
2009-12-14 07:33:28 -- debug: HOST BUILD: VMware ESXi 4.0.0 build-181792
2009-12-14 07:33:28 -- debug: HOSTNAME: DELLESX.gruppoanthea.local
2009-12-14 07:33:29 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-12-14 07:33:29 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 1
2009-12-14 07:33:29 -- info: CONFIG - DISK_BACKUP_FORMAT = zeroedthick
2009-12-14 07:33:29 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-12-14 07:33:29 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-12-14 07:33:29 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-12-14 07:33:30 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-12-14 07:33:30 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-12-14 07:33:31 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-12-14 07:33:31 -- info: CONFIG - LOG_LEVEL = debug
2009-12-14 07:33:31 -- info: CONFIG - BACKUP_LOG_OUTPUT = web01Debug.log
2009-12-14 07:33:31 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-12-14 07:33:31 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-12-14 07:33:32 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-12-14 07:33:35 -- info: Initiate backup for web01
2009-12-14 07:33:35 -- info: Creating Snapshot "ghettoVCB-snapshot-2009-12-14" for web01
2009-12-14 07:33:38 -- debug: Waiting for snapshot "ghettoVCB-snapshot-2009-12-14" to be created
2009-12-14 07:33:38 -- debug: Snapshot timeout set to: 900 seconds
2009-12-14 07:33:39 -- debug: Waiting for snapshot creation to be completed - Iteration: 0 - sleeping for 60secs (Duration: 0 seconds)
Destination disk format: VMFS zeroedthick
Cloning disk '/vmfs/volumes/datastore1/web01/web01.vmdk'...
Clone: 0% done.
Clone: 1% done.
Clone: 2% done.
Clone: 3% done.
Clone: 4% done.
Clone: 5% done.
Clone: 6% done.
Clone: 7% done.
Clone: 8% done.
Clone: 9% done.
Clone: 10% done.
Clone: 11% done.
Clone: 12% done.
Clone: 13% done.
Clone: 14% done.
Clone: 15% done.
Clone: 16% done.
Clone: 17% done.
Clone: 18% done.
Clone: 19% done.
Clone: 20% done.
Clone: 21% done.
Clone: 22% done.
Clone: 23% done.
Clone: 24% done.
Clone: 25% done.
Clone: 26% done.
Clone: 27% done.
Clone: 28% done.
Clone: 29% done.
Clone: 30% done.
Clone: 31% done.
Clone: 32% done.
Clone: 33% done.
Clone: 34% done.
Clone: 35% done.
Clone: 36% done.
Clone: 37% done.
Clone: 38% done.
Clone: 39% done.
Clone: 40% done.
Clone: 41% done.
Clone: 42% done.
Clone: 43% done.
Clone: 44% done.
Clone: 45% done.
Clone: 46% done.
Clone: 47% done.
Clone: 48% done.
Clone: 49% done.
Clone: 50% done.
Clone: 51% done.
Clone: 52% done.
Clone: 53% done.
Clone: 54% done.
Clone: 55% done.
Clone: 56% done.
Clone: 57% done.
Clone: 58% done.
Clone: 59% done.
Clone: 60% done.
Clone: 61% done.
Clone: 62% done.
Clone: 63% done.
Clone: 64% done.
Clone: 65% done.
Clone: 66% done.
Clone: 67% done.
Clone: 68% done.
Clone: 69% done.
Clone: 70% done.
Clone: 71% done.
Clone: 72% done.
Clone: 73% done.
Clone: 74% done.
Clone: 75% done.
Clone: 76% done.
Clone: 77% done.
Clone: 78% done.
Clone: 79% done.
Clone: 80% done.
Clone: 81% done.
Clone: 82% done.
Clone: 83% done.
Clone: 84% done.
Clone: 85% done.
Clone: 86% done.
Clone: 87% done.
Clone: 88% done.
Clone: 89% done.
Clone: 90% done.
Clone: 91% done.
Clone: 92% done.
Clone: 93% done.
Clone: 94% done.
Clone: 95% done.
Clone: 96% done.
Clone: 97% done.
Clone: 98% done.
Clone: 99% done.
Clone: 100% done.
2009-12-14 09:54:26 -- info: Removing snapshot from web01 ...
But in the console I can see this error
./ghettoVCB.sh: line 735: syntax error: /vmfs/volumes/VMBACKUP/ESX15/web01/web01-2009-11-14+1
This is the dryrun log
2009-12-11 16:43:40 -- info: ============================== ghettoVCB LOG START ==============================
2009-12-11 16:43:40 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/dlgCore-NFS-bigboi.VM-Backups/WILLIAM_BACKUPS
2009-12-11 16:43:41 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 1
2009-12-11 16:43:41 -- info: CONFIG - DISK_BACKUP_FORMAT = zeroedthick
2009-12-11 16:43:41 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-12-11 16:43:41 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-12-11 16:43:42 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-12-11 16:43:42 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-12-11 16:43:43 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-12-11 16:43:43 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-12-11 16:43:44 -- info: CONFIG - LOG_LEVEL = dryrun
2009-12-11 16:43:44 -- info: CONFIG - BACKUP_LOG_OUTPUT = web01DryRun.log
2009-12-11 16:43:44 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-12-11 16:43:44 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-12-11 16:43:44 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-12-11 16:43:46 -- dryrun: ###############################################
2009-12-11 16:43:47 -- dryrun: Virtual Machine: web01
2009-12-11 16:43:47 -- dryrun: VM_ID: 64
2009-12-11 16:43:47 -- dryrun: VMX_PATH: /vmfs/volumes/datastore1/web01/web01.vmx
2009-12-11 16:43:48 -- dryrun: VMX_DIR: /vmfs/volumes/datastore1/web01
2009-12-11 16:43:48 -- dryrun: VMX_CONF: web01/web01.vmx
2009-12-11 16:43:49 -- dryrun: VMFS_VOLUME: datastore1
2009-12-11 16:43:49 -- dryrun: VMDK(s):
2009-12-11 16:43:49 -- dryrun: web01.vmdk
2009-12-11 16:43:49 -- dryrun: ###############################################
2009-12-11 16:43:51 -- info: ============================== ghettoVCB LOG END ================================
Yea I don't see anything wrong with the logs either, but when you get anything relating to "+X" where X is some number, it's probably around the rotation function where it's renaming and deleting older backups. I don't see anything odd about your VM backup, so I'll have to try to reproduce this if I can in my lab.
I see this as your ESXi build: VMware ESXi 4.0.0 build-181792
What ESXi 4 version is this? update 1? is it patched? I'll need to try to duplicate the exact version to see if there's been any odd changes in the busybox console (which I hope isn't the case).
I've tried searching through the comments for an answer.. sorry If this is a repeat question and thank you for this great script.
I have 4 ESX 3.5 servers using this script with great success so far. My question is how can I generate the vm_backup_list dynamically. VMGuests often move around from host to host and each time I have to update the backup list on all 4 hosts same when I create a new VMGuest. is there a way to generate the backup list dynamically?
thnks....
Majority of the users out there do not have vCenter and the script is executed on a per host basis w/o vMotion. Having said that, I know there are a few out there that run into this problem and to tell you the truth, this is not something I've not tested.
You can dynamically generate the list, but my fear is that if could be the case that the VM is backed up, it migrates and then some other host now sees this VM and tries to back it up. Basically you would some logic to keep track of what VMs have been backed up, perhaps an exclusion list for the given day/etc.
To dump out all the VMs residing on a given host is pretty trivial and if you're on the classic ESX, vmware-cmd -l can do it but if you just want the VM name which is eventually feed into the script to process, you can just use vimsh by doing something like:
vmware-vim-cmd vmsvc/getallvms | grep -v Vmid | awk '{print $2}' | sed '/^$/d'
That's a Vmware ESXi patched but I had this problem also with older release.
I can try with the update 1 in the next days but I don't think that's a problem releated with the release of vmware.
I think that the problem is when renaming and deleting. Infact it create the backup files that are perfect but it leave the old backup folder.
hi,
i still have the problems with the snapshots:
sometimes the snapshots will be removed and sometimes not...
here the logs:
2009-12-15 10:25:01 -- info: ============================== ghettoVCB LOG START ==============================
2009-12-15 10:25:01 -- debug: HOST BUILD: VMware ESXi 4.0.0 build-171294
2009-12-15 10:25:01 -- debug: HOSTNAME: ESXi01-AIC.Domain.de
2009-12-15 10:25:01 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/QNAP01-AIC
2009-12-15 10:25:01 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-12-15 10:25:01 -- info: CONFIG - DISK_BACKUP_FORMAT = zeroedthick
2009-12-15 10:25:01 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-12-15 10:25:01 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-12-15 10:25:01 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-12-15 10:25:01 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-12-15 10:25:01 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-12-15 10:25:01 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-12-15 10:25:01 -- info: CONFIG - LOG_LEVEL = debug
2009-12-15 10:25:01 -- info: CONFIG - BACKUP_LOG_OUTPUT = /tmp/ghettoVCB2.log
2009-12-15 10:25:01 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-12-15 10:25:01 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-12-15 10:25:01 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-12-15 10:25:03 -- info: Initiate backup for AIC-KAV01
2009-12-15 10:25:03 -- info: Creating Snapshot "ghettoVCB-snapshot-2009-12-15" for AIC-KAV01
2009-12-15 10:25:03 -- debug: Waiting for snapshot "ghettoVCB-snapshot-2009-12-15" to be created
2009-12-15 10:25:03 -- debug: Snapshot timeout set to: 900 seconds
Destination disk format: VMFS zeroedthick
Cloning disk '/vmfs/volumes/datastore1/AIC-KAV01/AIC-KAV01.vmdk'...
Clone: 100% done.
2009-12-15 10:38:44 -- info: Removing snapshot from AIC-KAV01 ...
2009-12-15 10:38:50 -- info: Backup Duration: 13.78 Minutes
2009-12-15 10:38:50 -- info: Successfully completed backup for AIC-KAV01!
2009-12-15 10:38:50 -- info: Snapshot found for VS01-Versand, backup will not take place
2009-12-15 10:38:50 -- info: ============================== ghettoVCB LOG END ================================
2009-12-15 10:51:32 -- info: ============================== ghettoVCB LOG START ==============================
2009-12-15 10:51:32 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/QNAP01-AIC
2009-12-15 10:51:32 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-12-15 10:51:32 -- info: CONFIG - DISK_BACKUP_FORMAT = zeroedthick
2009-12-15 10:51:32 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-12-15 10:51:32 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-12-15 10:51:32 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-12-15 10:51:32 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-12-15 10:51:32 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5
2009-12-15 10:51:32 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15
2009-12-15 10:51:32 -- info: CONFIG - LOG_LEVEL = dryrun
2009-12-15 10:51:32 -- info: CONFIG - BACKUP_LOG_OUTPUT = /tmp/ghettoVCB3.log
2009-12-15 10:51:32 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0
2009-12-15 10:51:32 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0
2009-12-15 10:51:32 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all
2009-12-15 10:51:33 -- dryrun: ###############################################
2009-12-15 10:51:33 -- dryrun: Virtual Machine: AIC-KAV01
2009-12-15 10:51:33 -- dryrun: VM_ID: 16
2009-12-15 10:51:33 -- dryrun: VMX_PATH: /vmfs/volumes/datastore1/AIC-KAV01/AIC-KAV01.vmx
2009-12-15 10:51:33 -- dryrun: VMX_DIR: /vmfs/volumes/datastore1/AIC-KAV01
2009-12-15 10:51:33 -- dryrun: VMX_CONF: AIC-KAV01/AIC-KAV01.vmx
2009-12-15 10:51:33 -- dryrun: VMFS_VOLUME: datastore1
2009-12-15 10:51:33 -- dryrun: VMDK(s):
2009-12-15 10:51:33 -- dryrun: AIC-KAV01.vmdk
2009-12-15 10:51:33 -- dryrun: ###############################################
2009-12-15 10:51:33 -- dryrun: ###############################################
2009-12-15 10:51:33 -- dryrun: Virtual Machine: VS01-Versand
2009-12-15 10:51:33 -- dryrun: VM_ID: 48
2009-12-15 10:51:33 -- dryrun: VMX_PATH: /vmfs/volumes/datastore1/VS01-Versand/VS01-Versand.vmx
2009-12-15 10:51:33 -- dryrun: VMX_DIR: /vmfs/volumes/datastore1/VS01-Versand
2009-12-15 10:51:33 -- dryrun: VMX_CONF: VS01-Versand/VS01-Versand.vmx
2009-12-15 10:51:33 -- dryrun: VMFS_VOLUME: datastore1
2009-12-15 10:51:33 -- dryrun: VMDK(s):
2009-12-15 10:51:33 -- dryrun: VS01-Versand-000002.vmdk
2009-12-15 10:51:33 -- dryrun: ###############################################
2009-12-15 10:51:33 -- info: ============================== ghettoVCB LOG END ================================
rm: cannot remove '/vmfs/volumes/QNAP01-AIC/AIC-KAV01/AIC-KAV01-2009-12-14--3/AIC-KAV01-flat.vmdk': No such file or directory
rm: cannot remove '/vmfs/volumes/QNAP01-AIC/VS01-Versand/VS01-Versand-2009-12-15--3/VS01-Versand-flat.vmdk': Input/output error
2009-12-15 12:07:22 -- info: ============================== ghettoVCB LOG START ==============================
2009-12-15 12:07:22 -- debug: HOST BUILD: VMware ESXi 4.0.0 build-171294
2009-12-15 12:07:22 -- debug: HOSTNAME: ESXi01-AIC.Domain.de
2009-12-15 12:07:22 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/QNAP01-AIC
2009-12-15 12:07:22 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3
2009-12-15 12:07:22 -- info: CONFIG - DISK_BACKUP_FORMAT = zeroedthick
2009-12-15 12:07:22 -- info: CONFIG - ADAPTER_FORMAT = buslogic
2009-12-15 12:07:22 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0
2009-12-15 12:07:22 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0
2009-12-15 12:07:22 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3
2009-12-15 12:07:22 -- info
How can i edit it to run on VIMA?