Re: Using dd to clone smaller drive to larger drive
Andrew Perrin wrote:
On Tue, 6 Dec 2005, Brian C wrote:
/dev/hda is the Debian Sarge system, w/ 3 partitions.
/dev/hdb is a new slightly larger drive w/ no partitions.
/dev/hda may have a bad block or two, and so the plan is to clone it
to the new drive, remove the old drive, move new drive to /dev/hda
(primary master) and then run from the new drive.
Can I just type (as root):
dd if=/dev/hda of=/dev/hdb
and will that just work?
Should I first set up the new drive with identical partitions to the
That would be a waste of time - your proposed dd command will wipe them
As suggested elsewhere, dd is not a good tool for this job. One among
many reasons is that the different drive geometry may make the whole
exercise fail. tar is a much better choice.
1.) partition the new drive as you want it
2.) for each partition of the new drive, mount the partition in /mnt/tmp
or something like that, then
cd /old-partition-mount ; tar cf - . | (cd /mnt/tmp ; tar xf -)
What does the dot do?
where /old-partition-mount is the point where the partition you're
trying to copy from is mounted; then
and repeat for each partition.