[mythtv-users] Help recovering my myth database
Mache Creeger
mache at creeger.com
Sun Jul 20 15:20:05 UTC 2008
At 03:58 AM 7/20/2008, Nick F wrote:
>Help!
>
>Something hosed my backend (I've got builders in and I think they
>were cycling the power in the house on and off when installing
>something - I unfortunately wasn't home - and I think it's messed
>with my system drive). The computer wouldn't boot (got stuck at the
>grub menu) and the 'recovery installation' option in the Fedora DVD
>couldn't fix it.
>
>My data is all fine (on a separate 5-disk RAID-5 array on the machine).
>
>I have installed a fresh instance of Fedora 9 on a new partition on
>free space on the system drive. I can mount my old partitions to
>get to my old /etc files, etc. Using my old mdadm.conf I can get my
>RAID back just fine.
>
>Unfortunately my last backup of my myth database is dated the 4th of
>July - so I'm at least 2 weeks behind (which is better than 2 1/2 years).
>
>What's the best way to recover? Can I use the old mythconverg
>database and just copy it over - how do I do that? How do I
>preserve my mysql settings? (is there a config file I should copy
>over?) Any easy way to get my apache config files for mythweb copied over?
>
>Any advise on getting smoothly back online? I've been using Myth
>for a few years now - but never had to recover from anything like
>this and in that respects still a bit of a noob, Myth has become
>the only way to watch any TV or listen to music in the house and my
>wife is getting annoyed!
>
>Thanks
>Nick
>_______________________________________________
>mythtv-users mailing list
>mythtv-users at mythtv.org
>http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
If it were me and I were sure that the media was OK, I would just
upgrade the entire old partition to Fedora 9 making sure to preserve
all the earlier data. That would be the cleanest approach. Then
backup the database via cron job religiously. I use this script in my
/etc/logrotate.conf
/opt/mythdb/mythdb_backup.bz2 {
daily
rotate 28
extension .bz2
ifempty
missingok
firstaction
/home/mythtv/myth-optimize
/home/mythtv/myth-backup
endscript
lastaction
touch /opt/mythdb/mythdb_backup.bz2
endscript
}
# more ~mythtv/myth-optimize
#!/bin/sh
# Optimize the database
OPT_MYTHDB='/usr/share/doc/mythtv-docs-0.21/contrib/optimize_mythdb.pl'
LOG='/var/log/mythtv/optimize_mythdb.log'
echo "Started ${OPT_MYTHDB} on `date`" >> ${LOG}
${OPT_MYTHDB} >> ${LOG}
echo "Finished ${OPT_MYTHDB} on `date`" >> ${LOG}
# more ~mythtv/myth-backup
#!/bin/sh
#Dumps the mythconverg database - daily backup
DUMPFILE="mythdb_backup.bz2"
/usr/bin/mysqldump -u mythtv -pmythtv mythconverg -c | /usr/bin/bzip2
-cq9 > /opt/mythdb/$DUMPFILE
exit 0
Restoring from the backup is the best way to maintain your
mythconverg database.
Alternatively you can generate a backup copy from your old partition
and then install that backup into a new partition.
You cannot just copy it over. To reinstall mythconverg in a new myth
installation,
1. Get mysql working and make it think it is working with your old
/var/lib/mysql that has your old data in it.
2. Get a dump of the old database.
$ /usr/bin/mysqldump -u mythtv -pmythtv mythconverg -c > mythtv_backup.sql
3. Once you have the dump of mythconverg in mythtv_backup.sql, do a
full reinstall of mythtv in accordance with
http://www.wilsonet.com/mythtv/fcmyth.php. Make sure you install the
empty database that is part of the clean install.
4. Then with an empty new mythconverg in place, follow the
instructions here (http://www.mythtv.org/docs/mythtv-HOWTO-23.html#ss23.5)
$ mysql -u root -p
mysql> drop database mythconverg;
mysql> create database mythconverg;
mysql> flush privileges;
mysql> exit
$ mysql -u mythtv -pmythtv mythconverg < mythtv_backup.sql
You should be good to go.
-- Mache
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20080720/b29a4d6b/attachment.htm
More information about the mythtv-users
mailing list