VMware ESXi 5.1 U1で動作している仮想マシンのバックアップに無償のghettoVCBを利用していますが、バージョンアップしてESXi 5.1対応になっていましたので入れ替えました
ghettoVCB on VMware ESXi 5.1
http://www.rootlinks.net/2012/09/20/ghettovcb-on-vmware-esxi-5-1/
ghettoVCB.sh – Free alternative for backing up VM’s for ESX(i) 3.5, 4.x & 5.x
http://communities.vmware.com/docs/DOC-8760
- Support for ESXi 5.1 NEW!
- Support for individual VM backup via command-line NEW!
- Support VM(s) with existing snapshots NEW!
- Support mulitple running instances of ghettoVCB NEW!(Experimental Suppport)
- Configure VM shutdown/startup order NEW!
- Support changing custom VM name during restore NEW!
Download
https://github.com/lamw/ghettoVCB
- ダウンロード
- ESXiホストにアップロード
- 展開
- 実行権限を追加
- コンフィグファイル編集
- バックアップ
- バックアップファイルの確認
上記GitHubサイトより最新のzipファイルをダウンロードします
ダウンロードは[ZIP]をクリックすればダウンロードできます
ダウンロードしたghetto-master.zipをsftpやVMware vSphere Clientを使ってESXiホストのデータストアにアップロードします
ghetto-master.zipを展開します
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
~ # cd /vmfs/volumes/datastore /vmfs/volumes/datastore # ls -l -rw------- 1 root root 20060 May 13 06:35 ghettoVCB-master.zip /vmfs/volumes/datastore # unzip ghettoVCB-master.zip Archive: ghettoVCB-master.zip creating: ghettoVCB-master/ inflating: ghettoVCB-master/README inflating: ghettoVCB-master/ghettoVCB-restore.sh inflating: ghettoVCB-master/ghettoVCB-restore_vm_restore_configuration_template inflating: ghettoVCB-master/ghettoVCB-vm_backup_configuration_template inflating: ghettoVCB-master/ghettoVCB.conf inflating: ghettoVCB-master/ghettoVCB.sh |
Shell Scriptに実行権限を与えます
1 2 3 4 5 6 7 8 9 10 11 12 13 |
/vmfs/volumes/datastore # cd ghettoVCB-master/ /vmfs/volumes/datastore/ghettoVCB-master # chmod +x ghettoVCB.sh /vmfs/volumes/datastore/ghettoVCB-master # chmod +x ghettoVCB-restore.sh /vmfs/volumes/datastore/ghettoVCB-master # ls -l -rw-r--r-- 1 root root 281 May 13 06:40 README -rwxr-xr-x 1 root root 17189 May 13 06:40 ghettoVCB-restore.sh -rw-r--r-- 1 root root 309 May 13 06:40 ghettoVCB-restore_vm_restore_configuration_template -rw-r--r-- 1 root root 356 May 13 06:40 ghettoVCB-vm_backup_configuration_template -rw-r--r-- 1 root root 712 May 13 06:40 ghettoVCB.conf -rwxr-xr-x 1 root root 61959 May 13 06:40 ghettoVCB.sh |
実行時に指定するコンフィグファイルを編集します
【ghettoVCB.conf】
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
ENABLE_COMPRESSION=0
VM_SNAPSHOT_MEMORY=0
VM_SNAPSHOT_QUIESCE=0
ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP=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
SNAPSHOT_TIMEOUT=15
EMAIL_LOG=0
EMAIL_SERVER=auroa.primp-industries.com
EMAIL_SERVER_PORT=25
EMAIL_DELAY_INTERVAL=1
EMAIL_TO=auroa@primp-industries.com
EMAIL_FROM=root@ghettoVCB
WORKDIR_DEBUG=0
VM_SHUTDOWN_ORDER=
VM_STARTUP_ORDER=
取り敢えずVM_BACKUP_VOLUME=の部分を書き換えてバックアップファイルの保存先を指定すれば実行させることができると思います
私はFreeNASで構築したNASをNFSで利用できるようにしてあるのでVM_BACKUP_VOLUME=/vmfs/volumes/FreeNAS/vm_backup
と書き換えてあります
試しに仮想マシンをバックアップしてみます
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
/vmfs/volumes/datastore/ghettoVCB-master # ./ghettoVCB.sh -g ghettoVCB.conf -m NAS4Free Logging output to "/tmp/ghettoVCB-2013-05-13_11-12-07-1049501.log" ... 2013-05-13 11:12:08 -- info: ============================== ghettoVCB LOG START ============================== 2013-05-13 11:12:08 -- info: CONFIG - USING GLOBAL GHETTOVCB CONFIGURATION FILE = ghettoVCB.conf 2013-05-13 11:12:08 -- info: CONFIG - VERSION = 2013_01_11_0 2013-05-13 11:12:08 -- info: CONFIG - GHETTOVCB_PID = 1049501 2013-05-13 11:12:08 -- info: CONFIG - VM_BACKUP_VOLUME = /vmfs/volumes/FreeNAS/vm_backup 2013-05-13 11:12:08 -- info: CONFIG - VM_BACKUP_ROTATION_COUNT = 3 2013-05-13 11:12:08 -- info: CONFIG - VM_BACKUP_DIR_NAMING_CONVENTION = 2013-05-13_11-12-07 2013-05-13 11:12:08 -- info: CONFIG - DISK_BACKUP_FORMAT = thin 2013-05-13 11:12:08 -- info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = 0 2013-05-13 11:12:08 -- info: CONFIG - ENABLE_HARD_POWER_OFF = 0 2013-05-13 11:12:08 -- info: CONFIG - ITER_TO_WAIT_SHUTDOWN = 3 2013-05-13 11:12:08 -- info: CONFIG - POWER_DOWN_TIMEOUT = 5 2013-05-13 11:12:08 -- info: CONFIG - SNAPSHOT_TIMEOUT = 15 2013-05-13 11:12:08 -- info: CONFIG - LOG_LEVEL = info 2013-05-13 11:12:08 -- info: CONFIG - BACKUP_LOG_OUTPUT = /tmp/ghettoVCB-2013-05-13_11-12-07-1049501.log 2013-05-13 11:12:08 -- info: CONFIG - ENABLE_COMPRESSION = 0 2013-05-13 11:12:08 -- info: CONFIG - VM_SNAPSHOT_MEMORY = 0 2013-05-13 11:12:08 -- info: CONFIG - VM_SNAPSHOT_QUIESCE = 0 2013-05-13 11:12:08 -- info: CONFIG - ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP = 0 2013-05-13 11:12:08 -- info: CONFIG - VMDK_FILES_TO_BACKUP = all 2013-05-13 11:12:08 -- info: CONFIG - VM_SHUTDOWN_ORDER = 2013-05-13 11:12:08 -- info: CONFIG - VM_STARTUP_ORDER = 2013-05-13 11:12:08 -- info: CONFIG - EMAIL_LOG = 0 2013-05-13 11:12:08 -- info: CONFIG - EMAIL_SERVER = auroa.primp-industries.com 2013-05-13 11:12:08 -- info: CONFIG - EMAIL_SERVER_PORT = 25 2013-05-13 11:12:08 -- info: CONFIG - EMAIL_DELAY_INTERVAL = 1 2013-05-13 11:12:08 -- info: CONFIG - EMAIL_FROM = root@ghettoVCB 2013-05-13 11:12:08 -- info: CONFIG - EMAIL_TO = auroa@primp-industries.com 2013-05-13 11:12:08 -- info: CONFIG - WORKDIR_DEBUG = 0 2013-05-13 11:12:08 -- info: 2013-05-13 11:12:13 -- info: Initiate backup for NAS4Free 2013-05-13 11:12:13 -- info: Creating Snapshot "ghettoVCB-snapshot-2013-05-13" for NAS4Free Destination disk format: VMFS thin-provisioned Cloning disk '/vmfs/volumes/datastore/NAS4Free/NAS4Free_1.vmdk'... Clone: 99% done. Destination disk format: VMFS thin-provisioned Cloning disk '/vmfs/volumes/datastore/NAS4Free/NAS4Free.vmdk'... Clone: 90% done. 2013-05-13 11:16:26 -- info: Removing snapshot from NAS4Free ... 2013-05-13 11:16:26 -- info: Backup Duration: 4.22 Minutes 2013-05-13 11:16:26 -- info: Successfully completed backup for NAS4Free! 2013-05-13 11:16:30 -- info: ###### Final status: All VMs backed up OK! ###### 2013-05-13 11:16:30 -- info: ============================== ghettoVCB LOG END ================================ |
仮想マシンのNAS4Freeは電源ONの状態でしたがエラーも無くバックアップが完了しました
1 2 3 4 5 6 7 8 9 10 11 12 13 |
~ # ls -l /vmfs/volumes/FreeNAS/vm_backup/ drwxr-xr-x 1 root root 512 May 13 11:12 NAS4Free ~ # ls -l /vmfs/volumes/FreeNAS/vm_backup/NAS4Free/ drwxr-xr-x 1 root root 512 May 13 11:16 NAS4Free-2013-05-13_11-12-07 ~ # ls -l /vmfs/volumes/FreeNAS/vm_backup/NAS4Free/NAS4Free-2013-05-13_11-12-07/ -rw------- 1 root root 5368709120 May 13 11:16 NAS4Free-flat.vmdk -rw------- 1 root root 549 May 13 11:16 NAS4Free.vmdk -rwxr-xr-x 1 root root 3028 May 13 11:12 NAS4Free.vmx -rw------- 1 root root 107374182400 May 13 11:14 NAS4Free_1-flat.vmdk -rw------- 1 root root 522 May 13 11:14 NAS4Free_1.vmdk -rw-r--r-- 1 root root 30 May 13 11:16 STATUS.ok |
ghettoVCB.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
/vmfs/volumes/datastore/ghettoVCB-master # ./ghettoVCB.sh ############################################################################### # # ghettoVCB for ESX/ESXi 3.5, 4.x+ and 5.x # Author: William Lam # http://www.virtuallyghetto.com/ # Documentation: http://communities.vmware.com/docs/DOC-8760 # Created: 11/17/2008 # Last modified: 2013_01_11 Version 0 # ############################################################################### Usage: ghettoVCB.sh [options] OPTIONS: -a Backup all VMs on host -f List of VMs to backup -m Name of VM to backup (overrides -f) -c VM configuration directory for VM backups -g Path to global ghettoVCB configuration file -l File to output logging -w ghettoVCB work directory (default: /tmp/ghettoVCB.work) -d Debug level [info|debug|dryrun] (default: info) (e.g.) Backup VMs stored in a list ./ghettoVCB.sh -f vms_to_backup Backup a single VM ./ghettoVCB.sh -m vm_to_backup Backup all VMs residing on this host ./ghettoVCB.sh -a Backup all VMs residing on this host except for the VMs in the exclusion list ./ghettoVCB.sh -a -e vm_exclusion_list Backup VMs based on specific configuration located in directory ./ghettoVCB.sh -f vms_to_backup -c vm_backup_configs Backup VMs using global ghettoVCB configuration file ./ghettoVCB.sh -f vms_to_backup -g /global/ghettoVCB.conf Output will log to /tmp/ghettoVCB.log (consider logging to local or remote datastore to persist logs) ./ghettoVCB.sh -f vms_to_backup -l /vmfs/volume/local-storage/ghettoVCB.log Dry run (no backup will take place) ./ghettoVCB.sh -f vms_to_backup -d dryrun |