RAID1 RAID01 HOW2 Trixbox2.2

unitetech
Posts: 113
Member Since:
2007-01-19

Software RAID1 RAID01 How2 with Trixbox2.2

The following is the steps that I took to install a software RAID 1 on a P4 3.2GHz, 1GB RAM and 2 SATA 160GB hard drive system. RAID 1 will allow your drives to mirror each other and theoretically allow your system to stay up if one fails. I make no guarantees on this and you have to test it to make sure its working when you get everything setup.

Preparation:

1. Make sure all hardware is secure within your system
2. Make sure that one SATA drive is in slot SATA0 and the other is in SATA1 if you have more that 2 SATA slots on your motherboard
3. If you have a motherboard that supports hyper threading technology, you will be given an option at boot to choose between 2 different kernels, when you load Trixbox. One is 2.6.9-34.0.2.ELsmp and the other is 2.6.9-34.0.2EL. The ELsmp kernel uses the multiprocessor hyper threading technology built into the system. Here is a suggestion, unless you know what you are doing and are not a newbie then it would be a good idea not to use the ELsmp kernel. The problem is that the ELsmp kernel is the default kernel that boots unless you manually select the EL version. So, you would have to manually select the EL version every time you reboot your machine or it defaults to ELsmp after a few seconds. There are 2 ways to fix this. One is to turn hyper threading technology off in your bios and Trixbox install wont then have the option to default to the ELsmp kernel on boot. The other option is to make a change to the /boot/grub/grub.conf file after you load Trixbox and tell it to default to the EL kernel on boot. To make this change in grub.conf you type vi /boot/grub/grub.conf and then go down to the line that says default=0. Next hit the insert key and you can now go over to the 0 and change it to 1. The line will now say default=1. Now that you made the change hold down the shift key and then press the “:” key you may now save the file by typing in “wq” and hit the enter key. If you messed up in this file, just type in “q!” and enter. That will take you out of the grub.conf file without making any changes. If you want to know more about “vi editor” read up on it. Restart your machine and your default kernel will now be EL and not ELsmp. The second step is so you still have the option to mess around with ELsmp kernel later but understand most of the how to information for Trixbox is for the EL kernel and not the ELsmp kernel. If you do things like rebuild the Zaptel drivers and other things per the instructions on here then you can get a kernel panic or worse if using the ELsmp kernel. To see what kernel you are using if you already have Trixbox loaded, type in “uname –r” at the command prompt.
4. I turned the hyper threading off on my system for this RAID install.

Procedure:

1. Boot to the Trixbox2.2 CD and when it gives you the option to select ENTER or type in advanced. Type in advanced and then hit the enter key.
2. The next thing it will ask is the keyboard type. Mine is US so I selected US
3. Now it will ask you if you want to Autopartition, Disk Druid or Back. Choose Disk Druid
4. If you see anything except the Free space under the /dev/sda and /dev/sdb devices choose it and delete it till all you see is Free space under each that shows your drive capacity.
5. If you only see /dev/sda then your second drive is not being seen and you have to fix this.
6. If you don’t see /dev/sda and /dev/sdb and you see something like /dev/hda then you are not using SATA drives. Make sure also that you had your drives plugged in the mother board in SATA slot 0 and 1. Drive recognition starts its count at 0 not 1.
7. I use SATA so if you are using IDE then follow as close as you can on the HOW2 by “sda = hda” and “sdb = hdb”
8. Now its time to configure your partitions. I use 3 partitions. The first is “/boot” then “swap” then the rest “/”. Explanation of the partitions “/boot” = Where the boot loader Grub lives to tell the system how to boot your OS, “swap” = Portion of the hard disk that is used for virtual memory, “/” This is the rest of the disk and where all the other files will be installed.
9. Add the first software RAID member under /dev/sda by selecting New at the bottom of the partitioning page. Don’t worry about the mount point yet and tab to “File System Type” and arrow down to choose software RAID. Now tab to “Allowable Drives” arrow down to sdb and hit the space bar and it will unselect sdb. Now tab to Size and change it to 500. (I know it does not have to be 500 and it can be like 100 but this is my how2 and I did this to allow more room for the /boot than you will ever need ). Now tab to “Force to be a primary partition” and hit the space bar. This will select it. You want this to be primary because linux needs to see the boot record in the first part of the drive to make things smoother if not necessary. Now tab to and click Ok. You will now see a new partition under /dev/sda that looks like this “sda1 1 64 502 software R” You will notice the 500 is not exact and its ok because the system just did its little bite compensation.
10. Now you have to add the first RAID member under /dev/sdb that will memic the one you just created under /dev/sda.
11. Add the first software RAID member under /dev/sdb by selecting New at the bottom of the partitioning page. Tab to “File System Type” and arrow down to choose software RAID. Now tab to “Allowable Drives” hit the space bar and it will unselect sda. Now tab to Size and change it to 500. Now tab to “Force to be a primary partition” and hit the space bar. This will select it. Now tab to and click Ok. You will now see a new partition under /dev/sdb that looks like this “sdb1 1 64 502 software R”
12. Add the Second software RAID member under /dev/sda by selecting New at the bottom of the partitioning page. Tab to “File System Type” and arrow down to choose software RAID. Now tab to “Allowable Drives” arrow down to sdb and hit the space bar and it will unselect sdb. Now tab to Size and change it to 2048. (This will be twice the size of your RAM in the machine so if you have 512 then this number should be 1024 instead of 2048). Do not make any other changes and DO NOT select “Force to be a primary partition” Now tab to and click Ok. You will now see a new partition under /dev/sda that looks like this “sda2 65 325 2047 software R” (Again the Size 2047 is a bit off but is ok).
13. Add the Second software RAID member under /dev/sdb by selecting New at the bottom of the partitioning page. Tab to “File System Type” and arrow down to choose software RAID. Now tab to “Allowable Drives” hit the space bar and it will unselect sda. Now tab to Size and change it to 2048 (This will be twice the size of your RAM in the machine so if you have 512 then this number should be 1024 instead of 2048). Do not make any other changes and DO NOT select “Force to be a primary partition” Now tab to and click Ok. You will now see a new partition under /dev/sdb that looks like this “sdb2 65 235 2047 software R”
14. Add the Third software RAID member under /dev/sda by selecting New at the bottom of the partitioning page. Tab to “File System Type” and arrow down to choose software RAID. Now tab to “Allowable Drives” arrow down to sdb and hit the space bar and it will unselect sdb. Now tab to Size and change it to 145000 *******(My drives are 160GB but they only show up as about 153GB. I want to make the sum of all the partitions less then my drive capacity so that if I ever have to put in another drive because one fails I will be putting in one bigger than the capacity I have allocated for all these partitions. I chose 145GB for the rest of my drive partition because I know that if I buy another 160GB drive it should be bigger than the sum of my 3 partitions. I gave myself a 5GB fudge factor. This decision is yours but be warned if you don’t allow for this and a drive fails and you try to put in a smaller capacity drive or even one that says it’s the same. They all say on size and they are all smaller than that by 10GB in some cases)*******. Do not make any other changes and DO NOT select “Force to be a primary partition” Now tab to and click Ok. You will now see a new partition under /dev/sda and also the last partition and the one you just created may swap places and the 145000 will now looks like this “sda2 65 18549 145000 software R” (Again if the Size 145000 is a bit off its ok).
15. Add the Third software RAID member under /dev/sdb by selecting New at the bottom of the partitioning page. Tab to “File System Type” and arrow down to choose software RAID. Now tab to “Allowable Drives” hit the space bar and it will unselect sda. Now tab to Size and change it to 145000 (The previous example will explain this number and the same applies here but you have to enter the same number her as you did for the step above). Do not make any other changes and DO NOT select “Force to be a primary partition” Now tab to and click Ok.
16. At this time you will have 3 software R partitions under /dev/sda and 3 under /dev/sdb. The 2 most important things at this point are: 1. the 500 partition is first or on top in both and 2. all the numbers match in order and size under /dev/sda and /dev/sba. The only exception to matching will be the left over Free Space( I have 5057 let over on each but they could have been off a bit due to total drive size)
17. Now you have to pair the RAID partitions together and assign mounting points to them.
18. Tab over to RAID and select it. Under “Mount Point” type in “/boot”. Leave “File System Type” on ext3” and tab to “RAID Level” arrow to RAID1 and tab to “RAID Members” Unselect all but sda1 and sdb1 by arrowing down and hitting the space bar on the ones that are not sda1 and sdb1. Now tab to and select ok.
19. You will now have a “RAID Device 0” and its size will be the “500” and Type will be “ext3” and its Mount will be “/boot”
20. Select RAID button again and now we are going to add the RAID pairing for the large part of our drive partition. Under “Mount Point” type in “/” and leave “File System Type” ext3 and tab to RAID and select RAID1. Now tab to “RAID members:” and unselect all but sda2 and sdb2. Tab to OK and select it
21. Now you will have to RAID devices and the only important thing is “145000 is associated with the /” and the “500 is associated with the /boot”
22. Now to pair the “swap” RAID partitions and it’s a bit different. Some may say you don’t have to RAID the “swap” partition but this how2 does 
23. Select RAID button and tab to “File System type:” and arrow down to “swap” then tab to “RAID Level” and select RAID1. Now tab thru to OK and select it.
24. Ok now all the RAID one steps should be complete and you can choose OK and the bottom.
25. The next screen it will take you to is “Boot Loader Configuration” I left the default “Use GRUB Boot Loader” selected and chose OK
26. The next screen you should also leave default unless you know what you are doing here or need to add something special to your system. Choose OK
27. The next screen will ask you if you want a GRUB password. Don’t set one here and just leave default and tab down and select OK.
28. The next screen should ask you if you want to install CentOS-4 i386 on Device /dev/md0. This should be correct and you can tab to OK and select it.
29. If you made it this far you should now see the familiar choose your time zone and select the correct one for your area of the world. Mine is America/Chicago so I chose that and then OK.
30. Now it will ask you for the root user password. Mine is “hahahahahaha yea right” and then chose OK
31. You should now see the file system loading and if you made it this far the chances are good you are home free.
32. That’s if folks. I will now post a few commands to allow you to see your new drives from the command prompt once you log in.
33. One last thing. It will take a while for the big drives to sync and you can see the sync process view commands in the next section. I suggest you wait to make any changes to your system until the md0 mirror is finished syncing.

