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

Re: Using dd to clone smaller drive to larger drive

On Tue, Dec 06, 2005 at 08:27:47PM -0800, Brian C wrote:
> Hi,
> /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?
Hi Brian,

I generally think that your approach is fine, especially because you
mention bad sectors. With dd you get everything from the failing disk
and you can worry about recovering files later. I would however suggest
the following modification:

make partition on /dev/hdb; mount it

dd if=/dev/hda1 of=/mnt/hdb1/backup_dd_hda1.img
dd if=/dev/hda2 of=/mnt/hdb1/backup_dd_hda2.img
dd if=/dev/hda3 of=/mnt/hdb1/backup_dd_hda3.img

You can then mount your partition images with

mount -o loop /mnt/hdb1/backup_dd_hda1.img /mnt/loop1
mount -o loop /mnt/hdb1/backup_dd_hda2.img /mnt/loop2
mount -o loop /mnt/hdb1/backup_dd_hda3.img /mnt/loop3

and work on them/fix them/copy them as you like.


> Should I first set up the new drive with identical partitions to the old 
> drive?
> If so, what can I do with the extra space?
> What will happen if dd encounters a bad block?
> Thanks,
> Brian
Andreas Rippl -- GPG messages preferred
                 Key-ID: 0x81073379

Attachment: signature.asc
Description: Digital signature

Reply to: