SATA Software RAID 1 on Linux

Discussion in 'Installation/Configuration' started by mphayesuk, Feb 16, 2006.

  1. mphayesuk

    mphayesuk Member HowtoForge Supporter

    Ok this is a small guide to show what I did to make Software Raid 1 work on my Suse Server this should work on other versions of Linux.

    1) Tip from Ryoken... make sure that your motherboard has had the latest bios patch applied this will help correct any syncing errors that you may get. Dont configure onboard raid

    2) Start the install I am using Suse 9.3 as a 2.6 kernel will not work so using suse 10 32/64bit is a none starter unless you are a techie and decide to re-build the kernel to a 2.4. (I'm not that good with linux)

    3) When it comes to partitioning the harddrives what you need to do is make them on your first hard drive but select "do not format" and select Linux Raid from the drop down list. So what I have is 2 x 200GB SATA Drives:

    /sda1 = 199GB /sda2 = 1GB - both partitions set to do not format and file type is linux raid.

    So I re-create that setup on the second hard drive.

    3) Go to the Raid Option and select Create Raid, then select mirroring and then for the first raid put the two largest partitions in and make it / (root) and then create another raid and put the 2 1gb partitions in and make it a swap raid partition.

    So what you should have is /mb0 as a 199GB Partition and /mb1 as a 1GB Swap Partition.

    What you also need to do is install grub on both harddrives which is done (in suse) by clicking on the expert options on the summary screen and then clicking the relevent option button.

    4) Complete the install using falkos excellent install guide or finish off the install as you planned to ect....

    5) Now what you should be able to do to test is when the machine is off unplug one of the hard drives and then turn back on, you should find that Linux will boot as normal and when the hard drive is plugged back in raid will copy any data that is missing.

    6) The fun begins when one hard drive fails and you put in a new one, if its the second hard drive you will be able to boot stright into linux but if its the first hard drive that fails you will get the grub boot command line, as I dont know how to tell grub to boot from the second hard drive, I opened the machine and put the second hard drive in the first SATA socket, and this makes linux boot as normal.

    7) After linux has booted what you need to do is partition the new hard drive either via this command (Which I did not use or test)

    root. fdisk -d /dev/<good disk> | sfdisk /dev/<new disk>

    What I did was start the partitioner gui and then make the partitions and apply them "as above". What I did then was delete the raid for the swap partition and then recreate it and add in the two partitions as you did the first time round, BUT I DID NOT DO ANYTHING WITH THE BIG /ROOT PARTITION/RAID.

    Restart the computer.

    8) After the reboot go to a terminal and type cat /proc/mdstat

    which will tell you what drives are currently in what partition, you should find that the swap partition /md1 is first and has both /sda? hard drives listed.

    And below that the /md0 partition which will only have one hard drive listed.

    9) run this command raidhotadd /dev/md0 /dev/sd?? (the hard drive that is not in the list)

    The command will look as though it has been run as you are returned to the shell quickly but what you will notice is that the hard drives will then have activity as the data is copied to the new hard drive. Dont know how long this will take I did it and left it over night.

    *****************

    I hope this guide helps someone, it took me a week or so to work it out, also a big thankyou to Ryoken for his tips that helped me and of course Falko and Till. ** Forum Moderators... you can do what you want with this guide... move it and/or edit it if you think you can add something to it.

    Thanks
     
  2. ryoken

    ryoken New Member

    quick tip!

    thanks mphayesuk for writing up this excellent guide on software raid for suse 9.3. i am confident that it will of great help to many people here :)

    in relation to step 9 above, you can easily check the status of the synchronisation (after raidhotadd is run) by typing this:

    cat /proc/mdstat

    this will give you a nice graphical view of the raid rebuilding process, including percentage completed and estimated time remaining. you could also combine the above command with "watch" to periodically monitor the status of the rebuilding process.
     
  3. mphayesuk

    mphayesuk Member HowtoForge Supporter

    Thanks for the added comments.
     

Share This Page