[CS-FSLUG] Linux Drive Cloning

Karl Kleinpaste karl at kleinpaste.org
Mon Jul 26 06:52:24 CDT 2010


Timothy Butler <tbutler at ofb.biz> writes:
> I want to take a 250 GB ext3 hard disk full of data (and the Linux system
> and boot files, too) and clone its data onto a 500 GB disk.

The dd suggestions are dangerous in that you will find yourself very
unhappy if the partitions are at all different, especially in size, and
possibly in placement or layout.  The choice for what's given to the
filesystem's block assignment overhead will change with partition size
(number and placement of replicated superblocks, for example) and you
have no guarantee that you are getting the right result if sizes differ.
For absolutely identical discs, sure; otherwise, you are rolling loaded
dice.  Making assumptions that you can clone a _filesystem hierarchy_
onto a set of _disc blocks_ is a risky proposition and should be left to
the OS since that's its job.  dd will copy the content as disc blocks,
but what you need is the higher semantic content of the filesystem.

I haven't any idea how the Mac's Disk Utility works, but I doubt that it
attempts to clone a filesystem using special knowledge of block assignment.

Far safer is to let ordinary filesystem utilities do the work:

tar cf - -C /start/dir . | tar xpf - -C /end/dir
  or
rsync -avx --delete --ignore-errors --links /start/dir/ /end/dir
  (note trailing slash on source and see the man page about such things.)

The former is most suitable when you are safe with the idea that
/end/dir is an empty filesystem and you're just filling it.  The latter
is at the core of my personal disc clone backup strategy.

Once you have cloned the content, if the disc needs to be bootable, you
will also have to run grub on the new disc, to init its boot block.




More information about the Christiansource mailing list