![]() |
Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
As promised in yesterday's article, I am following up with a writeup about RAID. In the past the "I" in RAID was just a figure of speech, but now it really *is* inexpensive. Scenario: My old Pentium-II box came with a 10-gig IDE drive, and I had a blank 80-gig unit lying around unused since getting a warranty replacement in the mail sometime last year. I did my Suse 8.2 installation on the 80-gig unit, taking care to put system and personal files in a 9-gig partition. Inspiration: the Software-RAID HOWTO at http://www.tldp.org/HOWTO/Software-RAID-HOWTO.html . Comments: In the past I've always assumed that if you wanted decent performance, you had to buy custom RAID hardware at fairly big prices. In fact my home file server is a three-kilobuck system I bought 3-1/2 years ago from a company that specializes in turnkey 3Ware-based Linux boxes. However, the HOWTO points out what now seems to me pretty obvious: any old motherboard has two separate IDE buses, and a PCI bus outperforms hard drive throughput by more than a factor of two. So assuming you have a modern CPU, you can configure RAID without buying any hardware at all, and get performance within a hair's breadth of a typical hardware RAID controller. In fact you can probably get quite good performance even with a pretty old CPU. And I also assumed that you needed multiple identical disk drives. Not true with software RAID. Why RAID? Well, it's a real time-consuming pain in the butt to reinstall a system from backup. And most of us are kinda lazy about backups. Disc drives are 100 times more reliable than they were 10 years ago--but do you want to trust everything to a drive, especially if you can have a continuous automatic backup with a mere 60 minutes or so of advance prep? I knew nothing about the MD device driver at 5pm today. At 10:30pm, I had my system up and running in a RAID-1 configuration (spent three of those hours bowling). If I can do this in 60 minutes, so can you. Steps to take: (I used "method 2" in the RAID-1 section of the HOWTO.) - Make sure you have a kernel built to support raid1. - Install a drive on each IDE bus. In my case hda is the 80GB drive, hdc is the 10GB drive. - Back up the smaller drive if you need anything from it anymore. - Create a partition on the smaller drive equal in size or slightly smaller than your current root partition. (My root dir is 9GB on each drive.) Set its type to "fd", for RAID autodetect. - Using yast2 or an editor, create /etc/raidtab with the following contents: -- raiddev /dev/md0 raid-level 1 nr-raid-disks 2 nr-spare-disks 0 persistent-superblock 1 chunk-size 16 device /dev/hdc2 raid-disk 0 device /dev/hda2 raid-disk 1 failed-disk 1 -- In the above example, hda2 is the current root partition, and hdc2 is the new partition. (My new distro is on the 80GB drive /dev/hda, my old system was on /dev/hdc--I'd made a copy of the old system first, and then wiped the drive.) - Invoke 'mkraid /dev/md0' to write the superblock to the new partion. (Takes only a second.) - Create a filesystem on /dev/md0 using mkfs. (A reiserfs filesystem takes only a couple seconds to generate.) Mount it to /mnt. - Shut down apps or go standalone, and copy your root filesystem to /dev/md0. I used the command 'cd / ; tar cf - . | (cd /mnt ; tar xpf - )'. This is the only lengthy part of the process, figure on a coffee break depending on how big your root fs is. - Update your lilo or grub configuration, and fstab in /mnt/etc, to point root at /dev/md0 instead of its old setting. - Reboot and you're running in degraded RAID1 on /dev/md0. Once you're satisfied with the system, run fdisk to change the partion type to 'fd' on your former root, edit out the "failed-disk" line in /etc/raidtab, reboot again and you'll see in /var/log/messages that both discs are now members of the array but that one is unavailable. - Invoke 'raidhotadd /dev/md0 /dev/hda2' to sync the two drives. You'll see a bunch of messages in /var/log/messages, and in a matter of minutes the two drives will be synced. But you won't need to go grab a cup of coffee this time--you can go on your merry way as soon as you invoke raidhotadd. Repeat the above with any other partitions you want beyond the root. Bottom line: My 5-year-old 10-gig drive has a new lease on life as a hot backup. I no longer have to entrust files to a new disk that may have sudden infant death, nor do I have to entrust them to an old disk that might be near the end of its life. Peace of mind! As for performance, do a couple of 'time cp foo bar' commands with say 100-meg files before and after your upgrade. I challenge you to measure the difference, it's basically the same on my system. Cost: Zero. The price of a disk upgrade that I had already done. Labor: an hour, about the time you'd wait for a new pair of glasses ;-) -rich
![]() |
|
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |