How to Raid 5 with 5 drives

carltonb
Posts: 3
Joined: Wed Oct 14, 2009 7:42 pm

How to Raid 5 with 5 drives

Postby carltonb » Wed Oct 14, 2009 7:44 pm

I have a machine set up that houses 5 drives.

Drive 1 is a 500g, while drives 2,3,4,5 are all 1TB.
I want to use the 500g drive for the program, while 2-5 are for a Raid 5 setup.

Can any one point me in the direction of a post or article on how to set it up.

Thanks
carltonb

User avatar
moredruid
Expert
Posts: 791
Joined: Tue Jan 20, 2009 1:33 am
Location: Netherlands
Contact:

Re: How to Raid 5 with 5 drives

Postby moredruid » Thu Oct 15, 2009 12:48 am

Well, just install everything as per the instructions on the Amahi site. Leave the disks you want to use as the RAID 5 set untouched.
When the install is finished you can create the RAID array as follows (if you've installed your OS on /dev/sda):
*work as root on a terminal*

Code: Select all

mdadm --create /dev/md1 --level=5 /dev/sd[bcde]
Then save the config to disk:

Code: Select all

mdadm -D -s > /etc/mdadm.conf
Create a volume group with a logical volume on the disk for you data:

Code: Select all

pvcreate /dev/md1 vgcreate vgdata /dev/md1 vgdisplay
Here you will see the output of the volume group, note the "free PE" number and put that number behind the -l option in the lvcreate line:

Code: Select all

Free PE / Size 2305 / 9.00 GB lvcreate -l 2305 -n lvdata vgdata mkfs.ext4 /dev/vgdata/lvdata
I chose the ext4 filesystem, but if you want a different filesystem (ext3, reiserfs, xfs) you can do that if you want, you just need to substitute the mkfs command with the option you want.
Now we need to set it all up so you can actually use it. First we need to temporarily copy everything in /var/hda/files to a different folder:

Code: Select all

mkdir /tmp/tempfiles mv /var/hda/files/* /tmp/tempfiles
Now we test the filesystem:

Code: Select all

mount /dev/vgdata/lvdata /var/hda/files mount
You'll see that the logical volume is mounted on /var/hda/files. You can also type "df -h" and you'll see that /var/hda/files has tons of free space.
Now we move the files back to where they belong:

Code: Select all

mv /tmp/tempfiles/* /var/hda/files
Last part: unmount the filesystem and make sure that the disks are mounted at boot time:

Code: Select all

umount /var/hda/files cp /etc/fstab /etc/fstab.backup echo "/dev/vgdata/lvdata /var/hda/files ext4 defaults 1 2" >> /etc/fstab
Make sure the whitespace is preserved when copying the last line!
Check if the line has been added correctly & mount the filesystem

Code: Select all

cat /etc/fstab mount -a
If you get no errors on the last command (mount) the filesystem is up and will be brought back up at subsequent bootups.
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D2173656C7572206968616D41snlbxq' | dc
Galileo - HP Proliant ML110 G6 quad core Xeon 2.4GHz, 4GB RAM, 2x750GB RAID1 + 2x1TB RAID1 HDD

User avatar
marcel
Posts: 160
Joined: Sat May 16, 2009 12:46 am
Location: Netherlands

Re: How to Raid 5 with 5 drives

Postby marcel » Thu Oct 15, 2009 8:04 am

I do not want to hijack this topic, but i have also a few question about raid, spin down raid arrays, rebuilding raid arrays. You now a lot about Linux moredruid. I will open a new topic for these questions when i have time. :)
My HDA cpu: E1400 2Ghz; motherboard: Gigabyte GA-G33M-S2H; memory: Team 2Gb DDR2; 200GB OS HDD, 2x western digital GP 1TB storage HDDs; case: Antec P182

User avatar
moredruid
Expert
Posts: 791
Joined: Tue Jan 20, 2009 1:33 am
Location: Netherlands
Contact:

Re: How to Raid 5 with 5 drives

Postby moredruid » Thu Oct 15, 2009 10:35 am

sure, shoot... :)

it might indeed be interesting to have some kind of reference for setting up RAID.
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D2173656C7572206968616D41snlbxq' | dc
Galileo - HP Proliant ML110 G6 quad core Xeon 2.4GHz, 4GB RAM, 2x750GB RAID1 + 2x1TB RAID1 HDD

Who is online

Users browsing this forum: No registered users and 12 guests