theducks.org

10 Dec, 2013

Go away and I will replace you with a very small shell script..

Posted by: alex in: vmware

I did a recent migration of SAN to NAS for a client recently, and had to unmount all of their datastores.

This little one liner lists all SAN volumes, then gets rid of them..

# esxcfg-scsidevs -m | sed -e ‘s/\:1 //g’ | awk ‘{ printf(“esxcli storage filesystem unmount -l %s;\nsleep 1;\nesxcli storage core device set –state=off -d %s;\n”,$4,$1);}’ > /tmp/unmountluns.sh

Hope it helps someone, somewhere, someday.