[mythtv-users] backing up everything before a rebuild

Stephen Worthington stephen_agent at jsw.gen.nz
Wed Feb 17 14:10:20 UTC 2016


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’ll still be using 2 disks but they will be of different sizes.  I’m 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.

On my boot drive, I have three bootable partitions, so I can then
restore the clonezilla backup to one of them and try the upgrade on
that without affecting the normal boot drive.  If it succeeds, then I
adjust the boot options so that partition becomes the default boot
partition.

If the upgrade procedure fails, then I normally do a clean install of
the new version of Mythbuntu on to the partition in place of the
failed upgrade, and restore the database using mythconverg_restore.pl.
I can then manually install all the packages and customisations I have
on the old system, upgrade the database to a new MythTV version if
that is needed, and try the new system out.  Usually, there will be
some problem that needs to be worked on for a while, so I reboot back
to the old boot partition and keep running the old system from there
when it is needed for recordings or playback, and keep on working on
the new partition in between.  When I am happy with the new setup, I
backup the old database again, restore it on the new system, upgrade
it if necessary and test again.  If all is working right, I then start
using the new setup permanently.

So in your case, if you have enough room, I would recommend running
the SSD in parallel with your existing boot drive while you are
getting it going and then using a similar procedure.  For further
upgrades in the future, if you do not want two boot partitions on the
SSD so you can do a similar upgrade next time, I would recommend
keeping at least one bootable partition on one of your other drives so
you can test out an upgrade there.  Then when you have the upgrade
working you can backup the SSD with clonezilla and copy the new
working system over from the hard drive to the SSD.

For upgrading to new recording drives, I normally simply install the
new drive in parallel with the old one.  If you do not have room in
your PC, you can use an external drive mount on an eSATA or USB3
connector, or you can pull a long SATA cable and SATA power cable out
through an empty slot in back of the PC and temporarily run the drive
externally.  Once I have the new drive installed in parallel, I copy
across any system partitions it may have on it using GParted, then
format the rest of the drive as an empty recording partition (JFS in
my case).  If the working system partition is on that drive, I adjust
the boot settings so that I am now booting from the new copy of the
partition on the new drive.

Copying system partitions does not take too long as they are generally
quite small, compared to recording partitions.  Copying all the
recordings from one drive to another would take far too long to be
done between scheduled recordings on my system, so I use another
strategy for that.  I go into mythtv-setup and change the storagegroup
of the recording partition on the old drive from Default to a new
temporary storagegroup.  Since the new storagegroup is not listed in
any recording rule, mythbackend will now never try to record to it.
Now I can restart the system and allow it to run normally (except for
having one fewer drive to record to, which is fine for me as I have 7
recording drives now).  Then while the system is running normally and
doing recordings, I can copy all the recordings from the old drive to
the new one in the background.  That normally takes many hours.  I can
still play back recordings on the old recording partition, but I need
to note down the filename for any recording I delete, as it may have
already been copied to the new drive and need to be deleted from there
too.  The filename is listed for any recording on the screen that
comes up when you hit the I key twice from the listing for that
recording.  You may need to scroll that screen down to see it.

Once all the recordings have been copied to the new recording drive, I
go into mythtv-setup again and put the new recording partition into
the Default storagegroup and remove the temporary storagegroup.  I
delete any recordings that have now been deleted from the old
recording drive from the new one also.  I can then remove the old
recording drive and put the new one into its old physical location,
then restart the system and it will now be using the new larger
recording drive.  Then I use my balance_storage.sh script to balance
the free storage amongst my recording partitions, which can again be
done in the background while the MythTV system is working normally.
Depending on how much new free space is available on the new drive,
that can again take many hours.

The methods I have outlined always keep a copy of the old data
available so that if there are any problems, I can quickly go back to
the old working setup at any time so I will not miss any recordings.
Whenever I am working on the new setup, I always set myself a deadline
by which I have to either have the new setup working, or decide that I
am going to have to keep using the old one.  That deadline leaves
plenty of time for switching back to the old setup and getting it
running again - for example, enough time to do a clonezilla restore of
the old system partition, should that be necessary.  The deadline also
leaves time for any emergencies that might happen, such as a cable
having been bumped while fiddling with the hardware and that causing a
problem (drive offline, tuner not working).  Experience tells me that
if I were to decide that I should keep going for "just another 5
minutes" beyond the deadline time, Murphy will strike and I will not
get things going before the scheduled recording time.  These days, the
largest gap between recordings that I normally have in a week will be
no more than eight hours, and for doing an upgrade all in one go, that
is not long enough.


More information about the mythtv-users mailing list