[CentOS] Re: raid1 disk format?

Ross S. W. Walker rwalker at medallion.com
Wed Jun 11 18:45:35 UTC 2008


Les Mikesell wrote:

<snip>

> > 'mdadm' writes a listing of the devices in the array to the md
> > superblock and orders them by number,major,minor. You cannot add
> > another device to the array with the same tuple.
> 
> Isn't this updated at detect time so the device minor's 
> should always be 
> different?
> 
> > If you dd the first sector of the drive though you will duplicate
> > the partition table and grub boot loader to the other drive. Then
> > md-device-mapper will take care of copying the data over.
> 
> I'm curious as to why 2 complete dd'd copies don't pair at boot.  One 
> comes up running and it does work to mdadm --add the partner partitions 
> and after the resync they do automatically pair at boot.

Gosh darn it Les your just too damn inquisitive!

Well for the sake of the truth, the whole truth, and you know the rest.

Let me dig around here, hmmm, ok, not here, ok here we go:

/usr/src/kernels/2.6.18-53.1.21.el5-x86_64/include/linux/raid/md_p.h

Ok, looking at the comments, it seems...

/*
 * RAID superblock.
 *
 * The RAID superblock maintains some statistics on each RAID configuration.
 * Each real device in the RAID set contains it near the end of the device.
 * Some of the ideas are copied from the ext2fs implementation.
 *
 * We currently use 4096 bytes as follows:
 *
 *      word offset     function
 *
 *         0  -    31   Constant generic RAID device information.
 *        32  -    63   Generic state information.
 *        64  -   127   Personality specific information.
 *       128  -   511   12 32-words descriptors of the disks in the raid set.
 *       512  -   911   Reserved.
 *       912  -  1023   Disk specific descriptor.
 */

The last part of the superblock contains a disk specific descriptor,
identifier (whatever), and the middle contains a list of all the
disk descriptors participating in the RAID set. (there can only be
12 disks max in a raid set? that's news to me, maybe the comment
is old, if you combine the reserved area you can get 24 disks).

>From this we can observe that when the disks are identified as
auto-raid and their superblocks are read it tells them what RAID
they belong to and their order in the array.

What happens if a duplicate descriptor is encountered? And how
does it determine which disk is the "official" disk?

I have yet to find those answers, but let me hypothesis that it
ejects either a) the disk with the oldest timestamp, or b) the
disk with the odd checksum out of the array.

To find out the real truth will need some detailed MD RAID docs
which I am having trouble finding or the sources which I cannot
be bothered/don't have time to download and audit right now.

-Ross

______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.




More information about the CentOS mailing list