[mythtv-users] sluggish system, potential HD failure, and how best to get back up and runnin
wdormann at gmail.com
Tue Mar 4 16:27:09 UTC 2014
On 3/4/14, 11:01 AM, Gabe Rubin wrote:
> 2) Assuming the dying drive is not dead yet, what is the easiest way to
> mirror the drive over to a new drive so I don't have to do a full
> re-install and set up (and remember) all my configurations. Just
> setting up lirc can take a few hours, so I would prefer to avoid doing a
> reinstall of myth from scratch.
A few tips to prevent this sort of situation in the future. (tl;dr:
always have backups for important things; always monitor system health)
1) Make sure that your mythtv database is backed up regularly. Mine is
set to run daily via cron. The database is the most important part of
2) Back up your entire system at least once (to another
device/drive/etc), and then on demand before making any major changes.
An OS restore plus a database restore from 1) will mean that you'll
never lose more than 24 hours. My recordings are not on the local FS, so
those aren't backed up. Here's my script. Depending on your partition
layout and filesystems used, you'll want to modify to suit your system.
---- begin backup.sh ----
mkdir -p $backupdir
echo Copying documentation...
cp mbr.txt $backupdir
cp xfsrestore.txt $backupdir
echo Backing up MBR...
dd if=/dev/sda of=$backupdir/mythbuntu-mbr.bin bs=512 count=1
echo Dumping boot filesystem...
dump -0uf $backupdir/boot.dump /boot
echo Dumping root xfs filesystem...
xfsdump -e -l0 - / | gzip > $backupdir/mythbuntu.dgz
---- end backup.sh ------
I also occasionally burn a bootable DVD copy of the backup, padded with
dvdisaster ECC info, just to be extra paranoid:
---- begin burnbackup.sh ----
# Copy systemrescuecd iso
ionice -c 3 cp sysrec.iso recovery.iso
# Add mythbuntu backup files
ionice -c 3 growisofs -M recovery.iso -J -R $backupdir
# Create dvdisaster redundancy
ionice -c 3 dvdisaster -c -mRS02 -i recovery.iso
# Burn to disc
growisofs -dvd-compat -Z /dev/sr0=/mnt/store/rescue/recovery.iso
---- end burnbackup.sh ------
3) Use smartd from smartmontools to monitor your drive health.
Configure it to both do scheduled self-test scans and also email you in
the case of pending failure.
You can also run smartctl from smartmontools now to confirm that your
drive is dying. e.g.:
sudo smartctl -a /dev/sda
As for recovering your data, here are the most important parts to get
off of your drive asap:
1) The database (see above)
If you're able to back those up, you should be able to get your system
back to normal with a moderate amount of effort.
More information about the mythtv-users