From: Douglas Mayne on
I am trying to fill in some of the gaps in my knowledge. I want to learn
the ins and outs of RAID setup with mdadm. I started with a simple test:
a 20G raid 1 (mirror) on separate sata disks and
partitions. I partitioned the physical devices in advance with fdisk:

root(a)atom-330:~# fdisk /dev/sda -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x57c89da2

Device Boot Start End Blocks Id System
/dev/sda1 1 262 2104483+ 83 Linux
/dev/sda2 263 2874 20980890 fd Linux raid autodetect

root(a)atom-330:~# fdisk /dev/sdb -l

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x66709e1c

Device Boot Start End Blocks Id System
/dev/sdb1 1 262 2104483+ 83 Linux
/dev/sdb2 263 2874 20980890 fd Linux raid autodetect

Then I created the array:

# mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/sda2 /dev/sdb2

root(a)atom-330:~# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Wed Nov 4 07:56:25 2009
Raid Level : raid1
Array Size : 20980800 (20.01 GiB 21.48 GB)
Used Dev Size : 20980800 (20.01 GiB 21.48 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Wed Nov 4 09:47:33 2009
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

UUID : 2bbba569:5e093638:8e7a9340:a94dfb09
Events : 0.1698

Number Major Minor RaidDevice State
0 8 2 0 active sync /dev/sda2
1 8 18 1 active sync /dev/sdb2

The array is used as the root filesystem, and is initialized with the
sequence in the initial ramdisk.

# mdadm -E -s >/etc/mdadm.conf
# mdadm -A -s

When the device /dev/md0 is started and mounted it generates these
messages to the ring buffer, dmesg:
<snippet of dmesg output>
md: md0 stopped.
md: bind<sdb2>
md: bind<sda2>
raid1: raid set md0 active with 2 out of 2 mirrors
md0: unknown partition table
XFS mounting filesystem md0
Ending clean XFS mount for filesystem: md0
<end dmesg output>

Has anyone seen this error/warning: "md0: unknown partition table." I
googled a bit for it, and I see it comes up quite often, but I can't
tell for sure if it is something that I should be worried about, or
not.

TIA

p.s. I am running a self compiled 2.6.30.9 kernel.
From: Grant Taylor on
On 11/3/2009 8:20 PM, Douglas Mayne wrote:
> I am trying to fill in some of the gaps in my knowledge. I want to
> learn the ins and outs of RAID setup with mdadm.

:)

> The array is used as the root filesystem, and is initialized with the
> sequence in the initial ramdisk.

Can I ask why you are using an initial RAM disk?

If you are using the RAID Auto Detect partition type, the kernel should
see and activate the RAID (if it can) auto-magically on boot. With the
RAID activated, you can simply mount your root directly off of it.

> Has anyone seen this error/warning: "md0: unknown partition table." I
> googled a bit for it, and I see it comes up quite often, but I can't
> tell for sure if it is something that I should be worried about, or
> not.

I believe that is simply the kernel examining partition structures on
block devices that it sees. Seeing as how you are likely putting a file
system directly on to the md device, there is no partition structure
there to be found. I do not think this is any thing that you need to be
worried about.

I have heard that it is possible to get partition support on md devices
(kernel option?) but I have never done it.



Grant. . . .
From: Douglas Mayne on
On Tue, 03 Nov 2009 23:11:40 -0600, Grant Taylor wrote:

> On 11/3/2009 8:20 PM, Douglas Mayne wrote:
>> I am trying to fill in some of the gaps in my knowledge. I want to
>> learn the ins and outs of RAID setup with mdadm.
>
> :)
>
>> The array is used as the root filesystem, and is initialized with the
>> sequence in the initial ramdisk.
>
> Can I ask why you are using an initial RAM disk?
>
I am using a modular kernel, similar to the standard
Slackware modular kernel. I need the initial ramdisk
to load the XFS module. I think it will come in handy
for my next exercise: root filesystem on iSCSI.
>
> If you are using the RAID Auto Detect partition type, the kernel should
> see and activate the RAID (if it can) auto-magically on boot. With the
> RAID activated, you can simply mount your root directly off of it.
>
>> Has anyone seen this error/warning: "md0: unknown partition table." I
>> googled a bit for it, and I see it comes up quite often, but I can't
>> tell for sure if it is something that I should be worried about, or
>> not.
>
> I believe that is simply the kernel examining partition structures on
> block devices that it sees. Seeing as how you are likely putting a file
> system directly on to the md device, there is no partition structure
> there to be found. I do not think this is any thing that you need to be
> worried about.
>
ok.
>
> I have heard that it is possible to get partition support on md devices
> (kernel option?) but I have never done it.
>
I looked at the man page a little closer. It includes this info:

--auto{=no,yes,md,mdp,part,p}{NN}
Instruct mdadm to create the device file if needed, possibly
allocating an unused minor number. "md" causes a non-partition-
able array to be used. "mdp", "part" or "p" causes a partition-
able array (2.6 and later) to be used.

I am guessing that partition support would allow mirroring of entire disks
(i.e. /dev/sda and /dev/sdb in my case). This could be useful, and more
like hardware raid.
>
>
> Grant. . . .
>
So far, I am impressed with the features of mdadm. I also tested building
with one device "missing," and then adding the second device. I tracked
the status as obtained from /proc/mdstat. That was quick- under 10min
for a 20G partition.

--
Douglas Mayne
From: Grant Taylor on
On 11/4/2009 5:58 AM, Douglas Mayne wrote:
> --auto{=no,yes,md,mdp,part,p}{NN} Instruct mdadm to create the device
> file if needed, possibly allocating an unused minor number. "md"
> causes a non-partition-able array to be used. "mdp", "part" or "p"
> causes a partition-able array (2.6 and later) to be used.

Good to know.

I'll have to give the partitioning support a try some time.

> I am guessing that partition support would allow mirroring of entire
> disks (i.e. /dev/sda and /dev/sdb in my case). This could be useful,
> and more like hardware raid.

You can mirror an entire block device with out the partitioning support.
Though I'd advise against it because the partitions aid when having to
do data recovery on the drive (most utilities only know how to work with
in a partition like structure).

You would also see a similar error for the lack of partitions on your
raw /dev/sda & /dev/sdb devices like you are seeing on /dev/md0 device.

> So far, I am impressed with the features of mdadm. I also tested
> building with one device "missing," and then adding the second
> device. I tracked the status as obtained from /proc/mdstat. That was
> quick- under 10min for a 20G partition.

mdadm is *VERY* capable. There are a number of inexpensive raid card
out there that run (an older?) Linux kernel and mdadm to do the RAID.

You can also do some very interesting things. Create a RAID 1 with a
missing disk, add the spare disk some day, and later convert the RAID 1
to a 3 disk RAID 5. You can even grow the RAID 5 down the road.
(Converting from a non-RAID to a RAID 1 is not nice though.)



Grant. . . .