Tuesday, May 22, 2012

Getting the last powered on time of a VM

I have been going through our VMware infrastructure and cleaning up the storage and found a large number of VMs that were powered off. I wanted to know if any activity had happened on them recently to see if they were still valid. A little googling and I found the below script that will look through the event logs of Virtual Center and tell you when it was last powered on.


Monday, May 14, 2012

Create a VMFS datastore via powershell

Due to limitations in ESX4, I recently needed to create several 2TB VMFS volumes. I can easily automate this on the SAN configuration, but creating the VMFS datastores has always been a manual process. I came across sample code at http://snipplr.com/view.php?codeview&id=48048 that showed how to perform this via powershell.

I modified it a bit to work in my environment and posted the code below
Syntax to run: New-DatastoreByLun “myESXHost” “SANB” 9 0 “Datastore01”



Wednesday, May 02, 2012

Setting VMware Reservations and Limits via PowerShell

I am looking into the possibility of implementing tiering and limiting within my VM infrastructure. Nothing special is required, but I want to make sure that a development system doesn't run rampant and impact production. I came up with this script to adjust the CPU/RAM reservations/limits based on the number of CPUs and amount of RAM assigned.



Tuesday, May 01, 2012

Removing disk from a Celerra

This isn't a task that is often done, and normally not suggested to be done without EMC support. I have done this a few times, but only when the system is entirely cleared and there is no possibility of breaking things.

Step 1: Remove all mounts and file systems in the Celerra web UI
This is the opposite of creating the file systems and mounts, it should be self explanatory

Step 2: List the disk status
Using putty or other SSH client, log into the Celerra as nasadmin
Type nas_disk -l, this will give a listing of the disks, their type, and status. The disks where inuse=n can be safely removed

Step 3: Delete the disks
Now that we have the disks that can be removed, remove them by typing nas_disk -d [disk name] -perm
Another nas_disk -l will confirm the disk has been removed

Step 4: Delete the LUNs
Once the disks have been removed, log into Unisphere and view the LUNs exported to the Celerra. The name of the deleted LUNs will revert the the standard LUN XXX nomenclature. These LUNs can now be removed and deleted.


WARNING! If you do this wrong you risk corrupting all data on your Celerra. Don't do this unless you absolutely know what your doing, or there isn't any data to lose.