[mythtv-users] How do I backup the database without hanging the system?

Yeechang Lee ylee at pobox.com
Sun Jan 21 20:26:34 UTC 2007


Using a shell script[1] I backup the MythTV database every two hours
to a RAID NAS[2]. When the script runs, the following happens:

1) My frontend seizes up. It won't respond to button presses.
2) The following messages appear in the logs:

       DevRdB(0) Error: Driver buffers overflowed

   then a few seconds' worth of IOBOUNDs, which I've stamped out
   pretty much everywhere else, crops up in the logs. In addition, any
   recordings going on at this time lose a segment (one somewhat
   larger than the few seconds' worth of IOBOUNDS).

1) is annoying but only lasts for less than a minute if I even notice
it by happening to push a button during the backup process. 2) is more
serious, and which I currently avoid by having the crontab job that
calls the backup job only execute it if there aren't any recordings
going on[2].

Any suggestions as to how to backup the database without freezing the
system during the process? I've tried niceing the script, with no luck.

[1] mythdbbackup:

#!/bin/sh
#Dumps the mythconverg database - daily backup
#Keeps the last 7 days
DAY=($(date +%u))
HOUR=($(date +%H))
BACKUPTO=/misc/backups/bijou.ylee.org/mythtv
DUMPFILE="mythbe_"$DAY"_"$HOUR".sql"
LOCKFILE=/tmp/.mythdbbackuplock

if [ -a $LOCKFILE ]; then
    echo -e "ERROR: Lockfile exists. exiting.\n"
    exit 1
fi

touch $LOCKFILE

mysqldump -u mythtv -pmythtv mythconverg -c > $BACKUPTO/$DUMPFILE && \
rm -rf $LOCKFILE

exit 0

[2] Yes, this is the same Infrant ReadyNAS that for a year served as
my only MythTV recording outlet. With much greater and faster storage
now available elsewhere, it has been a) remade into 1.5TB RAID 5, not
2.0TB RAID 1, and b) is now solely used for backups (although I can of
course always reenlist it for MythTV purposes should I need the space
again, something quite possible later this year.) O, how the mighty
have fallen!

[3] Crontab line (all on one line):

07      */2     *       *       *
wget --quiet --output-document=- http://localhost:6544 |
grep -q "and is recording: " || ~/bin/mythdbbackup

-- 
Yeechang Lee <ylee at pobox.com> | +1 650 776 7763 | San Francisco CA US


More information about the mythtv-users mailing list