I have to backup a vm, but I don't have the VMware extensions. What to do? Use ghettoVCB, of course. that's fine, but the deal with VMWare is that a lot of stuff is just plain ephemeral.
My environment is pretty simple. I have an ESX 5 box with two NICs. One is connected to the prod network, the other to a private storage network. The priv net has a server with an NFS export where I can drop stuff from the ESX box.
I've got the NFS export mounted on my ESX box as /vm-repo . Via shell, it is located here:
/vmfs/volumes/vm-repo/
I've decided to use NFS as opposed to iSCSI since I am able to access the data and not have the partition formatted as vmfs. There are drawbacks to both, but for my purposes here, NFS works best. On the directory have placed ghettoVCB and a few more scripts.
Okay.
Luckily, /etc/rc.local survives between boots on an ESX 5 machine. I've added the following:
# boot vm for i in $(vim-cmd vmsvc/getallvms|cut -f1 -d" "| grep -v Vmid); do vim-cmd vmsvc/power.on $i; sleep 10; done # allow smtp through firewall cp /vmfs/volumes/vm-repo/smtp.xml /etc/vmware/firewall/ esxcli network firewall refresh # fix root cron echo "0 0,6,18 * * * /vmfs/volumes/vm-repo/tools/ghettoVCB/ghettoVCB.sh -a" >> /var/spool/cron/crontabs/root
boot vm
This iterates through vms on my ESX box and starts them. This only happens at boot time. This is an issue because ESX no longer does an auto-start.
allow smtp
ESX does not have a nice clickable GUI where I can let SMTP go through. I want SMTP traffic to be sent by the system since I want to know what...
fix root cron
does. This calls the ghettoVCB script which creates a full backup of my VMs at midnight, 6am and 6pm.
Yay. Now my systems auto-start, I have backups and I get a report. Life is grand.
links
ghettoVCB http://communities.vmware.com/docs/DOC-8760
ghettoVCB-restore http://communities.vmware.com/docs/DOC-10595
smtp hint http://www.vladan.fr/how-to-change-default-ssh-port-on-esxi-5-and-make-the-change-persistent-after-reboot/
rc.local hint http://communities.vmware.com/thread/217704
vm restart http://blogs.vmware.com/vsphere/2012/03/free-esxi-hypervisor-auto-start-breaks-with-50-update-1.html
No comments:
Post a Comment