Re: Using dd to clone smaller drive to larger drive




good email addy

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

yes you can.. but...

> and will that just work?

no ... it might not work ... because youwill be copying the suspect
bad data/bad block from the suspect bad disk onto the new disk

dd is low level and will ocpy anything .. including bad data
and sectors marked as bad by sw ( badblocks, etc ), but, it should
not copy tracks/sectors marked bad by the disk controller fw

- if you want to leave bad data behind

mount /dev/hdb1 /mnt/new-disk
tar cvfp old-disk-paritions /mnt/new-disk
sync
umount /mnt/new-disk

boot the new disk with a floppy or bootable cdrom
and rerun grub/lilo on the new disk


> Should I first set up the new drive with identical partitions to the old
> drive?

only if you know you won't outgrow the old paritions

if you used the dd command you suggest ( dd if=/dev/hda of=/dev/hdb )
you may or many not have "extra space"

> If so, what can I do with the extra space?

use it as spare .. make another partition with the rest of the
unused space

you will also have to watchout for the number of heads
on /dev/hda vs /dev/hdb when copying

- cylinder * heads * sectors is remapped into mumble-jumble

you may or many not be able to truncate the partitions on hdb
after you copied the smaller hda onto hdb

it's bad idea to truncate large partitons with say 100MB of free
space at the end of the partition and create a new 100MB partition
out of it .. if you're careful .. it will work for a while

> What will happen if dd encounters a bad block?

depends on how the "bad block" is marked
- marked by sw vs marked by firmware vs marked on the track itself
- all apps will skip around bad blocks marked by fw or hw
unless you make a custom-app.asm to read the badblocks itself

- lots of fun stuff to do

c ya
alvin


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Windows 2000 Disk Partitions
    ... I have just added a 4th disk to a RAID 5 set on a HP Server. ... an dwhen I go in to Disk Management I can see the extra space on Disk ... I currently have 4 existing partitions on this disk - is there a restriction ... how long would it take to upgrade an 18GB Basic ...
    (microsoft.public.win2000.general)
  • LVM on SW RAID for sarge - success
    ... I've just had success migrating Debian Sarge to root on LVM on RAID. ... First make sure the SCSI BIOS boots from the first disk. ... I made reiserfs on all the filesystem partitions and completed the ... The remaining two disks were partitioned and used to create RAID arrays ...
    (Debian-User)
  • Re: Replace SCSI Drive
    ... from there you can manipulate other hard drives attached to the machine. ... It should 'just work' but watch out that you keep disk devices ... vi-a) Write a BSD partition table into the slice, then set up your required FreeBSD partitions: ... items under the 'Custom Install' to achieve the desired result. ...
    (freebsd-questions)
  • Re: RAMDisk and HardDisk strikes back!
    ... One disk with only one partition as large as FBA setup; ... Two disk with one or more partitions for each. ... @ 20:32:55.252 #W059 Selecting best compatible driver failed. ... @ 20:53:51.166 #T211 Install Device: Changing registry settings as specified ...
    (microsoft.public.windowsxp.embedded)
  • Re: backups & cloning
    ... dump unmounted file systems to the system's tape drive. ... The restore program, on the other side of the | pipe, does ... Here's an example (ad1 is source disk, ... Use dump only on unmounted partitions. ...
    (freebsd-questions)