Tip 126: Software based Fault Tolerance (RAID-1/RAID-5) in Windows XP

Fault tolerant disks in Windows XP

There is a wide choice of hard drives from established manufacturers such as Hitachi, Maxtor, Seagate and Western Digital. For home or office use, a single disk is usually sufficient. But for enterprise networks, a cluster of several disks is often essential. The only problem is that these so-called RAID arrays are not exactly cheap.

Many motherboards have already built in RAID controllers, but not all of these are suitable for fileserver applications. Most of them only support the simple modes 0 and 1, and the combination of both called RAID 0+1 (striping & mirroring). While high capacity as well as outstanding performance can be accomplished by RAID 0, the risks of losing data due to a broken drive multiples by the amount of drives likewise.

A happy medium between performance and data security can be achieved by a RAID 0+1, mirroring two RAID 0 arrays. The only downside is that the net capacity will be split in half.

If high capacity is first priority, the common option is a RAID 5, which distributes data to all array members and adds rotating parity information, too.
The net capacity of the whole array is the sum of all drive's storage minus the capacity of one single drive. However, this solution is not as simple as it seems. Calculating the parity information as well as the
real time reconstruction of data in case of a defective drive requires a lot of CPU performance. This forces the user to either buy a pretty expensive RAID controller with a built-in XOR unit, or to rely on a cheaper model that burdens the CPU with the XOR calculation.

So, why not use the RAID 5 software option?

If the budget is tight and the usage of a simple RAID controller without the XOR unit is a possibility anyway, software based RAID 5 might be an equivalent choice. RAID 5 that Windows Server 2003 offers can include all existing drives, rendering a RAID 5 controller unnecessary.
However, if you only need file services, not even the expensive Windows Sever license is needed, since Windows XP is capable of sophisticated RAID functions after only a few modifications.

In their standard form only the Windows Server products support functionality that enables software based fault tolerant disc implementations like RAID 1 and RAID 5. (You can find additional information on RAID implementations here.)

As already indicated, with a few minor 'adjustments' the same software based RAID 1 and RAID 5 disk implementations are available for Windows XP Professional.

In order to run RAID 1 or RAID 5 requires a hex editor (e.g. Ultra Edit or XVI32 if you prefer freeware) as well as your Windows XP CD.

First of all you need to copy the files to be modified into a temporary folder:

C:\windows\system32\drivers\dmboot.sys
C:\windows\system32\dmconfig.dll
C:\windows\system32\Dmadmin.exe

As a safety measure these files need to be copied to a separate folder from which they can be opened using your hex editor in order to change some 'indicators'.

Use your HEX editor to search for the string indicated here

dmboot.sys:
Before:
0000f1f0h: 74 00 54 00 79 00 70 00 65 00 00 00 57 49 4E 4E ; t.T.y.p.e...WINN
0000f200h: 54 00 00 00 53 45 52 56 45 52 4E 54 00 00 00 00 ; T...SERVERNT....

Now change WINNT...SERVERNT to SERVERNTWINNT.......

This shows the replacement to be made

dmboot.sys:
After:
0000f1f0h: 74 00 54 00 79 00 70 00 65 00 00 00 53 45 52 56 ; t.T.y.p.e...SERV
0000f200h: 45 52 4E 54 57 49 4E 4E 54 00 00 00 00 00 00 00 ; ERNTWINNT.......

 

In the next file a similar change has to be made:

Use your HEX editor to search for the string indicated here

dmconfig.dll:
Before
00005140h: 4C 41 4E 4D 41 4E 4E 54 00 00 00 00 53 45 52 56 ; LANMANNT....SERV
00005150h: 45 52 4E 54 00 00 00 00 57 49 4E 4E 54 00 00 00 ; ERNT....WINNT...

Now change SERVERNT....WINNT... to WINNT.......SERVERNT

This shows the replacement to be made

dmconfig.dll:
After
00005140h: 4C 41 4E 4D 41 4E 4E 54 00 00 00 00 57 49 4E 4E ; LANMANNT....WINN
00005150h: 54 00 00 00 00 00 00 00 53 45 52 56 45 52 4E 54 ; T.......SERVERNT

 

And a similar, last, change has to be made in the third file:

Use your HEX editor to search for the string indicated here

dmadmin.exe:
Before
00001c30h: 73 65 72 76 65 72 6E 74 00 00 00 00 6C 61 6E 6D ; servernt....lanm
00001c40h: 61 6E 6E 74 00 00 00 00 50 72 6F 64 75 63 74 54 ; annt....ProductT

Here, servernt....lanmannt has to be changed into winnt.......lanmannt.

This shows the replacement to be made

dmadmin.exe:
After
00001c30h: 77 69 6E 6E 74 00 00 00 00 00 00 00 6C 61 6E 6D ; winnt.......lanm
00001c40h: 61 6E 6E 74 00 00 00 00 50 72 6F 64 75 63 74 54 ; annt....ProductT

 

This concludes the 'hex'-edit part of the change.

As a next step the original files in the Windows\System32 directory need to be replaced by these modified versions. However, simply exchanging the files by overwriting them will cause the Windows File Protection mechanism to take notice, which eventually causes Windows to restore its original files by using the backup copies of those files.

