Thursday, December 09, 2010

RAID setup

RAID stands for Redundant Array of Independent Disks. There are many forms and flavors of RAID, but the goal is the same: data storage and rapid retrieval. RAID [disk arrays] typically provide two or more linked hard drives that either back up or speed up data storage and delivery. The simplest form, RAID 0, provides disk striping, which uses two or more hard drives to speed up data storage and retrieval. RAID 1 provides mirroring, which means the data is duplicated across two or more hard drives. That way if one drive fails, the other can still provide the information, while the failed drive is being replaced. Other RAID levels, such as RAID 6 provide even more redundancy, allowing two or more disks to fail before data is lost.

I recently designed a web server for a local translation agency, and I was asked to provide a RAID solution for worldwide data delivery at a reasonable cost. The server is running Linux CentOS, a Red Hat clone. 

A RAID card can provide a hardware-based RAID solution, but a good RAID card is expensive, ranging from $150 to $650. The RAID card determines which drive receives data in which phase of the write process, and where that data is stored. However there are two other methods of creating a RAID that do not require an additional card.

The server's motherboard has a SoftRAID on chip, allowing me to set up a RAID in the BIOS, but Cent OS requires that its boot partition be separate from the RAID, and with Intel SoftRAID it is not easy to create a small, non-RAIDed partition. The SoftRAID wants to put the whole disk into the RAID, while we only need a small space on one disk for the boot partition.

I chose to use an open source tool called mdadm, multiple device administrator, to create a software RAID called an md (multiple device). Md0 uses four 1Tb hard drives to stripe and mirror data for redundancy and speed. I chose a RAID 1+0 array, because it increases the speed of disk access (RAID 0) and mirrors the data (RAID 1), simultaneously. That means that any one drive can fail without data loss, and up to two drives can fail if they are in separate mirrors.

The mdadm configuration tool also allows the administrator to configure where on the disk to write. I chose to use an f2 layout, or "far" layout. In this case, "far" means that data is written to two locations on the drive, one that is quicker for the drive to access, and one that is "farther" for the drive to access. While this means that write speed is slower (the drive spindle has to move farther to write), read speed (from the closer block) is much faster, coming close to, or equaling RAID 0 speeds. As users worldwide hit the database, I am assuring optimal availability and redundancy.

Saturday, April 03, 2010

MacBook Pro Video Chip

I recently dove into a thorny Mac issue. My client's MacBook Pro wasn't waking from sleep. It seemed to be stuck in hibernation mode. This would happen when the lid was closed, and could be easily observed by adjusting the sleep settings to their shortest value. At the same time a slower-than-molasses startup seemed to hang at the blue screen (indicating the loading of the user profile). Diagnostics revealed nothing: The hard drive checked out OK and memory tests came back with no errors.

Of course I tried the usual Mac routine: Restart in Safe Boot, Zap the PRAM, Reset the system configuration by holding down the power button with the battery and power cord removed, and Verbose Boot. Verbose boot gave me a clue: The delay occurred when the video chip drivers initialized. This MacBook contained an Intel video chip, which activates a software kernel extension on startup to operate correctly. The boot would hang for two minutes while initializing the video. Could the kernel extension (kext) be corrupted?

After booting, the computer appeared to operate correctly, with no observable problem other than not waking from sleep. Because the blue screen indicates the loading of the user profile, I first removed the login items, then renamed the user profile, triggering the creation of a new, generic user. No luck! At this point I had to consider reinstalling the OS to replace corrupt system files.

I repartitioned the drive, and reinstalled the OS. The startup issue was gone, but the sleep issue remained. And as soon as I updated the OS the startup issue returned! Could the update for the Intel video kext be the problem? But Apple thoroughly tests their updates, and reinstalling the OS should have resolved any software issues. After all, there is no non-Mac hardware involved, the machine worked fine until recently, and there was no update concurrent with the start of the problems. I was also experiencing intermittent problems with the DVD drive.

In the end, I brought the MacBook to the Apple Store where they plugged in a diagnostic tool. The tool could not read the diagnostic information from the MacBook, indicating a failure on the main board. My client decided to send the MacBook in for refurbishing, and it was returned with a new screen, new main board, new DVD drive, and with the scratches buffed off of the case (possibly a new case?). She says it runs better than when she got it!

This is one example where it took a lot of work to pin down the issue. There were no clear diagnostic indicators, other than the delay in the Verbose output on boot. The machine ran fine after the slow boot, and the sleep mode could be turned off or delayed. But a Mac user expects their machine to function with high quality performance, and logic board issues could worsen over time, causing data loss. I'm glad we were able to pin down and repair the problem!

Thursday, February 18, 2010

RS232 and your web browser

I priced, purchased and installed the hardware for a retail grocery point-of-sale system, with only one hitch. Instead of the USB scanner I ordered, they sent me an RS-232 scanner. After the vendor failed to respond to my complaints, I realized that I needed an immediate solution to get the shop up an running on the new POS. I tested the RS232 connection on COM1 and COM1 received input from the scanner, but that data did not show up in the POS.

The problem: Although a serial connected scanner can easily send data to the OS through the COM1 port, our POS uses an internet browser for its touch screen GUI. COM1 data must be translated into keystroke text strings to register in the (browser-POS) UPC display fields.

The solution: After some research I found an excellent tool that runs extremely light on the system, called PC Wedge. PC Wedge translates the COM1 messages for the browser and bang, we are off an running! I have PC Wedge and the internet browser activate with the OS startup, so when the staff turns on the machine, all they have to do is to log in on the POS and they are ready to ring up customers.