A James Lewis <[EMAIL PROTECTED]> wrote:
>
> I posted this a while back, I think some people found it usefull... so
> here goes again....
>

Thanks for taking the time to write up this cookbook (included at the end
for folks who missed it), it sure looks like FAQ material to me.  It's
relatively intuitive, doesn't require messing around with boot disks and
initrd, and it worked flawlessly for me to build a raid1 set starting out
with a fresh system install on just one of the disks (in my case,
/dev/sda3).

To add a little bit of thinking on /boot...  I have a small ext2fs partition
(/dev/sda1) which is mounted as /boot that is not raid.  That same partition
is mirrored (manually) as /dev/sdb1, and I instructed lilo to install a boot
block in the MBR of /dev/sdb.  This covers your butt in case sda fails and
you have to reboot for some reason (i.e., sdb becomes sda) and saves having
to boot off a rescue disk of some kind.  To accomplish this, I did:

# dd bs=1024 if=/dev/sda1 of=/dev/sdb1
# /sbin/fsck.ext2 /dev/sdb1    [to "clean" the file system]
Edit /etc/lilo.conf, change boot spec to "boot = /dev/sdb"
# /sbin/lilo   [you'll get a warning about it not being the first disk]
Edit /etc/lilo.conf, change back the boot spec to /dev/sda

Adjust specifics as necessary (partition numbers, disk instances).  My
specifics are:

   Two 9.1G SCSI disks, both partitioned identical (X = { a, b} ):
      /dev/sdX1, 8meg, mounted as /boot
      /dev/sdX2, 512meg, swap
      /dev/sdX3, 8Gig+, one mirror of /dev/md0

Caveats at this point in time:

> The "failed-disk" patch is already included in the latest package
(19990824).

> Patching raid0145-19990824 against the 2.2.12 kernel works except for
include/linux/fs.h.  For some reason, the fs.h included in the stock kernel
bundle has all the right things already in it.  Patch will ask if it should
assume you want the patch reversed -- answer "no" and then tell it to skip
applying the patch for fs.h.

Good work!

Regards,
Mike

PS:  Because I'm using Ultra2 drives, I'm using a chunk size of 256 for
better read performance.  I have no idea if it's even close to optimal, but
it's better than a chunk size of 4.  Anybody have good insight on this
setting?

--
Michael Milligan - Acme Byte & Wire LLC - [EMAIL PROTECTED]

---------- Forwarded message ----------
Date: Fri, 09 Jul 1999 12:49:10 +0100
From: A James Lewis <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Linux root mirror

This guide assumes that there are two disks hda & hdc, and that "/" is
/dev/hda2

It also assumes that /boot (The kernel) is NOT on /.  /boot requires
special handling but I suggest simply maintaining a copy on both disks
until LILO is raid aware.

This example was done with Martin Bene's failed disk patch and raidtools
snapshot 19990421 (+kernel patches) and Linux 2.2.6.  All of which must be
installed before you start!

1. Create "raidtab" file. (Note deliberately failed disk = mounted "/")

raiddev /dev/md0
  raid-level            1
  chunk-size            64
  nr-raid-disks         2
  nr-spare-disks        0

  device                /dev/hdc2
  raid-disk             0
  device                /dev/hda2
  failed-disk           1

2. run mkraid.

DESTROYING the contents of /dev/md0 in 5 seconds, Ctrl-C if unsure!
handling MD device /dev/md0
analyzing super-block
disk 0: /dev/hdc2, 700560kB, raid superblock at 700480kB
disk 1: /dev/hda2, failed

3. mke2fs the new array

mke2fs 1.14, 9-Jan-1999 for EXT2 FS 0.5b, 95/08/09
Linux ext2 filesystem format
Filesystem label=
175440 inodes, 700480 blocks
35024 blocks (5.00%) reserved for the super user
First data block=1
Block size=1024 (log=0)
Fragment size=1024 (log=0)
86 block groups
8192 blocks per group, 8192 fragments per group
2040 inodes per group
Superblock backups stored on blocks:
        8193, 16385, 24577, 32769, 40961, 49153, 57345, 65537, 73729,
81921,
        90113, 98305, 106497, 114689, 122881, 131073, 139265, 147457,
155649,
        163841, 172033, 180225, 188417, 196609, 204801, 212993, 221185,
229377,
        237569, 245761, 253953, 262145, 270337, 278529, 286721, 294913,
303105,
        311297, 319489, 327681, 335873, 344065, 352257, 360449, 368641,
376833,
        385025, 393217, 401409, 409601, 417793, 425985, 434177, 442369,
450561,
        458753, 466945, 475137, 483329, 491521, 499713, 507905, 516097,
524289,
        532481, 540673, 548865, 557057, 565249, 573441, 581633, 589825,
598017,
        606209, 614401, 622593, 630785, 638977, 647169, 655361, 663553,
671745,
        679937, 688129, 696321

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

4. Change root to /dev/md0 in /etc/fstab.

5. Copy filesystem to new array, mounted on /mnt.

moo:/# for i in `ls | grep -v mnt | grep -v proc`
> do
> cp -dpR $i /mnt
> done

6. Edit /etc/lilo.conf on old copy to spec "root = /dev/md0" (The new
array)

7. Run lilo to reinstall the bootblock

moo:/# lilo
Added Linux *
moo:/#

8. Use fdisk to mark the new partition as type "0xfd" so it can autostart.

9. Reboot

10. Pray, time passes.

11. run "df" to ensure that your new array is indeed  mounted as "/"

12. edit lilo.conf (You have an old copy now!) to refer to your array.
(You could have edited this before booting but I think it's better to do
it now since you are making it look like your system does now, not what
you think it might look like in the future  You can predict the future
if you like once you become an expert at this.)

13. run lilo again to reinstall the bootblock, ensure it doesn't error!!
If you get an error return to step 11.

14. mkdir /proc & /mnt (You excluded these earlier to avoid recursive
copy)

15. mount /proc

16. raidhotadd /dev/md0 /dev/hda2 (Add your old root volume to the
array... Like ODS/SDS metareplace.

17. cat /proc/mdstat and see your reconstruction in progress...

moo:~# more /proc/mdstat
Personalities : [raid0] [raid1] [raid5]
read_ahead 1024 sectors
md0 : active raid1 hda2[2] hdc2[0] 700480 blocks [2/1] [U_] recovery=2%
finish=17.3min
unused devices: <none>

18. Use fdisk to mark old "/" partition as type "0xfd" so it can also
autostart.

19. Wait until resync complete and reboot.

20. Congratulations you now have a mirrored "/"

Now think about swap and /boot...


Reply via email to