Tuesday, February 16, 2010

RAID-5 Replacing a Failed Hard Disk in Windows 2003 Server

It has been a long time since I had to swap out a drive in a server with a RAID-5 array, but yesterday I got my chance.  An old venerable server ("Ol' Bessie") that I've kept running at least 5 years past its reasonable lifespan was showing the tell-tale signs of a failed hard disk in Event Viewer - System Log.  I think this server was built in the mid-90's by DEBCO Computers in Hyde Park, Ohio.  It's an old battle tank of a server with 3 redundant power supplies (one which died 4 years ago).  They don't build servers like this anymore -- but I like it because it takes me back to the days when I installed servers just like this one for Spencer Stuart.

Ol' Bessie doesn't have a hardware RAID controller.  There are 6 physical hard disks and RAID is managed through the Windows 2003 Disk Manager.  2 of the disks are in a RAID 1 set (the system drive), and the other 4 are in the RAID-5 set.  For the work this server does, software RAID is just fine and it has performed well for the 5+ years that I've been this server's steward.

Opening up Disk Manager, I could see that sure enough one of the 4 drives in the RAID-5 set was "Missing".  Right clicking on the drive in Disk Manager, I attempted to REACTIVATE to no avail.

No problem, I have a spare hard disk for just this occassion -- still sitting in the unopened box from 2007 when I bought it for just this moment.  But wait -- WHICH of the 4 disks is the one that I need to pull out and replace??  Can I identify it with serial numbers?  Can I identify it with the LED lights?  Sounds simple but it's not.

Like I said, it has been awhile since I had to do this -- at least 4 years -- and as such I wasn't feeling real snappy about it.  So, like a good geek, I grabbed my copy of Mark Minassi's Windows Server 2003 to see what he had to say about it.  Mark's book is great, and it has helped me out alot over the years, but unfortunately, I found nothing about replacing a failed disk in a software managed RAID-5 array.

I tried to Bing some responses but could find nothing concrete -- just a bunch of forum posts that had been syndicated into these awful amalgam services.  What is it with these "services" that compile all these different forum posts from different messaging sites into one big pile of crap?  All I found was the same exact questions being asked over and over again -- but with different branding (and different annoying ads).  Of course, none of the questions that I saw repeatedly had any suitable answers.  How typical anymore of the Internet -- reminds me of the advent of cable television -- a million channels and there is nothing worth watching.  How I yearn for the simpler days of 5 channels with good content, or the days when the Internet wasn't filled with vast miles of crap and ads.  But I digress.

Microsoft Technet wasn't helpful either -- just couldn't find what I needed -- which was "how do I identify the failed physical disk".  In my searches, I found several different pieces of software that could identify hard drive serial numbers -- but these all cost money and I didn't want to introduce some malware infected junk onto my domain controller.  Egghead Cafe (and others) also had some code snippets in various languages (Delphi -- man who uses that anymore, C, and others) that I could compile to figure this out -- great, if only I had an hour or two (and the will) to do that -- but even then it might not tell me the answer to my quandry.

So, I retreated to the little server room and set about figuring it out, no thanks to the Internet or the countless, nameless thousands of IT professional who have had to do this before.  You know you are out there!

The good news, I got it figured out and it's working!  Here is how I did it:

1. Go into Device Manager and expand the hard drives.  You'll see all of them, minus the one that has failed sitting there all pretty.  Right click on each one and choose Properties.  Look for the TARGET value.  Here you will see a LUN number.  Start at the top and work your way down the list of drives.  The Target LUN values are zero-based, meaning the first hard disk starts at 0, the next 1, the next 2, etc.  As you work your way down, you will find that one drive is missing in the sequence.  In my case, I had 6 drives.  I saw 0,1,2,4,5.  No three.  3 was the missing disk.  Then, I got down on my hands and knees, because the server is on the floor, and I counted down from the top -- 0,1,2...THREE.  I marked that drive by wiping off a year of dust and then shut the server down.

2. Once shut down, I yanked #3 out and slid in the replacement disk -- which was an exact duplicate of the one I just pulled out.

3. Boot the server up and start up Disk Manager (Computer Management...Disk Manager).  Disk Manager recognized right away that something was up and prompted me to import the new disk 3 and convert it to Dynamic.

