[mythtv-users] Clone MythTV HDD

Simon Hobson linux at thehobsons.co.uk
Wed Aug 5 07:08:38 UTC 2009


Jim Stichnoth wrote:

>I did this recently.  If I recall correctly, I did it in the following way.
>
>1. Use fdisk to create partitions on the new drive, where most of the
>partitions are approximately the same size as the corresponding
>partitions on the old drive.  Be sure to mark the appropriate
>partition(s) as bootable.
>
>2. Run the appropriate mkfs or mkswap command on each partition.

Yup - an opportunity to fine tune partition sizes and filesystem options.

>3. For each partition, mount the partition and copy data from the old
>drive to the new drive with rsync, e.g.:
>     rsync -avx --progress <source> <destination>
>You have to be careful about how you specify the source and
>destination directories, including whether to use a trailing slash
>character.  See the man page, and make a test run first.

I prefer -avH, H is important as it preserves hard links.
Also, as someone else said, you can mount all the relevant partitions 
- so for example I might mount /mnt1, /mnt1/var, /mnt1/var/store for 
the original system. As it happened, I did this only a couple of 
weeks ago.

With the new partitions mounted on /mnt2, I'll use :
   rsync -avH /mnt1/ /mnt2/
the trailing '/' on each directory has the desired effect of copying 
the contents of /mnt1 into /mnt2 without creating an extra level of 
directory in mnt2.


>5. Install grub on the new drive's MBR.  Run "grub" from a shell, then
>commands "root (hd1,0)" and then "setup (hd1)" and then "quit".  This
>assumes the new drive is the second one in the system (hd1) and the
>first partition is the boot partition (the "0" in "(hd1,0)").

If you are replacing a drive, then you need to tell grub where the 
drive will be. The commands I use are :
device (hd0) /dev/sdb
root (hd0,0)
setup (hd0)

The first line there tells grub that the first sick in the system 
will be /dev/sdb

>6. Cross your fingers and boot the new drive!

Then go back and recall the bit about marking the boot partition as 
bootable :-/


There is of course a complication if (like me) you use LVM (I've got 
15 LVs in two VGs - it's a Xen box with several guests). You can 
either use a different VG name for the new disk (which I did), or you 
can rename either the old one before you start, or the new one after 
you've finished copying. If you use a different name, you'll have to 
adjust fstab and all your Xen guest configs to suit.

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.


More information about the mythtv-users mailing list