๑๐/๒๘/๒๕๕๒

INSTALLING SLACKWARE LINUX version 8.1 WITH ROOT PARTITION ON A SOFTWARE RAID level 0 DEVICE.

INSTALLING SLACKWARE LINUX version 8.1 WITH ROOT PARTITION ON
A SOFTWARE RAID level 0 DEVICE.

20021009  v 1.0.1



      Copyright (c)  2002  Karl Magnus Kolst๘.
      Permission is granted to copy, distribute and/or modify this document
      under the terms of the GNU Free Documentation License, Version 1.1
      or any later version published by the Free Software Foundation;
      with no Invariant Sections, no Front-Cover Texts, and no
      Back-Cover Texts.
      A copy of the license can be found here;
        http://www.gnu.org/licenses/fdl.txt

If you screw up something (like your data and/or your hardware)
while using this document it is your fault, not mine.
You should know what you are doing.  Reading some documentation
on software RAID is highly recommended.
(I.e the Software-RAID-HOWTO;
 http://www.tldp.org/HOWTO/Software-RAID-HOWTO.html )


Document History:

 v 1.0.1 20021009 Fix up the wording of a couple of sentences.
 v 1.0 20020913 Initial release.



This document is a small write-up on how I did install Slackware 8.1
on a software raid 0, aka striping.
Note that this document does not cover troubleshooting, only the
exact steps that should be nessesary to put Slack 8.1 on /
At least they where the steps I had to do to make it work.

This write-up should be usable for setting up software raid 
level 4 or 5 on Slackware too (with some tweaking).
As for raid level 1 the configuration should be similar too,
but different enought to say that this write-up doesn't cover it.

My disk setup was 7 disks on one SCSI channel.
(yes, I _know_ you shouldn't have that many drives on one channel :)
The computer could boot from those drives.

First I booted from the Slackware 8.1 CD.
Had to use kernel scsi.s because of my scsi setup.

At the prompt I started partitioning the drives with fdisk.
All my drives where identical, so I decided to partition them identically.
Partition 1 on each disk I put a 15MB partition.
Partition 2 on each disk I put the partition to be raided.
Partition 4 on each disk I put a swap partition.
(Why 4 and not 3?  Just a personal convention.  I always put swap
 on the forth primary partition on a disk.)

Then I set partition types 83, FD and 82 respectively.

Why that 15MB partition?  Linux can't boot the kernel directly
off of a software raided partition (raid1 is another story) so
it needs a partition to get the kernel from which is not a part of
a raid set.

That first partition on first drive (/dev/sda1 in my case)
I wanted to mount under /boot.  But why waste disk space?
I ended up setting up first partition on all the other drives
to type 82 (linux swap).  That way I ended up with 13(!) swap partitions.
A better way would probably be to set up the raid partitions on the end
of the drive and make a larger swap partition on the beginning of
each drive.  But then take 10-20MB of the the swap partition on the
first drive and use that for /boot.

Anyway I now have 7 drives partitioned the way I want.

First I must configure the raid.

Check if /dev/md0 exists.  (like 'ls -l /dev/md0')

If it doesn't exist, create it;
 mknod /dev/md0 b 9 0

I created a /etc/raidtab which looked like this;

-------- cut ---------
raiddev /dev/md0 
 raid-level 0
 nr-raid-disks 7
 nr-spare-disks 0
 chunk-size 32
 persistent-superblock 1
 device  /dev/sda2
 raid-disk 0
 device  /dev/sdb2
 raid-disk 1
 device  /dev/sdc2
 raid-disk 2
 device  /dev/sdd2
 raid-disk 3
 device  /dev/sde2
 raid-disk 4
 device  /dev/sdf2
 raid-disk 5
 device  /dev/sdg2
 raid-disk 6
-------- cut ---------

Then we need to start the raid set;
 mkraid /dev/md0
(if you have an already started set you must stop that and
 restart with option --force. (read the instructions))

Now it's time to create a filesystem on the "new" device.

 mke2fs -j -c -b 4096 -R stride=8 /dev/md0

I want ext3 (-j) I want to check the filesystem (-c) I want 4k block size
(-b 4096, which is default by the way) and I want to tell the formatting
tool something about my raid chunk size.
Calculate it this way;  stride = chunk-size / block-size
(all values in kilobytes)
For me the calculation is;  32 / 4 = 8


I must not forget to format the partition which is going to be /boot

 mke2fs -j -c /dev/sda1

Instead of letting the Slackware setup mount the partitions I do it myself.
(the setup is *not* aware of raid devices anyway, so this needs to be done
 manually.)

 mount /dev/md0 /mnt
 mkdir /mnt/boot
 mount /dev/sda1 /mnt/boot

Then we can run 'setup'

Do a regular install, but be sure to *not* add any partitions
to install on.  Just choose;  
 "---  (done adding partitions, continue with setup"
I also chose simple lilo install on mbr.

When the install is done, exit 'setup' and do the following;

 cp /etc/raidtab /mnt/etc/raidtab

edit /mnt/etc/fstab and add;
 /dev/md0 / ext3 defaults 1 1
 /dev/sda1 /boot ext3 defaults 1 2

edit /mnt/etc/lilo.conf

be sure that;
 root = /dev/fd2
gets changed to;
 root = /dev/md0


Then run
 lilo -C /mnt/etc/lilo.conf


Now you should be able to boot the machine with / on a RAID 0 device.


When trying to follow my own write-up I had the following problem
when trying to boot up the newly installed Slackware.
(This happend once of the 4 times I tested.)

For every partition I got;
 md: /dev/sda2's has invalid sb, not importing!
(Or a similar error message, at that point I didn't take notes, sorry.)

The computer halted with a Kernel Panic during boot.

I then booted from the CD again, created /etc/raidtab again
(equal to the first one), and reran mkraid /dev/md0.
After that I could mount /dev/md0, and everything looked
ok there.  Slackware was installed.
I did reboot, and everything came up as it should.

I still wonder if I followed this write-up to the letter or if
something strange happened.


Suggestions and error corrections are welcome.

Karl Magnus Kolst๘  karl.kolsto@geo.uib.no


Thanks to John Jenkins and Erik Jan Tromp for looking through this doc
and comming with suggestions.

# end of file


Get it from : http://userlocal.com/articles/raid0-slackware-linux.php

ไม่มีความคิดเห็น: