[ale] Questions on Linux software RAID

Danny Cox danscox at mindspring.com
Tue Feb 3 18:30:30 EST 2004


On Mon, 2004-02-02 at 18:50, Greg wrote:
> I am somewhat confused about Linux software RAID.  Suppose I have 2 disks in
> a RAID 1 (mirrored) setup.  hda and hdb are the disks.  hda dies and I need
> to get to the data on disk hdb.  Is the following true ?
> 1. I can still get to the data on hdb, even though the raid array is broken
> (a status of _ for hda and U for hdb in /proc/mdstat).  My research leads me
> to believe this is true.

	Yes, it's true.

> 2. If I break the array, I cannot get to the data on hdb, since the
> partition table is written to show hdb as part of an array.

	Sure you can!  The 'partition table' for software raid is actually
named the 'raid superblock' and is at the end of each member.  Most
filesystems record the size of the partition at mkfs time, and so won't
overwrite the raid superblock even if mounted 'outside the array'.

> 3. Can I re-do the partition table of hdb to make it a single disk (no RAID)
> that has the data on it still?

	Yes, but why would you want to?  You can just kill the entry in
/etc/raidtab, and mount hdb1 with whatever FS was there before.  It
should work just fine.  What I wouldn't advise doing is mounting up the
two members in this way, and then attempting to restart the array.  It
may think all is well, but in fact many blocks are out of date.

> Now for 3 questions:
> 1. Is there anything besides constant checking /proc/mdstat that would tell
> someone that the array is broken ???

	Uh, use one of the log monitoring packages that'll look for patterns
involving RAID and whatever else you'd like to see, and email it (or
raise the alarm, or ....) in /var/log/messages (or whereever the kernel
logs go).

> 2. Would rsync on an hourly basis be better ?

	It depends on YOUR definition of 'better'.

> I am trying to use Linux software raid for a friends pc.  They want to be
> able to take one of the disks away when they leave so if the house burns
> down, they won't lose all of their data.

	Oh, you want a HOT swap capability.  We're not quite there yet. 
Certainly not IDE, and perhaps not even SCSI.  You could do it with USB
storage, though.  Assuming your USB drive is /dev/sda, the steps would
look like:

	raidhotremove /dev/md0 /dev/sda1
	wait a second or two
	pull the plug

	...time passes...

	plug 'er in
	wait for it to spin up
	raidhotadd /dev/md0 /dev/sda1
	if you wish, monitor /proc/mdstat to see how long it'll take to

	Now, 'raidhotadd' and 'raidhotremove' are the old tools.  'mdadm' will
do those jobs and more.  See the man page.  The old tools are on the way
out, I think.

	Hope this helps!

kernel, n.: A part of an operating system that preserves the
medieval traditions of sorcery and black art.


More information about the Ale mailing list