ceturtdiena, 2018. gada 12. jūlijs

ESXI 5.5 backup and restore with ghettoVCB script

ESXI backup/restore with ghettoVCB script

Valid upon version ESXi 5.5
Before make sure ssh is enabled on your VMware host. SSH and ESXi shell must be enabled.
It would be good idea to add restrictions in VMware firewall to access ssh only from admin computers. ESXi remote shell must be used to create access key, or you have to enter password every time you connect. 

Backup

Backup Plan is based on document  https://communities.vmware.com/docs/DOC-8760. Download source from Github to your local computer.
https://github.com/lamw/ghettoVCB/downloads Unzip and download to esxi.
Conf file show count of backups, leave 50% of disk space free for restoration purposes
/ghettoVCB-master/ghettoVCB.conf.
VM_BACKUP_ROTATION_COUNT=1
Write in crontab, when copies will be created. In my example backup take place every wednesday at 6:16 pm. Add to  /var/spool/cron/crontabs/root.
18  18    *   *   3  /ghettoVCB-master/ghettoVCB.sh -a -g /ghettoVCB-master/ghettoVCB.conf
~
~ # kill -HUP $(cat /var/run/crond.pid)
~ # /usr/lib/vmware/busybox/bin/busybox crond
After esxi restart cronjob will be erased so it must be added on boot. Add to /etc/rc.local.d/local.sh.
/bin/kill $(cat /var/run/crond.pid)
/bin/echo "18  18    *   *   4  /ghettoVCB-master/ghettoVCB.sh -a -g /ghettoVCB-master/ghettoVCB.conf" >> /var/spool/cron/crontabs/root                                                   
/usr/lib/vmware/busybox/bin/busybox crond

Restore

/ghettoVCB-master/ghettoVCB-restore.sh -c /ghettoVCB-master/vms_to_restore
In file /ghettoVCB-master/vms_to_restore put a location of backup and where to restore.
"/vmfs/volumes/5b05449c-c4081b22-b538-842b2b780912/Backup/Graylog/Graylog-2018-07-12_18-18-02;/vmfs/volumes/5b05449c-c4081b22-b538-842b2b780912;1"
Restoration will not occur if folder with same directory already exists.

Nav komentāru:

Ierakstīt komentāru