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

marcus hall marcus at tuells.org
Thu Aug 30 12:25:41 MDT 2007


On Thu, Aug 30, 2007 at 11:45:57AM -0600, Jim Ockers wrote:
> Hi everyone,
> 
> Top-posting since I am answering my own post. :)  I figured it out.  For the
> following partition table (where /dev/hdx is a symlink to /dev/md2):
> 
>    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			
> 
> The following will work:
> 
> #!/bin/bash
> #skip offset based on end block of previous partition
> losetup -o2048 /dev/loop1 /dev/md2			#skip 1st 2048 bytes
> losetup -o109056000 /dev/loop2 /dev/md2			#26625*4096
> losetup -o7622107136 /dev/loop3 /dev/md2		#1860866*4096
> #extended partition adds 2048 bytes for partition table
> losetup -o10843342848 /dev/loop6 /dev/md2		#2647300*4096 + 2048
> losetup -o11917088768 /dev/loop7 /dev/md2		#2909445*4096 + 2048
> losetup -o12990834688 /dev/loop0 /dev/md2		#3171590*4096 + 2048
> 
> mount -t ext3 /dev/loop2 /home/ockers/sandbox
> mount -t ext2 /dev/loop1 /home/ockers/sandbox/boot
> mount -t ext3 /dev/loop3 /home/ockers/sandbox/opt
> mount -t ext3 /dev/loop6 /home/ockers/sandbox/opt/data
> mount -t ext3 /dev/loop7 /home/ockers/sandbox/tmp
> mount -t ext3 /dev/loop0 /home/ockers/sandbox/home

I don't really have experience with setting up a RAID array, but I would
think that each partition would be set up as a RAID set.  This would allow
different RAID levels on different partitions, or some partitions to be
non-RAID if desired (boot, for instance, perhaps).  Then instead of picking
off a piece of a partition to mount, you would just mount each /dev/mdX
device.

Could be wrong, of course, but that's how I would approach it...

marcus hall
marcus at tuells.org



More information about the clue-tech mailing list