[mythtv-users] Copying an install

mythtv-users at spam.dragonhold.org mythtv-users at spam.dragonhold.org
Mon Mar 20 09:52:50 UTC 2006


On Mon, Mar 20, 2006 at 04:38:10AM -0500, Paul Williams wrote:
> Maybe best bet is to just buy a second drive. If all possible try to buy
> same manufacture/model/storage. I use "dd" to back up from one drive to the
> other.
> 
Whilst I find dd a very useful tool, in this case I think it's the wrong one for the job - 
for what you're doing and possibly what the other person requested...

I like your answer to redundancy (although I use mirroring instead, but that doesn't protect 
me against accidently deleting stuff) - but would recommend using rsync rather than dd.

dd will copy the entire drive, which saves you the hassle of setting up the filesystems, but 
instead gives you a massive overhead (e.g. if you've got 100GB of unchanged data, it'll 
still copy it across).  rsync only copies the changed data - so in the example given would 
only copy 20GB (assuming the disk is full).  If you schedule an rsync job every night (at a 
time you're unlikely to be recording) then you can easily keep your backup reasonably 
recent.

The downside to both methods is that if the partitions are active, the data copied across 
could easily be invalid.  If (for example) your mysql database is getting a major change 
done to it during the copy, then the copy is likely to be corrupt the to extent of being 
unusable.  This sort of backup should really be done in single user mode.

This means that you should really do a mysqldump of the database somewhere that gets synced 
too - so that you can then restore from it in case something doesn't work with the copied 
database files.

However, in this specific case I'd agree that cloning the machine to a new disk is probably
the best answer - and assuming he's going to be opening up the case to put the new disk in
temporarily, dd from single user is probably the easiest thing to do as long as the disks
are the same part from the same manufacturer (and you still need to check the geometry,
since I've seen some change) - it won't work for a 120GB disk from IBM to clone to a 120GB
disk from Seagate - and certainly won't work from 120GB to 200GB.

If the new disk is a different size, then you're going to need to create the filesystems, 
mkfs.<appropriate> each of them, and then copy the data.  Depending on the filesystem you're 
using this could be done with one of many tools - in order of descending preference I'd 
suggest dump (or xfs_dump, or whatever the filesystem's tool is), tar, rsync, cp.

The filesystem specific dump has been designed to do this - so is the best answer most of 
the time.  Tar has a few gotchas, but is a standard tool that most unix admins know so easy 
to get support on.  rsync is probably better than tar, but fewer people will be able to help 
if anything goes wrong.  And cp can flip out on things like device files if you don't pass 
it the correct runes.

Once the disk is cloned, you'll need to reconfigure myth on the 2nd machine to access the 
backend on the first :)

Graham


More information about the mythtv-users mailing list