[mythtv-users] wanted: script to balance autoexpire recordings in storage dirs to avoid premature deletion

Peter Watkins peterw at tux.org
Fri Jan 14 06:08:14 UTC 2011


Please accept my apologies if my searching missed a solution...

I'm running MythTV on a backend with one storage group comprised of
two storage directories. Each storage directory is a subdirectory of a
different software RAID 1 array formatted as XFS. Both arrays are
local, fast, and large (>1 TB).

My problem is that the recordings that allow autoexpire are not
balanced on the storage directories, so MythTV has on a number of
occasions deleted new content. The backend will decide it wants to use
a specific storage directory and will pick an autoexpire-enabled
recording in that directory, even if it's very new (e.g., new episode
of a favorite TV show) and there are a bunch of lower priority
recordings in the other storage directory.

My recording schedules include a power search (record all movies on a
specific channel rated at least N stars) that pretty much guarantees
I'll have no free space, so I can't simply switch to the Balanced Free
Space algorithm. Also I'd prefer not to move back to the old
LVM-atop-RAID1 model that I used in the past. I'm also reluctant to
introduce the complexity of UnionFS, especially since my RAID1 arrays
hold data other than MythTV recordings.

I've read a bit from Michael Dean and others about the rationale for
the behavior (in threads like the Aug 2008 classic "Myth autoexpiring
brand new shows"), and think I understand it.

Here's what I'd like: a script I could run periodically (via cron,
probably at least daily) that would examine the Autoexpire list for
the entire storage group and ensure that the recordings that would
"naturally" be chosen to autoexpire soonest are well balanced on the
storage directories (at least the top 10 or so). For instance, if the
natural first choice for autoexpire is in directory A, then make sure
the second choice is in directory B. (Yes, I understand that this
would require a third partition for moving recordings.) With such a
script, the worst that would happen is the 2nd choice recording would
be deleted rather than the 1st. No longer would I need to worry that
an old priority -20 power search movie would remain while a priority 0
TV show gets the axe (unless my disks are *really* full of priority 0
shows, a scenario that I don't think is worth the trouble of trying to
fix**).

Before I commit time learning the Perl API and cobbling my own script,
does anyone have anything like this already built?

Thanks,

Peter

** I have no problem with the idea that I might lose new TV shows if
my disks are full of no-expire shows and shows at similar priority
levels. Nor am I terribly worried about the notion that I might lose a
new show to fit a -20 movie if the disks are full of priority 0 shows
(although that would be a nice feature). It's the occasional loss of
priority 0 recordings when the other storage directory has a *bunch*
of -20 recordings that bugs me.



More information about the mythtv-users mailing list