Why ZFS is so cool…

By | January 23, 2015

So, I attempted an upgrade while not at the servers…but remotely. So I didn’t take a snapshot with vmware, thinking it would be a minor deal. Needless to say, the upgrade failed horribly, and I was really wishing about then that I had tried this while in front of the server AFTER taking a snapshot…. That IS my normal course of action, but alas, not today.

So, I logged into my internal network and proceeded to login to my NAS and my VMWARE ESXI host via the command line.

First order of business, turn off the VM on the esxi host…

I have to find out which number the vm is so i can turn it off:
vim-cmd vmsvc/getallvms

Now, I see the number of the vm beside the name, so…duh…turn it off… 🙂
vim-cmd vmsvc/power.off 53

Next I need to restore my data back to a previous state in my NAS…
Lets move the borked vm data out of the way…
nas4free: ~# cd /mnt/NAS/virtual_machines/
nas4free: virtual_machines # mv ws-crouse ws-crouse.bak

So, now, to find out what I have for snapshots that NAS4FREE takes automatically !
nas4free: # cd /mnt/NAS/virtual_machines/.zfs/auto-20150123-000000
nas4free: auto-20150123-000000 # ls
nas4free: auto-20150123-000000 # ws-crouse/

TADA … I have snapshot… now to copy it back !
cp -p -R ws-crouse ../../../

Back to the VMWARE esxi server and turn this puppy back on!!
vim-cmd vmsvc/power.on 53

All this in less than 5 minutes.
Gotta love the power of zfs snapshots!!! 🙂