4. Now, I could see my 3 working drives with their Sky Blue colored stripe to indicate a RAID-5 set, and this one new disk with a black stripe.  I could also see at the bottom that it still thought a disk was "missing".  No worries about the missing disk -- that's just old crap showing up.   Deal with that in a minute.  Now, up top above the stripes, right click on Drive F "Raid-5" array and choose REPAIR Volume.  Disk Manager wisely prompts to ask if I want to use the newly imported disk to replace the one that was missing.  Yes!!

5. Now, the black strip on disk 3 turns Teal like the others and I can see they are Resynching -- and boy this looks like it will take forever.  No problem, let it work.

6. Right click the MISSING disk down low and choose to Remove.  Snap, it's gone and Disk Manager is looking all dressed up and pretty again.  Job done!

Wednesday, December 23, 2009

Took the plunge -- DROID is in, Blackberry is out

I took the plunge and disconnected my venerable Blackberry Curve and switched to the Motorola DROID running Google's Android 2.0 software.

As an Outlook user, one of the things I liked so much about my Blackberry was the strong synch support for Outlook.  With Google & Microsoft not playing well together, it wasn't any big surprise to me when the guy at the Verizon store told me there wasn't good Outlook synch support.  Well, I found an option -- it's called CompanionLink for Google.  In a nutshell, here's how it works --

1. Android synchs automatically with Google Gmail Contacts.  This occurs over the Verizon network.  No  need to ever plug the DROID into a computer with a "synch cable".  Nice!

2. CompanionLink runs on your computer where Outlook is installed.  It synchs Outlook tasks, calendar, and contacts with Google Gmail.  I need to remember to run CompanionLink -- it doesn't run automatically.  But, it sure beats having to plug in that stupid synch cable!

Good DROID

Android 2.0 simply keeps impressing me.  There is just so much the device can do beyond the utilitarian functionality that I was used to with the Blackberry.  Some of my favorite things:

1. There is an app called CAR HOME and in this app is a place to click where I can talk to the DROID.  I know that sounds weird, but I now find myself saying things like "MAP OF SHELL STATIONS" and have it show me a fully GPS-aware map of all the nearest Shell Gas Stations.  I can tell my DROID to "CALL JOHN DOE MOBILE" and have it find that contact and dial the number all by itself.  Truly, I'm getting better at giving my DROID commands and having it do as I ask.  This is just amazing.

2.  GPS Navigation.  Right, I'm a guy so I never need directions and thus never bought a GPS and never request one when I rent a car.  So if that's the case, why do I find myself telling my DROID "NAVIGATE TO SAINT SUSANNA CHURCH" in order to find they gym for my kid's basketball game located in East Boofoo?  The DROID finds the location right away and then goes into GPS mode and gives me turn-by-turn directions.  And, it's really good -- I'd say on par with the NeverLost that I've occassionally gotten (although I never request it...right).

3. RoboDefense.  OK, it's a game.  But, it's way more addictive than Brick Breaker and far far cooler too.  I get to put together these crafty little tower defenses to keep bad robots from making it across the screen.  Infinite challenges, upgrades, acheivements -- this game is just plain FUN.

4. Oh and a bunch of other stuff.  I'd love to hear what YOU like about your DROID.

Bad DROID

So far, my biggest gripe with the DROID is that the keyboard simply isn't as nicely layed out as the Blackberry Curve.  I'm getting better at using the keyboard, but it's not nearly as easy to use as the Blackberry.  As a result, I'm not nearly as verbose in my mobile comments -- text, email, etc.  That's probably a good thing though!

Wednesday, December 2, 2009

Motorola DROID

