[clue-tech] How do I mount a partition on a RAID array?

Jim Ockers ockers at ockers.net
Thu Aug 30 09:33:58 MDT 2007


Hi everyone,

I'm trying to save myself several hours of waiting and I thought I'd
ask the audience for some ideas.  How can I mount a RAID partition?
What I want to do is something like this:

mount -t ext2 /dev/md0p1 /mnt/whatever

There are no major and minor numbers for partitions on RAID arrays,
because the numbering for md devices is as follows:

[root at dmurray-lnx1 sandbox]# ls -al /dev/md[0123]
brw-r----- 1 root disk 9, 0 Aug 28 11:39 /dev/md0
brw-r----- 1 root disk 9, 1 Aug 28 11:39 /dev/md1
brwxrwxrwx 1 root disk 9, 2 Aug 29 13:14 /dev/md2
brw-r----- 1 root disk 9, 3 Aug 28 11:51 /dev/md3

So I can't make a block device 9,1 for the first partition on /dev/md0
because that points to the /dev/md1 RAID array.

How did I get a RAID array with partitions on it, you ask?

I used vmware (patched) to access the Linux RAID array.  CentOS5 is 
the VMware host OS, and Red Hat 7.2 is the guest OS.  The vmware 
patches in vmgpd (http://mahadri.drigon.com/vmgbd/vmgbd-0.01.tar.bz2) 
let you pretend a RAID array is an IDE disk, so I called /dev/md0 
/dev/hdx for vmware's purposes.

Vmware let the guest OS create 'partitions' on the RAID array just 
as if it was an IDE disk.  I.e. /dev/hdx1, /dev/hdx2, and so forth.

[root at dmurray-lnx1 sandbox]# fdisk -l /dev/hdx

Disk /dev/hdx: 177.6 GB, 177682251776 bytes
2 heads, 4 sectors/track, 43379456 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdx1   *           1       26625      106498   83  Linux
/dev/hdx2           26626     1860866     7336964   83  Linux
/dev/hdx3         1860867     2385155     2097156   83  Linux
/dev/hdx4         2385156    33554431   124677104    f  W95 Ext'd (LBA)
/dev/hdx5         2385156     2647300     1048578   82  Linux swap / Solaris
/dev/hdx6         2647301     2909445     1048578   83  Linux
/dev/hdx7         2909446     3171590     1048578   83  Linux
/dev/hdx8         3171591    33554431   121531362   83  Linux

Of course the /dev/hdx does not exist because the IDE driver does not
support the RAID array, so I can't use IDE ioctls to mount the partitions.
That is, the IDE major & minor numbers won't work, because it's actually
a RAID array.

Disk /dev/md0: 177.6 GB, 177682251776 bytes
2 heads, 4 sectors/track, 43379456 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/md0p1   *           1       26625      106498   83  Linux
/dev/md0p2           26626     1860866     7336964   83  Linux
/dev/md0p3         1860867     2385155     2097156   83  Linux
/dev/md0p4         2385156    33554431   124677104    f  W95 Ext'd (LBA)
/dev/md0p5         2385156     2647300     1048578   82  Linux swap / Solaris
/dev/md0p6         2647301     2909445     1048578   83  Linux
/dev/md0p7         2909446     3171590     1048578   83  Linux
/dev/md0p8         3171591    33554431   121531362   83  Linux

It seems mount() wants a major & minor number for the filesystem.  How
can I do this, any ideas anyone?  Can I use losetup or something like that
to make a fictitious "device" with legitimate major & minor numbers so
I can mount() it?

Yes I do need to mount the partitions on the host OS when vmware and the
guest OS is not running.  This will save me hours of copying stuff around.

Thanks for any ideas,
Jim

-- 
Jim Ockers, P.Eng. (ockers at ockers.net)
Contact info: please see http://www.ockers.net/



More information about the clue-tech mailing list