[LUGSB] Linux Software Raid - The Simple Way

Jan Kasiak j.kasiak at gmail.com
Mon Mar 7 23:50:10 EST 2011


1. Use some partition manager to set up the same partitions on all your
drives (linux raid autodetect)
You can use sfdisk to copy it over:
# sfdisk -d /dev/sda  > diskA
# for i in {a..p};do sfdisk /dev/sd$i < diskA; done
If you use fdisk, then you might have to run:
# for i in {a..p};do dd if=/dev/zero of=/dev/sd$i bs=512 count=1; done;
Look at fdisk manual for more information.

OPTIONAL
I had to do this because I really messed up the raid on a system (I created
raids on both /dev/sda and /dev/sda1)
It clears any raid metadata that could be on the drive
#mdadm --zero-superblock /dev/sda
#mdadm --zero-superblock /dev/sda1

2. Create the mdadm device:
# mdadm --create --chunk=128 --raid-devices=16 --verbose /dev/md0 --level=5
/dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1
/dev/sdh1 /dev/sdi1 /dev/sdj1 /dev/sdk1 /dev/sdl1 /dev/sdm1 /dev/sdn1
/dev/sdo1 /dev/sdp1
You can edit the chunk size, level, you can also create the raid with
missing devices etc....
If you cat /proc/mdstat you'll see the status of your raid. mdadm can
provide more detailed info

3. Create the filesystem
#mkfs.ext4 -b 4096 -E stride=32,stripe-width=480 /dev/md0
This command contains additional parameters to increase I/O performance

4. Mount the /dev/md0 device
5. The system should automatically reassemble the raid.

-Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.fsl.cs.sunysb.edu/pipermail/lugsb/attachments/20110307/cafb2c15/attachment.html>


More information about the lugsb mailing list