Raidreconf HOWTO
By Daniel S. Cox  dcox at connex.com
Version 0.1 11-Apr-2001

This HOWTO provides a concrete example of converting a Software RAID-5
three disk array to a four disk array.

------------------------------------------------------------------------

Table of Contents

1. Introduction

	1.1 What is this HOWTO?
	1.2 What are we trying to do?
	1.3 Who should be reading this document?

2. Requirements

	2.1 Minimum System Requirements
	2.2 Hardware configuration
	2.2 Obtaining the Raidreconf package
	2.3 Backup is a must

3. Running Raidreconf

	3.1 Create the new raidtab
	3.2 Stop the RAID array!
	3.3 Run raidreconf
	3.4 Copy the new raidtab to /etc

4. Ending

	4.1 Copyright
	4.2 Feedback
	4.3 Disclaimer

------------------------------------------------------------------------

1. Introduction

1.1. What is this HOWTO?

This HOWTO describes the detailed steps needed to convert a Software RAID-5
array consisting of three IDE disks to one consisting of four IDE disks.

1.2. What are we trying to do?

Most likely, the current three disk system has run out of space, and we
wish to add more.  We will accomplish this without a protracted copy-out,
convert, and copy-in sequence.  Raidreconf can convert in-place.

1.3. Who should be reading this document?

The system administrator for the system in question.  If you are the sole
user of the system, that means you!  There is a minimum level of expertise
required, such as adding the physical hard drive, connecting it
properly, issuing commands from the shell, and editing text files.

------------------------------------------------------------------------

2. Requirements

2.1. Minimum System Requirements

Since we're talking about raidREconf, you must already be running Software
RAID, and it therefore must already be configured into the kernel, so
that's not a concern.  If you're using an IDE system, adding a forth drive
will leave no open slot for the CDROM, unless a new IDE interface card is
purchased, or the CDROM is SCSI.

2.2. Hardware configuration

Shutdown the computer, and power it off.  Install the new hard drive,
button it up, and power it on.  Review the boot messages (perhaps in
/var/log/boot.log), and make sure the kernel recognizes the new drive.
I'll assume here that there are already three IDE drives present, "hda",
"hdb", and "hdc".  I'll further assume that the new drive is "hdd", for 
simplicity.  As a final assumption, each drive has four partitions, and
partition 4 of each drive is comprises the RAID array.

2.2. Obtaining the Raidreconf package

The raidreconf software is available from http://oss.connex.com.  Follow
the instructions found there to download the package.

2.3. Backup is a must

Unless you don't consider the data important, you should make a backup of
your current RAID array now.

------------------------------------------------------------------------

3. Running Raidreconf

3.1. Create the new raidtab

Create a working directory, and 'cd' to it:

	mkdir work; cd work

Copy "/etc/raidtab" to oldraidtab:

	cp /etc/raidtab oldraidtab

Copy "oldraidtab" to "newraidtab", and edit it:

	cp oldraidtab newraidtab
	vi newraidtab

An example "oldraidtab" looks like this:

===============================================
raiddev /dev/md0
	raid-level		5
	nr-raid-disks		3
	nr-spare-disks		0
	persistent-superblock 	1
	parity-algorithm        left-symmetric
	chunk-size		128

	device			/dev/hda4
	raid-disk		0

	device			/dev/hdb4
	raid-disk		1

	device			/dev/hdc4
	raid-disk		2
===============================================

An example "newraidtab" looks like this:

===============================================
raiddev /dev/md0
	raid-level		5
	nr-raid-disks		4
	nr-spare-disks		0
	persistent-superblock 	1
	parity-algorithm        left-symmetric
	chunk-size		128

	device			/dev/hda4
	raid-disk		0

	device			/dev/hdb4
	raid-disk		1

	device			/dev/hdc4
	raid-disk		2

	device			/dev/hdd4
	raid-disk		3
===============================================

Where there may be many "stanzas" in /etc/raidtab, describing multiple
arrays, both old and new raidtabs need only contain the array we're
changing.  It doesn't hurt to have others listed, but I prefer the false
security of only mentioning the array I'm working with.

In particular, note the "nr-raid-disks" in each.


3.2. Stop the RAID array!

To stop the RAID array, run the command (as root):

	raidstop /dev/md0

If you don't do this, raidreconf will refuse to run.

3.3. Run raidreconf

Raidreconf is invoked by root as:

	raidreconf -o oldraidtab -n newraidtab -m /dev/md0

The arguments are what you expect: "-o oldraidtab", the "current"
configuration; "-n newraidtab", the new configuration; and "-m /dev/md0",
the device that matches the "raiddev" parameter in both raidtab files.

Raidreconf will display an ASCII art "progress bar", and attempt to
estimate how much longer the conversion will take.  As a ball-park figure,
converting a 80 GB three disk array to a 120 GB array using Western Digital
IDE drives, and a Celeron 560 MHz processor with 64MB of RAM took about
five hours, not counting the time the kernel took to recompute the parity
blocks.

When raidreconf finishes, it will restart the array itself.  The kernel
will begin the parity block reconstruction.  You can "cat /etc/mdstat" to
see it's progress.  However, you can immediately begin using the array.

3.4. Copy the new raidtab to /etc

Update "/etc/raidtab" with the new configuration for this array.

4. Ending

4.1. Copyright

Copyright 2001 Daniel S. Cox

4.2. Feedback

If you have comments or need further information, please contact the author
dcox at connex.com.

4.3. Disclaimer

This information is provided "as is".  The author believes this document to 
be correct, but assumes no responsibility for any damage resulting from it's 
use.
