[mythtv-users] backing up everything before a rebuild

Stephen Worthington stephen_agent at jsw.gen.nz
Thu Feb 18 06:09:03 UTC 2016


On Wed, 17 Feb 2016 22:15:17 -0500, you wrote:

>
>> On Feb 17, 2016, at 8:55 PM, Stephen Worthington <stephen_agent at jsw.gen.nz> wrote:
>> 
>> On Wed, 17 Feb 2016 11:56:27 -0500, you wrote:
>> 
>>> 
>>>> On Feb 17, 2016, at 9:10 AM, Stephen Worthington <stephen_agent at jsw.gen.nz> wrote:
>>>> 
>>>> On Tue, 16 Feb 2016 15:15:40 -0500, you wrote:
>>>> 
>>>>> I want to backup all my recorded TV shows and the database associated with them to a NAS and then completely rebuild the mythbuntu system.  I currently using 2 disks to split up the recording load.  I?l still be using 2 disks but they will be of different sizes.  I? also putting all the O/S stuff on a small SSD so the disks only have shows and movies.
>>>>> 
>>>>> What is the recommended method to do this safely without losing everything?
>>>>> 
>>>>> Jim A
>>>> 
>>>> Personally, I prefer the belt and braces approach.  I use the
>>>> mythconverg_backup.pl script in a cron job to back up the database
>>>> daily to another PC on my network.  It is also backed up weekly to
>>>> another drive on my MythTV PC.  Then when I am upgrading my Mythbuntu
>>>> system, I use clonezilla to backup my complete system partition to a
>>>> different hard drive on the same box.
>>>> 
>>>> If you do not already have regular scheduled backups of your database
>>>> happening, then that is the first thing you should get working, before
>>>> even considering an upgrade.  And you also need to have a cron job
>>>> running the optimize_db script daily also, as that prevents most
>>>> database crashes from happening.  Mythbuntu comes with cron scripts
>>>> for doing both backup and optimise, but for other systems, you may
>>>> need to do set that up yourself.
>>>> 
>>> 
>>> I am using mythbuntu so I see the mythconverg-1317-20160202074835.sql.gz type files in /var/lib/mythtv/db_backup directory.
>> 
>> Excellent, you have the automatic weekly backups working.  However,
>> the default location for those backups in Mythbuntu is on the system
>> partition - I prefer to have mine on at least a different drive, as
>> they get bigger and bigger as your database grows and can fill up the
>> system partition.  So in my /etc/cron.weekly/mythtv-database file, I
>> changed the --directory option to point to one of my recording drives,
>> which will always have much more space.  And I also copied the
>> /etc/cron.weekly/mythtv-database file to
>> /etc/cron.daily/mythtv-database and in that one changed the
>> --directory option to point to my backups directory on my Windows box,
>> so that it also backs up daily on a different PC on the other side of
>> my house.  That backups directory is also manually backed up to an
>> external drive every so often (about monthly).
>> 
>> [snip]
>>> I really appreciate your details here. I looked at the Wiki but a lot of that is dated and assumes you know what you want to do.  I can do the tasks once I know what tasks I want to do.  Missing a step can be ?deadly? to your data.  I copied all the recordings once and forgot the database so I lost those as far as Mythtv was concerned.
>>> 
>>> I don?t guess there?s a script to go thru your recorded TV files and add them back into the database??
>> 
>> There is apparently an old script, probably very out of date, that
>> allows you to add any arbitrary recording file into the recordings
>> database.  I have never tried it.  But there is so much more data in
>> the database about a recording than just what that script does.  For
>> example, the data that is used to prevent it being re-recorded.  That
>> extra data is what makes MythTV such good software to use.  Once that
>> data is lost, the recommended way to access orphaned recording files
>> is to put them in a videos directory.  From there, you can play them
>> and work out what programme they are (and what series and episode) and
>> then rename the file to something in the right format for MythTV to
>> automatically get the metadata for that episode.  Or manually enter
>> the right settings to get the metadata.  But doing that is an
>> incredibly time-consuming exercise if you have more than just a very
>> few orphaned recording files.  I found that even a weeks worth of
>> recordings was too many to want to do that ever again, which is one
>> reason I went to daily backups of my database.
>> 
>> One thing I forgot to mention is that if you are doing a clean install
>> of Mythbuntu, make sure that you use the same hostname and IP address
>> settings as the old install did.  Changing hostname in a MythTV
>> database is possible, but it is one of those things it is best to
>> avoid if at all possible.
>
>Okay, I got lucky and got everything moved over after a rebuild.  I did keep the name and IP the same.  I would like to understand why what I did worked.  Here’s why I ask that:
>
>I used my network to backup each of the 2 drives Recorded directories (Default Storage Group) to 2 separate directories on my NAS.  I stopped the backend and did a backup of the database with the script.  I pulled the 2 existing drives and put in the mSATA 60GB drive and 2-500GB SATA hard drives.  I put the Mythbuntu system stuff on the mSATA. I setup the /etc/fstab to mount the 2 drives under /media/recorded1 and /media/recorded2.  I put the recorded videos from the NAS back into the 2 /media directories.  Then I restored the database and dropped the old one.  I then edited the backend setup to put the new directories names into the Default Storage groups.  These were different from the originals that were saved on the database backup.
>
>Somehow everything in the database is correct, even though the locations are different from when they were originally recorded.  
>
>So does the database go by filename?  Both of the new directories are in the Default Storage Group the same as the old ones were.
>
>I’d like to understand more, but it’s all working.
>
>I’ll setup some better backup procedures now.
>
>Jim A

The recording files can be moved around at will.  They are found by
filename only (the "basename" field in the database), and will be
found if they are anywhere in any recording storagegroup.  This is
very farsighted design by the MythTV devs that has made lots of things
work very nicely.


More information about the mythtv-users mailing list