> Can I assume you have data on sda1 and you want sdb1 to become a mirror?  If
> so then here's the problem.  Creating a raid mirror destroys any existing
> filesystem on the partitions involved.  Further, mkraid can not make a raid
> mirror out of any mounted partition.  The correct strategy in your case
> would be to copy your data off of sda1 to a safe place.  Issue umount
> /dev/sda1 (umount /dev/sdb1 if necessary.)  And then do your mkraid
> /dev/md0.  Once the md0 mirror is made, run mkfs -t ext2 /dev/md0 (assuming
> you want ext2), fsck -y -f /dev/md0 to make sure it's a healthy filesystem,
> and then you can copy your data back onto it.

This is certainly a safe way of going about it, but it's not the only way. The
smart way is to use the "failed-disk" option. This allows you to specify when
the raid is created that one of the disks is already failed, so it isn't
included in the array. In other words, it starts the array in degraded mode,
without the (allegedly) failed disk.

Taking arijit's example, change the raidtab to:

raiddev /dev/md0
         raid-level 1
         nr-raid-disks 2
         nr-spare-disks 0
         chunk-size     4
         persistent-superblock 1
         device /dev/sdb1
         raid-disk 0
         device /dev/sda1
         failed-disk 1

The failed-disk should not be the first partition in the array, and if the
partitions are of uneven size, it should not be the smallest partition. Running
mkraid on this raidtab will setup the array in degraded mode running purely on
/dev/sdb1 (/dev/sdb1 should not be mounted, and if it has already had a
filesystem on it, mkraid will complain, in which case you will have to use the
"--really-force" option). The data on /dev/sda1 will be preserved, but you will
lose anything on /dev/sdb1. If you now mke2fs the array and mount it to a
temporary mountpoint, you can copy the contents of /dev/sda1 to /dev/md0 (using
cp, tar, cpio or whatever takes your fancy). You can then unmount /dev/sda1 and
/dev/md0 and mount /dev/md0 wherever you want it (changing /etc/fstab to make
this change permanent). To add /dev/sda1 to the array, do "raidhotadd /dev/md0
/dev/sda1". This will add /dev/sda1 as a spare, which will be used to
reconstruct the array and return it to non-degraded mode.

Cheers,


Bruno Prior         [EMAIL PROTECTED]

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of David Cunningham
> Sent: 01 December 1999 03:18
> To: os390 ibmos; [EMAIL PROTECTED]
> Subject: Re: Mirroring RAID 1 in REDHAT 6.0
>
>
> Can I assume you have data on sda1 and you want sdb1 to become a mirror?  If
> so then here's the problem.  Creating a raid mirror destroys any existing
> filesystem on the partitions involved.  Further, mkraid can not make a raid
> mirror out of any mounted partition.  The correct strategy in your case
> would be to copy your data off of sda1 to a safe place.  Issue umount
> /dev/sda1 (umount /dev/sdb1 if necessary.)  And then do your mkraid
> /dev/md0.  Once the md0 mirror is made, run mkfs -t ext2 /dev/md0 (assuming
> you want ext2), fsck -y -f /dev/md0 to make sure it's a healthy filesystem,
> and then you can copy your data back onto it.  By the way, once /dev/md0 is
> made, don't fsck or mount the sda1 or sdb1 partitions unless you don't mind
> losing data.
>
> Good luck!
> David Cunningham
>
> ----- Original Message -----
> From: os390 ibmos <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 30, 1999 6:52 PM
> Subject: Mirroring RAID 1 in REDHAT 6.0
>
>
> > I am trying to implement mirroring RAID-2 for Redhat 6.0 ecommerce
> > version. Kernel version is 2.2.5-15Smp (I have a dual celeron 366
> > ABIT Motherboard).
> >
> > I have connected the two SCSI HDs 4.4G (IBM DDRS)on a Adaptec
> > 2940 UW controller card (SCSI ID 6 & 10).
> >
> >
> > I partitioned the HDs as sda1 => /home1 , sdb1 => /home2 .
> >
> > I want to mirror /home1 and /home2 .
> >
> >
> > I added the following lines in /etc/conf.modules
> >
> > alias md-personality-3 raid1
> > alias md-personality-4 raid5
> >
> > I have looked through the HOW-TOs
> >
> > http://www.linuxgazette.com/issue45/nielsen.html
> >
> > and created /etc/raidtab
> >
> > as follows
> >
> > raiddev /dev/md0
> >         raid-level 1
> >         nr-raid-disks 2
> >         nr-spare-disks 0
> >         chunk-size     4
> >         persistent-superblock 1
> >         device /dev/sda1
> >         raid-disk 0
> >         device /dev/sdb1
> >         raid-disk 1
> >
> > I then typed mkraid /dev/md0 it came up with the following
> >
> > handling MD device /dev/md0
> >   analyzing super-block
> >   disk 0: /dev/sda1, 4458006kB, raid superblock at 4457920kB
> >   /dev/sda1 is mounted
> >   mkraid: aborted
> >
> > Can somebody point me further from here ?? I am looking at the
> > HOW-TOs and other web based doc.
> >
> > Thanks,
> > ===
> > arijit
> >
> >
> > ______________________________________________________
> > Get Your Private, Free Email at http://www.hotmail.com
> >
>
>
>

Reply via email to