[mythtv-users] "background" balancing disks in a storage group

Don Lewis dl-mythtv at catspoiler.org
Thu Apr 22 05:03:13 UTC 2010


On 21 Apr, Brian J. Murrell wrote:
> Given that one of the nice features of storage groups is to spread disk
> i/o load among spindles, I wonder if there is anything (i.e.
> transparently) balancing space amongst disks in a storage group to keep
> the disks evenly available in space.
> 
> Imagine I have two disks where one was twice (or 3 or 4 times) as big as
> the other.  Further assume, for simplicity's sake that whenever I am
> recording, it's typically on two or more tuners at a time (in fact, this
> is not so outlandish an assumption: prime time television is just like
> that -- all the good shows are on at the same time, competing with each
> other).
> 
> So, if we follow the assumption that you have two disks both starting
> out empty with one twice as big as the other and two things recording
> whenever there is any recording happening, pretty soon, the one disk
> will get full and the other will only get half (or 1/3 or 1/4) full.
> 
> Ideally, while there is no recording going on (which is most of the
> time), mythtv should be re-balancing the disks so that their absolute
> (not percentage) free space is as close to equal as possible.

This would be a useful feature, though it might be a good idea to add
some hysteresis to avoid excessive copying of files back and forth.

My mythtv box is generally pretty busy, but I've got quite a lot of I/O
bandwidth, so background migration would be still be ok while recording,
as long as the copying is done at a reasonable rate.

> This would even make extreme cases such as having a single large disk
> (i.e. to be the main recordings store) in a system and then adding
> several much smaller disks just to act as temporary storage, solely to
> increase i/o bandwidth.  When bandwidth demands are low, the smaller
> disks are emptied out into the large disk.

A related use would be useful for disk upgrades.  Add a new disk to the
box, tell mythtv not to record anything new to the old disk (but still
allow recordings to be played from it), and tell mythtv to migrate the
files to the new disk.  When the old disk is empty, it can be removed.

I'm currently doing something like this by using rsync with its
bandwidth limiting option to copy files from the old disk to a
subdirectory on the new disk that mythbackend doesn't know about.  I may
have to run rsync multiple times to handle changes on the source disk
that happen while the copy is in progress.  Then when the machine is
idle, I run rsync one final time, then use mv to relocate the copied
files to the storage directory that is configured for that disk, and
finally delete the old drive from the mythtv configuration and remove
the drive.



More information about the mythtv-users mailing list