[CLUE-Tech] RAID 1 on Linux

Carl Schelin co_bofh at yahoo.com
Tue Oct 19 22:46:34 MDT 2004


--- Jim Ockers <ockers at ockers.net> wrote:

> Hi Carl,
> 
> > All of the documentation I've seen appear to show
> > that the only way to make an existing system in to
> > RAID 1, is to back it off, install to RAID and
> > restore the data.
> 
> Unfortunately this is the best way to do it.

I agree it seems to be the best. But is it the only
way? Even difficult==possible.

>  The md
> driver needs to be able to write its stripes (or
> whatever the right word is) for the RAID array
> across the disks.

Well, in a RAID 1 (mirror) setup, I don't believe
there's any striping. It's simply duplicating the data
on both disks. Faster reads, slower writes.

> The existing filesystem on the
> disk is not usable by the md block device driver.

That's the part I'm having a problem with. Unless
there's some change to the geometry, it should be able
to use the existing file system as a base for the
mirror. Then you can hotadd a new disk as if it was a
recovery of a failed disk. Of course that's just my
opinion based on being able to do that in
Solaris/DiskSuite.

> 
> Since it has to blow away the filesystem on the disk
> to write the RAID array stripes, you would also lose
> your data that was contained in that filesystem.
> 
> > Does anyone have a pointer to a document that
> > debunks this? Can I in fact, add a second disk and
> > make the system RAID 1 or do I have to back it off
> > and reinstall?
> 
> OK, you could try to make a bogus RAID1 array using
> only the second disk.  I'm not sure if the md driver
> will let you make an array that starts out with a
> missing member or not.
> 
> Then make a filesystem on the new "RAID1" array. 
> Once you get the files copied over to the new RAID1
> filesystem, you could hot-add the first disk to the
> array and then the md driver will automatically
write
> the stripes over the first disk.
> 

I tried that. mdadm will let you create half of a
mirror using the empty disk but you have to copy the
data from the non-RAID disk to the mirror and install
a MBR on that disk so it'll boot. Unfortunately, while
I was able to create the half mirror, and I seemed to
get the data moved over, I apparently missed something
or mucked something up because it failed to
successfully read the raid volumes. This attempt might
have been what mucked up hdc so badly I had to dd it
to recover it enough to do a fresh install.

> If the automatic tools won't let you create a RAID1
> array with only one member, you can try to make the
> kernel manage the array using kernel command lines 
> like md=0,/dev/hdb,/dev/hdc or something like that.
> Read the linux/Documentation/md.txt for more
> information. 

I'll check that and see if there's any enlightenment.
Thanks.

> For RAID1 it appears you'll have
> to figure out how to make a persistent superblock to
> use the kernel command line.

In order to use persistent superblocks, you have to
recompile the kernel. I got that done with no problem
and it even booted hda with no problem, however when I
tried to boot to hdc/m0, it failed.

The new installation required that /boot be a regular
slice rather than a raid partition. I believe that's
because it's not compiled in to the kernel but a
module. A regular partition will let it boot and load
the module which then lets it read and mount the
/dev/md partitions.

> 
> Hope this helps,
> Jim

Let me see what md.txt tells me. Thanks again for the
pointer.

Carl


		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com



More information about the clue-tech mailing list