I am trying out a MOTOROLA DROID phone from Verizon and configured the default EMAIL application for POP3 against my Exchange 2007 Server. Although it connected (after setting the security to TDS on both the DROID, and updating my Exchange Server Host Connector to check the allow multi-domain TDS checkbox), the application would constantly fail -- when I wasn't actively in the application. A box would continually come up saying the Email App had crapped out and prompted me to "Force Close" it. After reading paulseaone's post (http://www.talkandroid.com/android-forums/htc-smart-mobility/564-connection-error.html), I went to the MARKET application, located, downloaded, and configured K-9. I tried POP3 and IMAP (ultimately settling on IMAP for the convenience of not having duplicate copies of my email on my phone and mail server) -- NO CRASHES! I then had to go into the default EMAIL application and hunt around until I could figure out how to DELETE the POP3 profile that I had created there. Once I got rid of that, NO MORE ANNOYING FORCE CLOSE messages and K-9 working like a CHARM. In fact, I have K-9 setup to connect via IMAP to both my personal Exchange 2007 Server and my Corporate Email which is hosted by Rackspace.

Thursday, October 1, 2009

Backing up Exchange 2007 on Server 2008

I recently installed Windows Server 2008 and Exchange Server 2007 in a small business environment and much to my dismay later discovered that I couldn't backup the Exchange server.  Windows 2008 Server doesn't come with NTBackup.  Looked like my only solution would be Microsoft Data Protection Manager.  But this product won't install on Windows Server 2008.  Nice.

Thankfully, I found a blog post by Karl Foley at http://cs.thefoleyhouse.co.uk/blogs/karl/archive/2008/02/10/how-to-backup-exchange-2007-on-server-2008.aspx.  I followed his instructions and have re-posted the solution here:

1. Create a directory on the Windows 2008 server - C:\Program Files (x86)\NTBackup
2. Copy the following files from a Windows 2003 Server to the NTBackup directory on 2008 Server:

  • c:\windows\system32\ntbackup.exe
  • c:\windows\system32\ntmsapi.dll
  • c:\windows\system32\vssapi.dll

Lastly, you will need to copy this file from an Exchange 2003 installation:

  • c:\program files\exchsrvr\bin\esebcli2.dll

3. On the 2008 Server, install Removable Storage (Start Server Manager, Click Features, Add Features, Check Removable Storage Manager, Click Install).

4. On the 2008 Server, make a small registry change to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\BackupRestore\DLLPaths
Change the path C:\Program Files\Micrsoft\Exchange Server\Bin\esebcli2.dll to C:\Program Files (x86)\NTBackup\esebcli2.dll.

Now, start NTBackup.EXE.  You will see a notice that NTBackup cannot see Removable Storage but just ignore (and click the box to ignore forever if you don't want to see it again).  When NTBackup starts, you should see your Exchange 2007 instance in the list of junk that you can backup.

Choose the Information Store(s) for your Exchange 2007 Server and back them up to a file on the hard drive.

Problem solved.  Thanks Karl!

Thursday, May 28, 2009

Global Transaction Log Truncation - TSQL

Over the years I've worked with Microsoft SQL Server, I've been faced with transaction logs eating up tons of disk space. Here's some code that will iterate over all databases on the server truncating and shrinking each database. Scheduled as a weekly job, this can keep disk space usage down on a busy SQL Server.


SET QUOTED_IDENTIFIER OFF

DECLARE @name varchar(30),
@header varchar(75)

DECLARE csr CURSOR LOCAL FORWARD_ONLY STATIC FOR
SELECT name
FROM master..sysdatabases
ORDER BY name

OPEN csr
FETCH NEXT FROM csr INTO @name

WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @header = "Database " + RTRIM(UPPER(@name))
EXEC(" backup log " + @name + " WITH TRUNCATE_ONLY ")
EXEC(" DBCC SHRINKDATABASE ( " + @name + ", TRUNCATEONLY) ")
FETCH NEXT FROM csr INTO @name
END

CLOSE csr
DEALLOCATE csr

Saturday, September 29, 2007

Migrating SQL 2000 Diagrams to SQL 2005

When copying MDF/LDF files from a SQL 2000 installation to a SQL 2005 installation, diagrams will not open and the solution to getting them to open properly is non-intuitive. Here is T-SQL Code to fix the problem. This is run on the SQL 2005 Server after the MDF has been attached in SQL Management Studio. Substitute your database name where is says "Nexus":

EXEC sp_dbcmptlevel 'Nexus', '90';
go
ALTER AUTHORIZATION ON DATABASE::Nexus TO "sa"
go
use Nexus
go
EXECUTE AS USER = N'dbo' REVERT
go

CAPTCHA for ASP.NET

Over the past year+, I've noted an increase in form spam through the various web sites that I've authored and continue to manage. As a result, I've had to go back and add CAPTCHA controls to the forms in some cases.

I'm working on a new .NET project called ArtOverture and needed to dig into a .NET based CAPTCHA control. Looking around at the source code for dasBlog, I learned about Jeff Atkins CaptchaControl. It's written in VB.NET for Visual Studio 2003 and ASP.NET 1.1. However, I found that you can include the compiled DLL just fine as a toolbox control in Visual Studio 2005. The control works perfectly without any need for recompiling.

Here's the link to Jeff's Code Project writeup on CaptchaControl. Full source code is available.
http://www.codeproject.com/aspnet/CaptchaControl.asp