You are not logged in.

#1 2007-09-27 12:06:30

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Installing Arch on a RAID (for dummies)

Playing with RAID's is fun for all the family, and makes things go faster.
this is how I (re)installed Arch Linux, in a simple RAID configuration.


Ingredients
===========
1. Two 160GB drives
2. Arch Linux CD (Dont Panic)


Planning
========
1. root partition on a RAID 1 setup (mirroring)
2. home partition on a RAID 0 setup (striping)
3. swap partition on a RAID 0 setup (striping)

in this kinda setup, one disk can fry, but the system will still boot and function normally.
home will be lost for ever, but I always back it up anyway (and so should you).

*Important* - make sure your two IDE drives are not connected to the same cable, setup one as a primary master and the second as a secondary master.

The works
=========
1. Boot the machine using the setup CD.

2. Using cfdisk, partition the two drives exactly the same:
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        4863    39062016   83  Linux
/dev/sda2            4864       17021    97659135   83  Linux
/dev/sda3           17022       17083      498015   82  Linux swap / Solaris

I chose 40GB for root, 100GB for home (results in 200GB), and 1GB for swap.

Do exactly the same on the second drive /dev/sdb

3. create the RAIDs using mdadm:
modprob raid1
modprob raid0
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md1 --level=0 --raid-devices=2 /dev/sda2 /dev/sdb2
mdadm --create /dev/md2 --level=0 --raid-devices=2 /dev/sda3 /dev/sdb3

4. create filesystems on the partitions:
mkfs.xfs /dev/md0
mkfs.xfs /dev/md1
mkswap /dev/md2

5. mount the root partition on /mnt
mount /dev/md0 /mnt

6. start the setup program
/arch/setup

7. select all base packages

8. install packages

9. configure:
choose configure system and then, edit mkinitcpio.conf modules section:
MODULES="ata_generic ata_piix raid1 raid0 xfs"
In this line, I only added "raid1 raid0 xfs" to the modules.

then, edit mkinitcpio.conf hooks section, and add the RAID stuff after that:
HOOKS="base udev raid autodetect pata scsi sata usbinput keymap filesystems"
md=0,/dev/sda1,/dev/sdb1
md=1,/dev/sda2,/dev/sdb2
md=2,/dev/sda3,/dev/sdb3

In the hooks line, I have added the raid hook before autodetect

10. install the kernel
choose install kernel from the menu.

11. Install grub
choose install bootloader then grub

edit the grub entry to:
# (0) Arch Linux
title  Arch Linux  [/boot/vmlinuz26]
root   (hd0,0)
kernel /boot/vmlinuz26 root=/dev/md0 ro md=0,/dev/sda1,/dev/sdb1
initrd /boot/kernel26.img

install grub to /dev/sda
when prompted about root partition choose /dev/sda1
when prompted about RAID stuff choose no

do exactly the same on /dev/sdb

12. exit the setup program

13. fix mdadm.conf
mdadm -D --scan >>/mnt/etc/mdadm.conf

14. fix fstab
add this to /mnt/etc/fstab:
/dev/md0                /       xfs     defaults                0       0
/dev/md1                /home   xfs     defaults                0       0
/dev/md2                swap    swap    defaults                0       0

15. reboot and install the rest of the system

16. make sure all is well:
cat /proc/mdstat
Personalities : [raid1] [raid0] [linear] [multipath] [raid6] [raid5] [raid4] [raid10]
md2 : active raid0 sda3[0] sdb3[1]
      995840 blocks 64k chunks

md1 : active raid0 sda2[0] sdb2[1]
      195318016 blocks 64k chunks

md0 : active raid1 sdb1[1] sda1[0]
      39061952 blocks [2/2] [UU]

mount
/dev/md0 on / type xfs (rw)
/dev/md1 on /home type xfs (rw)

make sure swap is on:
cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/md2                                partition       995832  0       -1

17. If things go wrong, you can reassemble the RAIDs after booting from the setup CD, dont recreate them:
mdadm --reassemble /dev/md0 /dev/sda1 /dev/sdb1

for more reading, consult the WIKI: http://wiki.archlinux.org/index.php/Ins … AID_or_LVM

Last edited by daf666 (2008-03-08 20:36:42)

Offline

#2 2007-09-27 17:00:06

Mikko777
Member
From: Suomi, Finland
Registered: 2006-10-30
Posts: 837

Re: Installing Arch on a RAID (for dummies)

thanks for this, hopefully I can try this soon wink

Couple of questions:

1: is it alot faster?
2: this is software raid right?
3: do you recommend xfs?
4: can this be combined with lvm? which i think is some kind of resizable partitions?
5: I thought that arch couldn't boot from raid unless you made boot partition not raided is that wrong?

