Software raid linux

5. RAID setup

5.1 General setup

This is what you need for any of the RAID levels:

* A kernel. Preferably a kernel from the 2.4 series. Alternatively a 2.0 or 2.2 kernel with the RAID patches applied.
* The RAID tools.
* Patience, Pizza, and your favorite caffeinated beverage.

All of this is included as standard in most GNU/Linux distributions today.

If your system has RAID support, you should have a file called /proc/mdstat. Remember it, that file is your friend. If you do not have that file, maybe your kernel does not have RAID support. See what the contains, by doing a cat /proc/mdstat. It should tell you that you have the right RAID personality (eg. RAID mode) registered, and that no RAID devices are currently active.

Create the partitions you want to include in your RAID set.
5.2 Downloading and installing the RAID tools

The RAID tools are included in almost every major Linux distribution.

IMPORTANT: If using Debian Woody (3.0) or later, you can install the package by running

Apt-get install raidtools2

This raidtools2 is a modern version of the old raidtools package, which doesn’t support the persistent-superblock and parity-algorithm settings.

5.3 Downloading and installing mdadm

You can download the most recent mdadm tarball at http://www. cse. unsw. edu. au/~neilb/source/mdadm/. Issue a nice make install to compile and then install mdadm and its documentation, manual pages and example files.

If using an RPM-based distribution, you can download and install the package file found at http://www. cse. unsw. edu. au/~neilb/source/mdadm/RPM.

Rpm – ihv mdadm-1.4.0-1.i386.rpm

If using Debian Woody (3.0) or later, you can install the package by running

Apt-get install mdadm

Gentoo has this package available in the portage tree. There you can run

Emerge mdadm

Other distributions may also have this package

available. Now, let’s go mode-specific.

5.4 Linear mode

Ok, so you have two or more partitions which are not necessarily the same size (but of course can be), which you want to append to each other.

Set up the /etc/raidtab file to describe your setup. I set up a raidtab for two disks in linear mode, and the file looked like this:

Raiddev /dev/md0
raid-level linear
nr-raid-disks 2
chunk-size 32
persistent-superblock 1
device /dev/sdb6
raid-disk 0
device /dev/sdc5
raid-disk 1

Spare-disks are not supported here. If a disk dies, the array dies with it. There’s no information to put on a spare disk.

You’re probably wondering why we specify a chunk-size here when linear mode just appends the disks into one large array with no parallelism. Well, you’re completely right, it’s odd. Just put in some chunk size and don’t worry about this any more.

Ok, let’s create the array. Run the command

Mkraid /dev/md0

This will initialize your array, write the persistent superblocks, and start the array.

If you are using mdadm, a single command like

Mdadm – create – verbose /dev/md0 – level=linear – raid-devices=2 /dev/sdb6 /dev/sdc5

Should create the array. The parameters talk for themselves. The output might look like this

Mdadm: chunk size defaults to 64K
mdadm: array /dev/md0 started.

Have a look in /proc/mdstat. You should see that the array is running.


1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)



Software raid linux