In the unlikely event that your system drive is on FAT32, simply boot any DOS operating system in order to overwrite the files manually. Since FAT32 does not provide for any security at all, I do not recommend using this file system.

When your file system is running NTFS, the recommended way!, you can boot into Safe mode by pressing F8 upon startup of your system and choosing: Safe mode.

Alternatively you could boot from the Windows XP CD and launch the recovery console. This can be achieved by pressing 'R' in the first selection screen. Follow the on-screen instructions when booting the recovery console.

Once your system is back up you can use Windows Explorer or the command processor to copy the modified versions to their respective place.

The best approach is to copy the files to the Windows File Protection (WFP) location first and after that to their original, 'run-time', place.

To place them in the WFP folder, copy:

dmboot.sys into <%windows%\system32\dllcache
dmconfig.dll into <%windows%\system32\dllcache
dmadmin.exe into <%windows%\system32\dllcache

To place them in the run-time location, copy:

dmboot.sys to <%windows%\system32\drivers
dmconfig.dll to <%windows%\system32
dmadmin.exe to <%windows%\system32

Shut down the system and attach the extra hard disks required for the RAID implementation you want to use. Once this is accomplished, reboot your system.

Now you're ready to start configuring your software based Fault Tolerant disk array.

Configuring a RAID 5 array.

For the following explanation on how to set up a RAID 5 array I have have chosen to use 4 (small) 4 GB disks. Of course this will work equally well with larger disks.

Launch the Computer Manage console and go to the Disk Management node. Windows Disk management recognizes the newly installed disks and will want to Initialize them by writing a Signature to the disks.
The Disk Initialize Wizard that comes up automatically will also let you convert the new disks to Dynamic. You will have to do that in order to use them in a RAID implementation. RAID is not supported on Basic disks.

Once the Wizard has finished you will see your new disks, similar to our example below.
Note that Disks 1-4 are of Type Dynamic and still have Unallocated space.

Disk Manager shows our four new disks, with unallocated space on all of them.

Now it's time to start creating the RAID-5 array. Right-click the Unallocated space for Disk 1 and choose: New Volume. The New Volume Wizard appears, you choose RAID-5 and click Next.


After modifying the files as shown above, Windows XP is capable of supporting RAID 5 in software.

On the next screen select the Available Disks on the left, Add them to the Selected list, optionally enter  the amount of space you want to use for the RAID-5 Array and click Next.

Select the Disks to be used and the space for the RAID-5 Array
Select the disks that will make up the RAID-5 Array

Assign the desired Drive letter for the Array and click Next.

Assign a Drive letter to the array
These and the next options ...

Choose the File System to be used (I strongly recommend NTFS), possibly a Volume Label for the array, check "Perform a quick format" and click Next.

Chose the File System, Volume Label and 'formatting speed'
... are the same, regardless of defining a Simple Volume or an array

As soon as Windows finishes creating the array, the RAID 5 array will be available for use in Windows just as any other hard drive, with all possibilities Windows and the NTFS file system provides such as the option to grant individual or group-based permissions and to share folders.
Note the 'Layout' column indicating the volume to be RAID-5

The RAID-5 array is ready to be used

 

What to do if a physical drive fails?

In the unfortunate event that one of the disks in this array happens to develop a problem, the RAID-5 technology is designed to keep the system running and guard against loss of our valuable data. At some (convenient) point however, you may need to replace a faulty disk with a new one.
As shown in this screenshot, Disk management will report Failed Redundancy for all the members in the Array (Status column) and that the failed disk is 'Offline' (Disk 4 in the example).
In the example a brand new Disk 1 has already been placed in the system to be used as a replacement for the failed disk. Being new to the system, it is reported as 'Foreign'.

The disk is being reported as Offline with Failed Redundance for the array
Note the report indicating Disk 1 as being 'Foreign' and Disk 4 as being 'Offline', with Failed Redundancy for the array

For security reasons, Windows does not incorporate the new drive into the array automatically.
The Administrator has to manually Repair the Volume.
For that, right-click the new (Foreign) disk and select "Import Foreign Disks..." to import it into the disk group that forms the Array.

Import the Foreign disk into the Disk Group
Importing the (new) Foreign Disk will incorporate it into the Disk Group known to the system

Once the new disk is successfully imported into the system the administrator can continue to repair the failed RAID-5 volume. Right-click any of the still remaining members of the RAID-5 volume and select "Repair Volume...". This will start the process of Rebuilding the RAID-5 array.


This will start the Rebuilding process

In the dialog box that follows, you select the disk that is to be used to 'complete' the RAID-5 array again. In the example there is only one disk available; the newly installed Disk 1.


Select the disk to be used to repair the RAID-5 array

After you click the OK button a process starts that regenerates the RAID-5 array. Regeneration uses the information contained on the remaining disks to 'generate' the information needed that needs to be written to the new disk in order to reconstruct the original data contained on the failed disk. After regeneration also note the change in display for the previously 'known' Disk 4. It's purpose and setup is no longer 'known' to the system.


The regeneration process is under way...

As a final step in this example, the 'Missing' (Offline) disk will be removed from the Disk Group information by right-clicking it and selecting 'Remove Disk'.


Remove a disk from the Disk Group administration kept by the system

As you may have concluded by now, software based RAID-5 is not hard to achieve and administer.

Enjoy.!