Re: cloning hard disk
On Sun, 2005-02-13 at 21:12 -0700, Allasso Travesser wrote:
> Hello,
>
> I would like to clone my Debian Woody system onto a second larger hard disk.
> It seems to me that it would just be a matter of cleaning off the second
> disk, partioning using fdisk, and then running:
>
> dd if=/dev/hdc of=/dev/hda
>
> where hdc is the drive from which I am copying my current system, and hda is
> the drive I want to put this system on.
>
> current hdc partition table (2 Gb disk):
>
> Device Boot Start End Blocks Id System
> /dev/hdc1 1 13 52384+ 83 Linux
> /dev/hdc2 14 449 1757952 83 Linux
> /dev/hdc3 450 523 298368 82 Linux swap
>
> How I plan to partition hda (30 Gb disk):
>
> Device Boot Start End Blocks Id System
> /dev/hda1 1 13 52384 83 Linux
> /dev/hda2 14 3704 29647957+ 83 Linux
> /dev/hda3 3705 523 298368 82 Linux swap
>
> Can anyone see anything wrong with this, or would you tell me anything I
> should watch out for? Anything I should find out about my current system
> first? It seems that this could be fatal if it is not done right.
>
> Thank you, Allasso
We routinely clone hard drives by doing a simple cp.
make the filesystem, cp the files, then reinstall the bootloader
I have attached an older script that has lilo stuff in it (I can't post
the newer ones). We tend to do the chroot and lilo bit manually as we
feel safer that way.
works very nicely every time
Cheers
Blake
----------------------------- clone.sh --------------------------------
!/bin/bash
mke2fs -j -L /boot /dev/hdc1
mke2fs -j -L / /dev/hdc2
mke2fs -j -L /home /dev/hdc4
mkswap -f /dev/hdc3
mount -t ext3 /dev/hdc2 /mnt/clone
cp -axv / /mnt/clone
mount -t ext3 /dev/hdc1 /mnt/clone/boot
cp -axv /boot /mnt/clone
mount -t ext3 /dev/hdc4 /mnt/clone/home
cp -axv /home /mnt/clone
cd /mnt/clone
#chroot .
#sbin/lilo -C /etc/lilo.conf.hdc
#exit
-----------------------------------------------------------------------
--
Blake Swadling <blake@swadling.com>
Swadling.com
Reply to: