Changes

From Amahi Wiki
Jump to: navigation, search
2,934 bytes added ,  20:48, 25 February 2009
New page: Linux is capable of setting up software RAID arrays via the mdadm command. Doing this requires two or more similar size Linux raid autodetect partitions to be worthwhile (technically you c...
Linux is capable of setting up software RAID arrays via the mdadm command. Doing this requires two or more similar size Linux raid autodetect partitions to be worthwhile (technically you can use the mdadm command on a single partition, but it wouldn't be much of an array then).

=Partitioning Your Drives=
I would recommend using drives that are all the same size and giving them each a single partition. If you are ready for a more complicated arrangement, you probably don't need this section of the guide anyway.

Run fdisk on the first drive you wish to use in your array (you can type in fdisk -l to get device name and size information if you aren't sure what the drives you wish to use are called). In my case, that looked like this:

$ fdisk /dev/sdb

That will bring up this prompt

Command (m for help):

Type n and hit enter to create a new partition on your drive. You'll be asked for partition type (choose primary), partition number (choose 1), and starting and ending sector (hit enter for the default, which is the entire drive).

Once you have given fdisk all the parameters it asks for, you should arrive back at the Command prompt. Type t and hit enter to define the type of the partition. We want Linux raid auto, which is hex code fd as of this writing.

When you are at the prompt again, simply type w and hit enter to save your changes. Repeat this process for each additional drive you wish to include in your raid. You may want to reboot after you've finished partitioning all your drives to make sure the kernel has acknowledged all the changes and doesn't cause any trouble in the next step.

=Creating Your Array=
Once you have your drives partitioned, it's time to create a RAID array. In my case, I wanted to create a mirrored RAID array from two partitions, /dev/sdb1, and /dev/sdc1. That can be accomplished with this command:

mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

/dev/md0 is the name of the new device that will be created to identify the array as a whole. The number after --level= defines the type of RAID array to be set up, 1 for mirroring, 0 for striping, and so on. --raid-devices=2 is the total number partitions that the array will be built from.

Once your array has been created, you can type 'cat /proc/mdstat' to check on it's status. At first, you should see a progress report displaying what percentage of the array building has been completed. Once that is through, the command should display something like this:

Personalities : [raid1]
md0 : active raid1 sdb1[0] sdc1[1]
156290752 blocks [2/2] [UU]

unused devices: <none>

Then you're ready to put a file system on it (a simple 'mkfs -t ext3 /dev/md0' in my case), and perhaps mount the array as your HDA's default path for shares as talked about in the article on [http://wiki.amahi.org/index.php/Adding_a_second_hard_drive_to_your_HDA Adding a Second Hard Drive to your HDA].
4

edits