Matthew Rosewarne on 28 Sep 2008 20:16:29 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Need Advice on Cloning A Disk Drive


On Sunday 28 September 2008, Casey Bralla wrote:
> (ReiserFS has been good to me, but now that it has been established that
> Hans Reiser is not simply an uber-geek with no social skills, but a true
> sociopathic murderer, I doubt if ReiserFS development will continue on any
> meaningful way.)

You're right that Reiserfs is probably not a good horse to bet on.  It has 
flaws that were only going to be corrected with Reiser4, which has stagnated 
since Reiser's arrest.  JFS is very good for laptops, as it has almost as good 
performance as XFS with less CPU load.  Ext3 is probably a good for things 
that need to be ultra-reliable, since it's a relatively simple FS and is 
widely supported.  XFS is very fast, particularly for large files, and has 
some very nice tools (such as xfs_dump).

> If both disks were the exact same size and used the same file system, I
> could simply "dd" the old disk onto the new disk.  Also, since they are
> different file systems, I can't use partition tools like Partition Magic
> and its equivalents.

There's no need to dd in any case.  Simply copying the files should be just 
fine.

> Here's what I've been trying to do (and where it has failed).
>
> 1.  Install the new disk as a slave drive
> 2.  Boot to Knoppix.

Whole Bhaskar is right that it's certainly possible to copy from a live 
system, it's generally better to copy from a non-live system due to things 
like lock files and other temporary runtime-generated cruft.

Also, you might want to try Debian Live instead of Knoppix, since it's 
typically more up-to-date.

> 3.  Mount both the old drive and the new drive under Knoppix
> 4.  Copy the entire old drive onto the new drive

Like Bhaskar, I would also recommend rsync.  My typical command line is
	rsync --verbose --archive --hard-links --acls --xattrs --sparse
	--one-file-system --delete --stats --8-bit-output --human-readable
	--progress --itemize-changes / /destination/

The -x or --one-file-system option is crucial, as it makes sure that rsync 
only copies from the / filesystem instead of /dev, /proc, /sys, or other 
filesystems.

For additional protection, you can use the -c or --checksum.  It verifies that 
files are transferred correctly, but takes much longer.

I usually test my rsync command with the -n or --dry-run option FIRST, so I 
know I won't accidentally do something stupid/dangerous.

See the rsync man page for all the (many) options.

> 5.  Reboot to the old drive and old system.
> 6.  Run grub on the new drive to set the MBR on the new drive.

You might as well do this from Knoppix with a chroot instead.  After copying:
	mount /dev /destination/dev -o bind
	mount /proc /destination/dev -o bind
	mount /sys /destination/dev -o bind
	chroot /destination
	grub-install /dev/{destination disk}

After grub-install, you can edit the GRUB configuration file 
(/boot/grub/menu.lst for GRUB 1, not sure what Gentoo uses for GRUB 2).
When you're finished, leave the chroot with:
	exit

> 7.  Swap the old and new drives so that the BIOS boots to the new drive

Don't do that, just use UUIDs in the grub configuration instead of /dev names.  
Also specify disks with UUID= or LABEL= in /etc/fstab.

> 8.  Enjoy my new disk with extra breathing room!

For more flexibility, I'd strongly recommend using LVM instead of standard 
partitions.  It's not at all difficult to set up, so check out the Gentoo docs 
about it.

Attachment: signature.asc
Description: This is a digitally signed message part.

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug