[mythtv-users] Network Drive Storage Questions and others.

chris at cpr.homelinux.net chris at cpr.homelinux.net
Wed Sep 20 01:12:15 UTC 2006

On Tue, Sep 19, 2006 at 04:36:54PM -0500, Kevin Kuphal wrote:
> Douglas Wagner wrote:
> > 2) Can you add disks to a Raid 5 without having to move data off the 
> > Raid/Reconfigure the Raid (i.e. can you add the disk in place)
> Yes, in newer versions of the raid tools but all the drives/partitions 
> must be of equal size

Almost correct.  Here's a long-winded version (which applies to 
software RAID only).

With the old RAID drivers you could add another block device to the 
array, but it would be treated as a hot spare and wouldn't be 
available for storage.

With the new RAID drivers you can add another block device to an 
existing RAID array and use it as either a hot spare or as 
additional online storage.  You can only make the online storage 
capacity of the array larger, never smaller.  IOW, you can remove a 
hot-spare and down-size the array device count, but once you 
increase the number of active devices in the array then you're 
committed to keeping them.

The block devices that make up the array do not have to be the same 
size, however the array capacity will be determined by the size of 
the smallest device.  It is possible to enlarge a RAID array 
without changing the number of devices.  If, for example, you had 
three 150Gb drives in a 300Gb RAID-5 array and you wanted to 
replace them with three 400Gb drives, what you would do is fail one 
device and remove it from the machine.  You would then install the 
new drive and add all 400Gb (or whatever) to the array.  The array 
would rebuild using only 150Gb of the 400Gb drive.  You would 
repeat the process twice more.  Once all of the 400Gb drives were 
installed you would then "grow" the RAID-5 array and the RAID 
driver would add the new available space to make 800Gb available on 
the array.  You would then have to resize the filesystem(s) hosted 
by the array.

The reason I use "block device" instead of disk or partition is 
because the software RAID driver is a block-to-block abstraction.  
It can use disks, partitions or any other block device (even 
another RAID array) as the low-level device and then represent 
itself as either a partitioned or non-partitioned block device (ie: 
either as a mountable device or as a virtual physical disk suitable 
for dividing).

This means you can create an array using the raw disks and 
partition the array or you could partition the individual drives 
and then make multiple arrays where each array uses one partition 
from each drive.  If you have some odd-size disks lying around you 
could even merge a few small drives into a single linear volume and 
then use it as one of the block devices that make up the RAID 
array.  Of course doing that would increase the probability of 
failure and would aggravate noise/heat/electricity concerns.

> > Here's the thing, at this point i'm looking at one or two drives but 
> > being expandable in the future.  I'd like to go with a pair of 250g 
> > now (potentially Mirrored) and add to that in the future to build up a 
> > raid 5...depending whether the wife feels like the data on the PVR is 
> > too good to replace or not. 
> I've gone back and forth on that myself and I've settled with no RAID 
> and simply use LVM to expand the disk storage as I add newer differing 
> sized drives.

This isn't a bad idea for discardable content, but I wouldn't put 
the root and boot filesystems on a linear volume as the MTBF of the 
volume drops significantly with each added device and with LVM the 
chances of recovering from a single disk failure can be pretty low 
depending on which drive took the fall.  With RAID-5 your biggest 
worry is that you'll lose a second drive while rebuilding the array 
after the first failure (which RAID-6 addresses).

When I was running with only two drives I partitioned them so that 
root and boot were both running on separate RAID-1 (mirror) block 
devices composed of hda1=hdc1 and hda2=hdc2.  The rest of the space 
(for Myth) was a RAID-0 (stripe) device composed of hda3+hdc3.  
This was a compromise that would allow my system to survive any 
disk failure but at the cost of losing my recordings.

When I upgraded to three large disks I kept the boot partition at 
RAID-1 (Linux can boot from a mirror but not from RAID-5) and 
converted the root and MythTV storage areas to RAID-5.  Since LILO 
will only update a two-disk mirror, I added hde1 as a hot spare to 
the hda1=hdc1 mirror and did some drive-swapping and rebuilding to 
make sure that all three drives are bootable.

In tabular form, I now have:

   Device Boot Start    End     Blocks   Id  System
/dev/hda1   *      1      8      64228+  fd  Linux raid autodetect
/dev/hda2          9   7976   64002960   fd  Linux raid autodetect
/dev/hda3       7977  38913  248501452+  fd  Linux raid autodetect
/dev/hdc1   *      1      8      64228+  fd  Linux raid autodetect
/dev/hdc2          9   7976   64002960   fd  Linux raid autodetect
/dev/hdc3       7977  38913  248501452+  fd  Linux raid autodetect
/dev/hde1   *      1      8      64228+  fd  Linux raid autodetect
/dev/hde2          9   7976   64002960   fd  Linux raid autodetect
/dev/hde3       7977  38913  248501452+  fd  Linux raid autodetect

md1 : active raid1 hde1[2](S) hdc1[1] hda1[0]
      64128 blocks [2/2] [UU]

md2 : active raid5 hde2[2] hdc2[1] hda2[0]
      128005760 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

md3 : active raid5 hde3[2] hdc3[1] hda3[0]
      497002752 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

More information about the mythtv-users mailing list