All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] PA-RISC Linux RAID1 Root HOWTO
@ 2003-01-14 19:27 Martin K. Petersen
  0 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2003-01-14 19:27 UTC (permalink / raw)
  To: parisc-linux

PA-RISC Linux RAID1 Root HOWTO

I successfully got mirrored system drives going in my C3000 and
thought I'd share what I did to make this work.

Unfortunately, the Debian boot floppies do not support installations
onto software RAID so this is a multi-stage process:

    o Installing Debian on disk 1

    o Creating a degraded RAID1 array on disk 2 and copying the
      Debian installation over from disk 1

    o Repartitioning disk 1 and attaching it to the degraded array


                              --- o ---


1. First install a base Debian as usual onto the first disk.


2. Partition the second drive along the lines of this:  

    Disk /dev/sdb: 9173 MB, 9173114880 bytes
    255 heads, 63 sectors/track, 1115 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

       Device Boot    Start       End    Blocks   Id  System
    /dev/sdb1             1         5     40131   f0  Linux/PA-RISC boot
    /dev/sdb2             6        14     72292+  fd  Linux raid autodetect
    /dev/sdb3            15        77    506047+  fd  Linux raid autodetect
    /dev/sdb4            78      1115   8337735   fd  Linux raid autodetect

Caveat: If your two disks are not the same brand/model, you need to be
extra careful.  Capacities tend to vary a bit between models and you
must make sure that you can fit the same number of blocks on both
drives.  Use fdisk to compare the disk sizes and adjust the partition
sizes accordingly.

Note how the partition type is set to "Linux raid autodetect" (0xfd)
instead of the usual "Linux" (0x83).

The first partition is PALO, followed by /boot, swap and then a big
root.  As usual it's important that /boot is within the first 2GB.
You can have more partitions if you wish, but for this exercise I
decided to keep things to a minimum.


3. Now it is time to create the raid devices:

    # apt-get install mdadm
    # mdadm --create /dev/md0 --level 1 --raid-devices=2 missing /dev/sdb2
    # mdadm --create /dev/md1 --level 1 --raid-devices=2 missing /dev/sdb3
    # mdadm --create /dev/md2 --level 1 --raid-devices=2 missing /dev/sdb4

This creates 3 degraded RAID1 devices (/boot, swap, and /) consisting
of a placeholder ("missing") and the partitions created on /dev/sdb.

    # cat /proc/mdstat 
    Personalities : [linear] [raid0] [raid1] [raid5] 
    read_ahead 1024 sectors
    md2 : active raid1 sdb4[1]
          8337664 blocks [2/1] [_U]

    md1 : active raid1 sdb3[1]
          505920 blocks [2/1] [_U]
      
    md0 : active raid1 sdb2[1]
          72192 blocks [2/1] [_U]
      
    unused devices: <none>

Note how the first drive in all three cases is missing ("_") as
opposed to up ("U").


4. Create filesystems/swap space:

    # mke2fs -j /dev/md0
    [...]
    # mke2fs -j /dev/md2
    [...]
    # mkswap /dev/md1
    [...]


5. Mount the filesystems and copy data over:

    # mount /dev/md2 /mnt
    # mkdir /mnt/boot
    # mount /dev/md0 /mnt/boot 
    # cd /mnt
    # tar -C / -clspf - . | tar -xlspvf -


6. Edit the /mnt/etc/palo.conf so it looks like this:

    # cat /mnt/etc/palo.conf 
    --commandline=2/vmlinux root=/dev/md2 HOME=/
    --recoverykernel=/boot/vmlinux-2.4.17-32


7. Make /dev/sdb bootable by running palo:

    # palo -f /mnt/etc/palo.conf -I /dev/sdb
    palo version 1.1 mkp@allegro Tue Jan 14 12:44:00 EST 2003
    ELF32 executable
    Partition Start(MB) End(MB) Id Type
    1               1      39   f0 Palo
    2              40     109   fd RAID
    3             110     604   fd RAID
    4             605    8746   fd RAID
    ipl: addr 32768 size 30720 entry 0x0
     ko 0x0 ksz 0 k64o 0x0 k64sz 0 rdo 0 rdsz 0
    <2/vmlinux root=/dev/md2 HOME=/>
    ipl: addr 32768 size 30720 entry 0x0
     ko 0x48000 ksz 3687647 k64o 0x0 k64sz 0 rdo 0 rdsz 0
    <2/vmlinux root=/dev/md2 HOME=/>

I have committed a small change to palo to allow it to boot from RAID
partitions.  So you have to grab the CVS version of palo until Paul
makes a new release.


