[mythtv-users] Database Backup (Was: How big is your database?)

Brian Bosch bdbosch at gmail.com
Sat Dec 3 21:38:12 EST 2005


On 12/3/05, Wade Maxfield <mythtv at hotblack.co.nz> wrote:
> >Anyone care to post their scipt to back up/compress their database?
> >I suppose I could write my own, but why reinvent the wheel? :)
> >
> >
> >
>
> This is what I use for all my automatic mysql backups (webservers as well)
>
> MySQL Backup Script
> http://sourceforge.net/projects/automysqlbackup/
>
> You'll just need to set a couple of preferences in the start of the
> script, and setup a mysql user with the right permissions...
>
>   - Wade

There is information on this here:
http://mythtv.org/docs/mythtv-HOWTO-23.html#ss23.5 as well as in the
archives: http://www.gossamer-threads.com/lists/engine?list=mythtv&do=search_results&search_forum=forum_1&search_string=database+backup&search_type=AND

Based on info found in the above I have this in my backup script:
#!/bin/sh
/usr/bin/mysqldump -u mythtv -pmythtv mythconverg -c | gzip -c >
"/home/mythtv/backup/mythconverg_backup.`date +%w`.sql.gz"
cp /home/mythtv/backup/* /home/mythtv/nas/mythbackup/

This script will create a backup every day that is numbered for the
day of the week.  E.g. mythconverg_backup.0.sql.gz is created on
Sunday, mythconverg_backup.1.sql.gz is created on Monday, and etc. 
This way I have a weeks worth of backups at any one time.  I usually
watch TV at least once a week; should I ever find that I have a
corrupted database I will likely be able to go back and find a good
backup copy.

/home/mythtv/nas is mapped to a Linksys NSLU2 NAS device that I share
on my home network; and so I have this in rc.local to map the drive:
smbmount '//192.168.1.20/disk 1' /home/mythtv/nas -o guest

This way I have an available backup in case I lose the hard drive.  I
don't backup the recorded programs themselves, it's not worth it to me
to do this.  I also don't have any ripped dvds or other video to worry
about, and all of my mp3s have been backed up on other machines.

Finally, evey file I touched during the setup of this combined FE/BE
machine was copied to the nas; xorg.conf, modprobe.conf, and etc.

HTH

-- Brian.


More information about the mythtv-users mailing list