Backup and Restore

Version 8 (brfransen, 01/22/2019 08:13 pm)

1 1
h1. Backup and Restore
2 1
3 5 brfransen
h2. R8.x
4 1
5 5 brfransen
h3. Automated Backup
6 1
7 5 brfransen
In R8.x there is an automatic system backup that is done daily. The system backup is performed as part of the myth_mtc process run by cron. The system backup is saved to a single archive in @/data/storage/disk0/backup/system_backups@. The system backup contains the MythTV database, /etc directory and the /home directory.
8 1
9 5 brfransen
If a second hard drive was added to the LinHES R8.x system using add_storage.py and Remote Backup is not enabled a copy of @/data/storage/disk0/backup/system_backups@ will be made to the second hard drive at @/data/storage/disk1/backup/system_backups@. This provides some added protection in case the OS/home/mysql (disk0) drive fails.
10 5 brfransen
11 5 brfransen
h3. Remote Backup
12 5 brfransen
13 5 brfransen
Remote Backup copies the system backups to another directory on the local machine or another host on the network. 
14 5 brfransen
Enable Remote Backup in Service Menu --> LinHES Settings --> Advanced --> Advanced Settings (2/2)
15 5 brfransen
16 5 brfransen
h3. Manual Backup
17 5 brfransen
18 5 brfransen
Start a manual backup from the menu: Service Menu --> LinHES Backup
19 5 brfransen
20 5 brfransen
Start a manual backup from the command line: @/usr/LH/bin/lh_system_backup@
21 5 brfransen
22 5 brfransen
Start a manual backup from http://$YourServerName:
23 5 brfransen
* Click Health & Maintenance
24 5 brfransen
* Click hostname
25 5 brfransen
* Click Backup and Go 
26 5 brfransen
27 5 brfransen
h3. Restore
28 5 brfransen
29 8 brfransen
Only the MythTV database is restored. The /etc and /home directories are contained in the backup archive and can be restored manually.
30 6 brfransen
31 5 brfransen
Start a restore from the menu: Service Menu --> LinHES Restore
32 5 brfransen
33 1
Start a restore from the command line: @/usr/LH/bin/lh_system_restore@
34 8 brfransen
@/usr/LH/bin/lh_system_restore@ will restore the most recent backup only.
35 8 brfransen
@/usr/LH/bin/lh_system_restore_job@ requires the name of the backup to restore. This allows older backups to be selected and restored. 
36 5 brfransen
37 5 brfransen
Start a restore from http://$YourServerName:
38 5 brfransen
* Click Health & Maintenance
39 5 brfransen
* Click hostname
40 5 brfransen
* Click Restore and Go 
41 5 brfransen
42 5 brfransen
h2. R7.x
43 5 brfransen
44 5 brfransen
h3. Automated Backup
45 5 brfransen
46 5 brfransen
Starting in LinHES R7.2 there is an automated system backup that is done daily.  The automated system backup is independent of the mythbackup and mythrestore scripts described in Manual Backup. The system backup is saved to a single archive in the @/myth/system_backups@ directory and contains only the MythTV database and /etc directory.  Backups & Restores started from the [[Supplemental_web|Supplemental Web]] interface uses system backup.
47 5 brfransen
48 5 brfransen
h3. Manual Backup
49 5 brfransen
50 3 brfransen
"MythBackup and MythRestore Scripts":http://forums.linhes.org/viewtopic.php?p=112490#p112490
51 2 brfransen
52 5 brfransen
h4. Menu
53 1
54 2 brfransen
In KnoppMyth R5 under "MythTV Configuration" select "Backup".
55 2 brfransen
56 1
In LinHES under "Service Menu" select "Backup LinHES".
57 2 brfransen
58 5 brfransen
h4. Command Line
59 2 brfransen
60 3 brfransen
Follow these steps to make a backup in KnoppMyth R5 (R5C7 and newer) and LinHES from the command line.  Doing this from the command line rather than through the menus will help you ensure that there aren't any undetected failures which will cause you grief later.  Follow the directions at the bottom of "Backup and Restore Scripts":http://forum.linhes.org/viewtopic.php?p=112490#112490 for KnoppMyth R5B7 and older.
61 2 brfransen
62 2 brfransen
* As root (or sudo), run the backup command.
63 1
<pre>
64 2 brfransen
sudo mythbackup
65 1
</pre>
66 1
67 1
* Make sure that the backup worked! The scripts automatically check and report their results but you have to pay attention. If you miss it, need to repeat the check for other reasons, or there is an error in the backup, run the following command as root and report the messages it produces: 
68 1
<pre>
69 1
checkbackup
70 1
</pre>
71 1
72 1
* Check that you don't have multiple compression formats for a given backup filename which will cause confusion later using the following commands:
73 1
<pre>
74 1
ls -l /myth/backup/savedfiles.tar* /myth/backup/mythconverg.sql* | 
75 1
 sed '/\.[0-9]*$/d'
76 1
</pre>
77 1
It's OK if the savedfiles.tar and mythconverg.sql compression (or lack thereof) are different, however, the files should both show the same current date. On my system it produces these healthy results: 
78 1
<pre>
79 1
root@black2:~# ls -l /myth/backup/savedfiles.tar* /myth/backup/mythconverg.sql* | sed '/\.[0-9]*$/d' 
80 1
-rw------- 1 root root 23355203 Jun  4 23:45 /myth/backup/mythconverg.sql.gz 
81 1
-rw------- 1 root root 24731079 Jun  4 23:45 /myth/backup/savedfiles.tar.gz
82 1
</pre>