8. Update /mnt/etc/fstab so it says:

    /dev/md2   /       ext3    errors=remount-ro       0       1
    /dev/md1   none    swap    sw                      0       0
    /dev/md0   /boot   ext3    errors=remount-ro       0       2
    [...]


9. Shut down and boot off the RAID device on the second disk:

    Main Menu: Enter command > boot fwscsi.6.0

Substitute whatever the drive is called on your box.  It varies
depending on machine type.

After booting up, make sure things look like this:

    # swapon -s
    Filename                    Type            Size    Used    Priority
    /dev/md1                    partition       505912  0       -1
    # mount | grep md
    /dev/md2 on / type ext3 (rw,errors=remount-ro)
    /dev/md0 on /boot type ext3 (rw,errors=remount-ro)


10. At this point the box is running off the degraded RAID1 devices.
It is time to repartition the first disk so it matches the layout of
the second drive:

    Disk /dev/sda: 9173 MB, 9173114880 bytes
    255 heads, 63 sectors/track, 1115 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

       Device Boot    Start       End    Blocks   Id  System
    /dev/sda1             1         5     40131   f0  Linux/PA-RISC boot
    /dev/sda2             6        14     72292+  fd  Linux raid autodetect
    /dev/sda3            15        77    506047+  fd  Linux raid autodetect
    /dev/sda4            78      1115   8337735   fd  Linux raid autodetect


13. Once partitioning is taken care of, attach the new partitions to
the existing (degraded) RAID arrays:

    # mdadm /dev/md0 -a /dev/sda2
    mdadm: hot added /dev/sda2

    # mdadm /dev/md1 -a /dev/sda3
    mdadm: hot added /dev/sda3

    # mdadm /dev/md2 -a /dev/sda4
    mdadm: hot added /dev/sda4

    # cat /proc/mdstat 
    Personalities : [linear] [raid0] [raid1] [raid5] 
    read_ahead 1024 sectors
    md0 : active raid1 sda2[2] sdb2[1]
          72192 blocks [2/1] [_U]
          [====>................]  recovery = 23.9% (18112/72192) finish=0.1min speed=6037K/sec
    [...]


After a while all devices are in sync:

    # cat /proc/mdstat
    Personalities : [linear] [raid0] [raid1] [raid5] 
    read_ahead 1024 sectors
    md0 : active raid1 sda2[0] sdb2[1]
          72192 blocks [2/2] [UU]
      
    md1 : active raid1 sda3[0] sdb3[1]
          505920 blocks [2/2] [UU]
      
    md2 : active raid1 sda4[2] sdb4[1]
          8337664 blocks [2/2] [UU]

    unused devices: <none>


14. Make sda bootable with palo:

    # palo -I /dev/sda


15. Tell the system firmware which devices to boot from (again, your
drive names may vary) and turn on auto {boot,search,start}:

    Main Menu: Enter command > pa pri fwscsi.5.0
      Primary boot path:    FWSCSI.5.0

    Main Menu: Enter command > pa alt fwscsi.6.0
      Alternate boot path:  FWSCSI.6.0

    Main Menu: Enter command > co

    Configuration Menu: Enter command > au bo on
      Auto boot:            ON

    Configuration Menu: Enter command > au sea on
      Auto search:          ON

    Configuration Menu: Enter command > au st on
      Auto start:           ON

    Configuration Menu: Enter command > reset


And that's it.  Should the primary drive fail, the system will attempt
to boot from the alternate path (Assuming the SCSI bus isn't hosed,
that is.  On servers like A500 the two drive bays are on different
controllers for this reason.  But C3000 is a workstation and doesn't
have that feature).

-- 
Martin K. Petersen      http://mkp.net/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [parisc-linux] PA-RISC Linux RAID1 Root HOWTO
@ 2003-01-15  8:36 jsoe0708
  2003-01-15 16:26 ` Martin K. Petersen
  0 siblings, 1 reply; 5+ messages in thread
From: jsoe0708 @ 2003-01-15  8:36 UTC (permalink / raw)
  To: Martin K. Petersen, parisc-linux

Martin,

Congratulation, great job.

I already build a raid1 on my b180 but /boot partition and it works fine.=

So I now just have to update palo build the raid1 on this boot slice.

Well just a stupid question:
since now my md devices were:
/dev/md0(sda5+sdb5) /
/dev/md1(sda2+sdb2)  swap
/dev/md2(sda6+sdb6) /home
...
and I would like it becomes:
/dev/md0(sda3+sdb3) /boot
/dev/md1(sda5+sdb5) /
/dev/md2(sda2+sdb2) swap
...

so, finaly, how to remumber md0 into md1 ...?

I would also ask you if you could advise me on the resizing of a md.
My md7 is a raid1 with the last slices sda11 and sdb11 of disks (mounted
on /var). As there are still some free space at the end of each disk, I
would like to increase it. Could you advise me howto do (I try to find do=
c
but no success and my test was not more succesfull and I do not want to
loose the contents of the fs)?

Thanks in advance for your attention.

>-- Original Message --
>To: parisc-linux@lists.parisc-linux.org
>From: "Martin K. Petersen" <mkp@mkp.net>
>Subject: [parisc-linux] PA-RISC Linux RAID1 Root HOWTO
>Date: 14 Jan 2003 14:27:11 -0500
>
>
>
>PA-RISC Linux RAID1 Root HOWTO
>

Very clear :)

Thanks,
    Joel



*********************************************
Vous surfez toujours avec une ligne classique ?
Faites des economies avec Tiscali Complete...
Plus d'info sur ... http://complete.tiscali.be

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [parisc-linux] PA-RISC Linux RAID1 Root HOWTO
  2003-01-15  8:36 [parisc-linux] PA-RISC Linux RAID1 Root HOWTO jsoe0708
@ 2003-01-15 16:26 ` Martin K. Petersen
  2003-01-15 16:31   ` Steven Pritchard
  0 siblings, 1 reply; 5+ messages in thread
From: Martin K. Petersen @ 2003-01-15 16:26 UTC (permalink / raw)
  To: jsoe0708; +Cc: parisc-linux

>>>>> "Joel" == jsoe0708  <jsoe0708@tiscali.be> writes:

Joel,

Joel> so, finaly, how to remumber md0 into md1 ...?

Why do you want to renumber it?  It's just an arbitrary name.


Joel> I would also ask you if you could advise me on the resizing of a
Joel> md.  My md7 is a raid1 with the last slices sda11 and sdb11 of
Joel> disks (mounted on /var). As there are still some free space at
Joel> the end of each disk, I would like to increase it. Could you
Joel> advise me howto do (I try to find doc but no success and my test
Joel> was not more succesfull and I do not want to loose the contents
Joel> of the fs)?

        http://unthought.net/raidreconf/index.shtml

Read the disclaimer carefully.

Once you've expanded the md device, you'll have to grow the
filesystem:

        http://ext2resize.sourceforge.net/

If I recall correctly, the ext3fs resizer isn't quite ready yet.  So
you may have to convert your filesystem back to ext2, resize it, and
then turn journalling back on.

-- 
Martin K. Petersen      http://mkp.net/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [parisc-linux] PA-RISC Linux RAID1 Root HOWTO
  2003-01-15 16:26 ` Martin K. Petersen
@ 2003-01-15 16:31   ` Steven Pritchard
  2003-01-15 16:38     ` Martin K. Petersen
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Pritchard @ 2003-01-15 16:31 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: jsoe0708, parisc-linux

On Wed, Jan 15, 2003 at 11:26:24AM -0500, Martin K. Petersen wrote:
> If I recall correctly, the ext3fs resizer isn't quite ready yet.  So
> you may have to convert your filesystem back to ext2, resize it, and
> then turn journalling back on.

resize2fs (included in e2fsprogs) works fine on ext3.

Steve
-- 
steve@silug.org           | Southern Illinois Linux Users Group
(618)398-7360             | See web site for meeting details.
Steven Pritchard          | http://www.silug.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [parisc-linux] PA-RISC Linux RAID1 Root HOWTO
  2003-01-15 16:31   ` Steven Pritchard
@ 2003-01-15 16:38     ` Martin K. Petersen
  0 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2003-01-15 16:38 UTC (permalink / raw)
  To: Steven Pritchard; +Cc: jsoe0708, parisc-linux

>>>>> "Steven" == Steven Pritchard <steve@silug.org> writes:

Steven> resize2fs (included in e2fsprogs) works fine on ext3.

Oh, right.  Forgot about that one.  It's offline only, but that's fine
in this case.

-- 
Martin K. Petersen      http://mkp.net/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-01-15 16:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-15  8:36 [parisc-linux] PA-RISC Linux RAID1 Root HOWTO jsoe0708
2003-01-15 16:26 ` Martin K. Petersen
2003-01-15 16:31   ` Steven Pritchard
2003-01-15 16:38     ` Martin K. Petersen
  -- strict thread matches above, loose matches on Subject: below --
2003-01-14 19:27 Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.