TESTING:

1. “df -h” = This command will give general info about your drives
2. “cat /proc/mdstat” = This command will show you detailed information about your RAID and drive configuration
3. “mdadm --detail /dev/md0” = This will give you details about the individual partition pairing for “md0” you can substitute for md1 and md2.
4. “mdadm /dev/md0 --fail /dev/sda1” then type mdadm: set /dev/sda1 faulty in /dev/md0 = This will simulate drive failure and cause drive “sda” to fail and you will see this in the cat /proc/mdstat command as md0 section to the right of blocks as [2/1] instead of the [2/2] if it was working
5. After you remove the failed member from the array type in: “mdadm /dev/md0 --remove /dev/sda1” then mdadm: hot removed /dev/sda1
6. When you replace the drive type in: “mdadm /dev/md0 --add /dev/sda1” then mdadm: hot added /dev/sda1
7. You can now do the cat /proc/mdstat command to see the status of the rebuild.

I hope this helps at least one person and it was worth it. I want to give credit to my buddy Brad (Linux God) and Dan with the University of Florida for help in getting this to work and how to test it.

Also, if I pooched the screw on any of this or if it does not work out for you, sorry, I tried.

Damien



JasonR
Posts: 345
Member Since:
2006-05-31
Looks good, Damien. Nice

Looks good, Damien. Nice work.

I'm in the camp that would recommend not running RAID-1 on the swap partition, but as you said, it's your how-to. ;) The alternative for those that are wondering would be to just create one swap partition on each of the drives adding up to the total swap space you wish to allocate. Linux has no problems working with multiple swap partitions, and there's not really any great reason to protect your swap partition with raid mirroring.

On a separate note, I would personally not recommend disabling SMP... but hey, different strokes. I figure, you paid for it, it works, so no reason to disable it.

- Jason

--

Jason Reiser
http://www.centpbx.com/



unitetech
Posts: 113
Member Since:
2007-01-19
Right On Jason

What you say is on the money about the swap partition. I just did it in this post to explain how. I agree with you that you dont need to. I actually dont normally do swap RAID but I was doing a lot of testing today and decided to see if it would cause any negatives on my system. If the drive went out i agree the swap loss is not a big deal. So thanks for the post with that info.

On the SMP issue. Before Trixbox2.2 came out there was no built in support for the Digium DTM800 card and you had to rebuild the zaptel drivers to the latest 1.2 version to get the system to see it and have it work. Trixbox2.2 has taken care of that issue. Anyways, the reason I am so gun shy on the smp is because in rebuilding the zaptel time after time that kernel decided to die after I did it and I did all the right devel downloads and everything and it still blew up my system. So, why now that the 8 port card problem is fixed am I still scared of it. Well, now the Trixbox2.2 has a nice little bug in it that causes severe echo problems with the TDM04B card. There are 2 fixes for this. 1 is the rebuild of the zaptel drivers on your system and the other is softecho patch. Both work but man I am so tired of blowing up my boxes from rebuilding zaptel drivers under the hyper threading kernel. Anyways im sure there are people out there that got around this but I was building this thread with the intent to address the ELsmp issue along with the RAID1 HOW2.

Damien



unitetech
Posts: 113
Member Since:
2007-01-19
2 Boxes in production in this state.

I now have 2 boxes in production in this state with the swap partition also in RAID and they have been working great. Just an update.

Damien



jahyde
Posts: 1980
Member Since:
2006-06-02
hate to burst your bubble,

hate to burst your bubble, and tell you that your time was a waste, but all that can be done by just typing sataraid at the trixbox installer prompt - automatically sets up a raid1 of 2 sata or scsi drives:

http://forge.trixbox.org/gf/project/trixbox2/wiki/?section=projec...

--

--my PBX is run on 2 V8's



unitetech
Posts: 113
Member Since:
2007-01-19
Busting bubble welcome!

Well I will always learn something new everyday. I didnt see the info that covered that one but I look forward to trying it out. If that does work then all the better. Thanks for the post.

Damien



jahyde
Posts: 1980
Member Since:
2006-06-02
dont stop hacking at it -

dont stop hacking at it - you are contributing some nice work - the mondo backup stuff is working great now.

--

--my PBX is run on 2 V8's



patrickhogan22@...
Posts: 2
Member Since:
2007-08-20
No Bubble burst here

I read the comment about the sataraid option and jahyde is absolutely correct for SATA and most current production boxes that are new and have SATA, but this post helped out extremely well for my backup trixbox server which still runs IDE drives where the trixbox sataraid will only use sata drives, sdX. Thanks alot Unitech, the other how-to's wanted me to edit the kickstart config file on the cd which works but is much more complex.



andrew
Posts: 740
Member Since:
2006-05-30
SWAP on RAID

If you notice the sataraid option on trixbox sets up a swap partition on RAID. If you don't do this your system will hang if you lose the drive that has the SWAP on it.



karllui2008
Posts: 114
Member Since:
2007-10-18
Where can I find this?

Hi,
The link is broken: http://forge.trixbox.org/gf/project/trixbox2/wiki/?section=projec...

I'm wondering if someone know where I can find this information?

Thanks,



KodaK
Posts: 1872
Member Since:
2006-06-14
I don't know if this is the

I don't know if this is the same one, but I found this:

http://www.trixbox.org/wiki/Software-Raid

Also, a hint on using google: the "site:" modifier is your friend. I found this by doing the google search:

"site:trixbox.org linux software raid"

without the quotes, of course.

The built in search in drupal (the forums software that has been poorly implemented here) doesn't appear to search the wiki, as far as I can tell.

--

I'm happy to try to help in these forums for free, but if you feel compelled, or if you desire one on one help, my Paypal address is: sakodak@gmail.com



karllui2008
Posts: 114
Member Since:
2007-10-18
This is right

This link gives the right information. Thank you very much.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.