Wednesday, August 19, 2009

Rescan HBAs on multiple ESX hosts via Powershell

Got a lot of ESX hosts and hate having to rescan HBAs every time you add storage? Try this simple 1 liner in powershell.

Get-Cluster | get-vmhost | Get-VMHostStorage -RescanAllHBA

This command is courtasy of a post at http://communities.vmware.com/docs/DOC-7400.

Configuring VMware pathing via Powershell

We have a fairly large VMware environment with a large number of LUNs. I did some performance reviews the other day and found that most of my FC traffic was passing through only 2 of the 4 ports in my Brocade switches.
This causes 2 problems: 1) I could potentially run into a bottleneck by being limited to IOPs and throughput, and 2) A large number of LUNs will have to fail-over if the primary path fails.

A quick bit of googling popped up the site: http://blogs.vmware.com/vipowershell/2008/07/managing-storag.html. This allows for all the LUNs on a single server to be changed to a Round-Robin policy (listed experimental, but still stable). Some tweaking and you could automatically set the preferred path for all LUNs on all servers.

A little more searching found the following script. This changes all LUNs on all servers to RR.

$Mypolicy = "rr"
Get-Datastore | where {$_.Type -eq "VMFS"} | %{(Get-View $_.ID).Info.Vmfs.Extent[0].DiskName} |%{
$diskname = $_
Get-VMHost | %{Get-View (Get-View $_.ID).configmanager.storageSystem} | %{
$mpathpolicy = New-Object vmware.vim.HostMultipathInfoLogicalUnitPolicy
$mpathpolicy.policy = $Mypolicy
$_.SetMultipathLunPolicy($diskname,$mpathpolicy)
}
}

Monday, August 17, 2009

Windows 7 Admin tools

In prior versions of windows, if you wanted the admin tools to manage remote systems, you simply installed the adminpack.msi from the OS CD. In windows 7 however, its a download that you need to run.

Now called the Remote Server Administration Tools (RSAT), they can be downloaded from microsoft at http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=7d2f6ad7-656b-4313-a005-4e344e43997d

Migrate VM to a different datastore via Powershell

There has been a lot of chatter regarding performing and SVmotion via powershell, but I couldnt ever get them to work. I decided to update to the latest powershell tools and try the simple move-vm command.

get-vm <systemname> | move-vm -datastore <dsname>

List all the VMs in a VMware Datastore

If you ever have to do backend maintenenance on the disks hosting your VMware datastores, then you need to know what systems are on them (in case you have to move or recover them). A quick 1 liner in Powershell will list this out for you:
get-vm -datastore <datstore name>

If you have multiple datastores that are named similarly, you can use the "*" character as a wildcard in the datastore name

Friday, August 14, 2009

Installing Windows 7 from USB

OK, now that Windows 7 is out on MSDN, do I really have to waste a DVD to install it? Turns out it can run right from a USB drive. I found the below post that details how to configure a USB stick to install Windows, and its much faster than normal.

http://dotnetwizard.net/vista-stuff/tips-how-to-bootinstall-windows-7vista-from-usb-flashhard-drive/

Thursday, August 06, 2009

Identifying a disk bottleneck in Linux

One of my DBAs simply asked for a virtual machine with 350GB disk space. Since he stated this was a "jump box" for accessing the other Oracle DB servers, I didnt think anything of it and simply built out a linux system with the appropriate space. It wasnt until a few days later that they started complaining that their DB performance was horrible that I realized I had given them utility class SATA disks that were shared with several other VMs, and everything on that array was being killed.

I then built out a RAID10 with 4 300GB disks and moved the LUN to it. Things were better, and other VMs started working, but they were still complaining about performance. I found the following article and began doing some testing http://it.toolbox.com/blogs/database-soup/testing-disk-speed-the-dd-test-31069.

Turns out that the disk transfers were being limited by the number of IOPs supported on the disk. Using Navisphere Analyzer, I quickly realized the IOPs were exceeding 500 even though MBs were below 100MBs. The large number of IOPs is because of the 8k block size in the DB, instead of the larger block size in many Windows systems.

I migrated the LUN to a larger RAID10 array and poof! Performance skyrocketed

Wednesday, August 05, 2009

Regular Expressions Cheat Sheet

I love regex, but I dont get a chance to use it enough to remember which special character does what. Thankfully, there is a nice cheat sheet available at http://www.addedbytes.com/cheat-sheets/regular-expressions-cheat-sheet/ to make this easier to use