Cloning a Hard drive ?

Sebastian M=?ISO-8859-1?B?/A==?=sch sebastian at sebastian-muesch.de
Sun May 1 22:39:24 UTC 2005


Hi,

Once upon a time Vincent Trouilliez wrote:

> I just got round to getting a new hard drive to replace my faulty one.

Faulty? In what sense? Physical damaged? If so you should backup your
Userdata and make a clean install. If not, read on ...

> How do I proceed to make a perfect/binary copy of the old drive onto the
> new one ? Both are same type (IDE) and size (40GB), but not the same
> model, does it matter ?

Another model? The big question is, do both harddrives have the same
geometry (sector-count/cylinders etc.) ... If it's so indeed it's easy ...
Boot from a live-cd and do a "dd if=/dev/source of=/dev/destination bs=512"
(You may change bs - the blocksize - to the one of the disks, as 512 Bytes
result in a very slow cloning-process).

> Does "cloning" require the destination drive to
> be the exact same model and size ? Or will it do, as long as its large
> enough ?

It should ... At least the new disk should be of equal size or bigger.

> What tools to use ?  Is it just a matter of booting from Ubuntu's Live
> CD, and asking 'dd' to do some magic for me ?

No more needed ... The guide follows down the page ;-)

> Will dd make a perfect
> copy of all the "special" stuff, GRUB, MBR etc, so that once finished,
> it will all go smoothly, without further manual tweaking required ?

You'll need imho to at least restore grub.

Here's the right process for cloning a disk on a disk of bigger or equal
size.

(For all actions you need a root-shell)

1. Boot from the live cd.
2. On the new disk create the same partitions as on the first drive (same
order, same size, same partition type) for example with fdisk. You should
restart, as some times the ioctl-reload failes and the new partition-map for
the drive is not reread.
3. Boot the livecd again and do a "dd if=/dev/sourceX of=/dev/destinationX
bs=512" (maybe change blocksize) for each data-partition. For the
swap-partition just do "mkswap /dev/partitionX".
4. Create a mountpoint (for example /mnt/newdisk) and mount the new disks
linux root-partition.
5. Reinitalize grub by typing "chroot /mnt/newdisk grub-install
/dev/destinationDisk".
6. That's it, reboot your new old system ;-)

Cu
Sebastian

-- 
        .:'
     _ :'_
   .`_`-'_`.     Sebastian Müsch
  :__|\ /|__:      sebastian at sebastian-muesch.de
  :__| S |__:
  :__|   |__:     iTunes ist aus :-(
   `._.-._.'






More information about the ubuntu-users mailing list