Want to install MythTV onto a new system, or install things from scratch on the same system? The big problem is loosing all your recordings and data.
It not as simple as just copying your recording files over. You need to have the database information about each file for them to work.
It's fairly easy to transfer your important database information to a new server. Here's how.
Migrate your MythTV recordings in 3 easy steps:
- Backup the important database information from the old database
- Copy the files into the new install directory
- Restore the database information into the new database
Step 1 - Backup your existing data
I've seen a couple different ways to do this in the MythTV documentation, both of which seem a little awkward. I think I have a better way, which has worked fine for me once.
Basically what we need to do is export the information about the existing recordings, previous recordings, and future recordings. This data will be imported into an already setup database on the new system.
mysqldump -u mythtv -p -t mythconverg record recorded \ oldrecorded recordedprogram recordedrating \ recordedmarkup recordedseek > recordings.sql
That's all a single command that needs to be run on the command line. If you use a different database user, substitue your username in place of "mythtv" after the -u argument. If you use a different database name, replace mythconverg with your database name.
That command, after prompting for your database password, will export all the data you need to migrate into a file name recordings.sql. This is the file you will need to import on the new server when we get to that step. How to copy the file will be an exercise for you to figure out, since each situation may be different.
Step 2 - Copy your video files to the new MythTV recordings directory
Again, each situation may be different in terms of copying files over.
One tip is to find where you think they are going to be recorded, then start recording a show to see if a file shows up there. If a file shows up in that directory then you've got the right place. Copy all your video files over.
This may take a while if you are going between drives or over a network, but you can import the database records while files are copying. When I migrated to a new system, it took about 8 hours to copy all my recordings over the network.
Until everything is copied over, you will just get an error if you try to watch a recording that hasn't been copied yet if you go ahead and import the recording data.
Step 3 - Import the recording data into the new database
Start by copying the recordings.sql file to the target server if it's not already there. Then all we need to do is import it to the target database.
mysql -u mythtv -p mythconverg < recordings.sql
Provide your password, and the recording data will be imported.
Watch Your MythTV Recordings
That's it. If everything went as planned, all your recording will be in your new system as if nothing had changed.