Last edited by Mikko777 (2007-09-27 17:03:45)

Offline

#3 2007-09-27 19:23:20

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: Installing Arch on a RAID (for dummies)

1. I have not benchmarked this, but I can tell you that everything feels faster, boot times, programs load times, general use, etc.
2. Yes this is a software raid, I have a crappy onboard promise controller that needs a driver to be used, I just decided to go 100% software RAID.
3. I always had good experience with XFS, I dont know if its alot faster, check this out to be impressed: http://www.sgi.com/products/software/xfs/
4. Yep, the wiki raid page has a nice raid+lvm setup.
5. From what I know, grub can not boot from a software RAID0, but It can from a RAID1 (not from the raid, but from either of the disks), check this out: http://en.wikipedia.org/wiki/RAID_0#RAID_0

Offline

#4 2007-09-27 19:47:42

Mikko777
Member
From: Suomi, Finland
Registered: 2006-10-30
Posts: 837

Re: Installing Arch on a RAID (for dummies)

thanks again smile

Offline

#5 2007-09-28 00:42:44

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Installing Arch on a RAID (for dummies)

Please add this to the wiki, for others to benefit from, and add to. big_smile

Offline

#6 2007-09-30 21:41:17

Legendin
Member
Registered: 2007-04-19
Posts: 10

Re: Installing Arch on a RAID (for dummies)

Tested and confirmed. I find this guide a lot easyer to follow than the one on the wiki. I would recommend putting this on the wiki aswell, but it should be checked for minor errors in the examples.

Thanks for a great guide!

Offline

#7 2007-10-05 04:46:18

clickit
Member
From: Athens, Hellas
Registered: 2007-07-18
Posts: 93

Re: Installing Arch on a RAID (for dummies)

hi to all,
i did everything, as written in daf666's post, but something went wrong

daf666 wrote:

15. reboot and ....

after this step i have problem to reboot in arch
no grub screen at all

i checked in BIOS and is i can reboot from RAID, it's choosed in some page

during installation i got a little confused in step 10 where it says :

1.install grub to /dev/sda <= i did this
2.when prompted about root partition choose /dev/sda1 <= i also did this
3.when prompted about RAID stuff choose no <= i did this

did exactly the same on /dev/sdb and here how i did this (from memory) :
selected grub installation
entered and exited menu.lst

1.i choose install grub to /dev/sdb
2.previous step 2
3.previous step 3

and after that i was reboot system

[edit]
where, in guide, is raid0 used ?

p.s
sorry for my english

Last edited by clickit (2007-10-05 04:48:54)

Offline

#8 2007-10-05 05:45:31

dr_te_z
Member
From: Zoetermeer, the Netherlands
Registered: 2006-12-06
Posts: 154

Re: Installing Arch on a RAID (for dummies)

Why raid-alise your swap? When you create 2 'ordinary' swap partitions on 2 separate spindels and give them the same priority the kernel will slice I/O for you. That has the same effect, or perhaps better due to less overhead?


Somewhere between "too small" and "too large" lies the size that is just right.
- Scott Hayes

Offline

#9 2007-10-17 19:37:55

Legendin
Member
Registered: 2007-04-19
Posts: 10

Re: Installing Arch on a RAID (for dummies)

clickit:
All I can say is that when I did it, it worked. There are some important-to-notice typos in the guide (like the fact that the raid types used in the different partitions is not consistent throughout), so for a successfull install you will have to go through the guide a few times and mark out the things that does not add up. You can then reflect upon them and in turn be able to see errors you might have committed. Also, you should take a look at the RAID/LWM guide in the wiki. I never got it to work using it, but it could answer some questions.

I don't really know that much about the how's and why's of RAID, but if you still are having trouble getting things to work, feel free to pop in another question and we'll figure something out.


Good luck!

Offline

#10 2007-10-17 21:27:48

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: Installing Arch on a RAID (for dummies)

Sorry for the late reply clickit, I guess you might have fixed it already.
There is a mistake in the guide, I will correct it now, the types in these lines should be --level=0

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3

Very sorry about that, but that does not cause your problem, because it would have created a mirror RAID instaed of a stripe.
Your BIOS has nothing to do with the Linux software RAID, the RAID settings you see in BIOS are probably to enable the on-board RAID controller you have.
The grub part is tricky, you have to make sure whats in the configuration file is according to the setup that you have (not just copy from the guide).
Also keep in mind that if you have SATA, things might look different and the setup might need to be different.

PS - regarding swap, since I wrote the guide I removed the swap space and instead I use a swap file on the RAID0.. I guess it the same because my system  rarely uses swap anyway

Last edited by daf666 (2007-10-17 21:31:59)

Offline

Board footer

Powered by FluxBB