> -----Original Message-----
> From: Paul [mailto:[EMAIL PROTECTED] 
> Sent: 16 September 2005 15:23
> To: gentoo-user@lists.gentoo.org
> Subject: [gentoo-user] Replacing main harddisk
> 
> 
> Hi all,
> 
> My main harddisk is starting to go, making awful noise and 
> causing the 
> computer to freeze.
> I have another spare disk and I wondered if somebody would 
> list out the 
> procedure I need to follow to create and format the 
> partitions and to copy 
> all of the faulty disk contents. Then how to boot from the new disk.
> The new disk will need the following partitions:-
> /boot         ext2
> /swap
> /             reiserfs

1. Using the dd command or a cloning software derivative:
If the new disk is *exactly* the same size like the old one, then using
the dd command you can basically clone your failing disk, including MBR
and all partitions, including swap!, bit by bit:
=========================
dd if=/dev/hda  of=/dev/hdb 
=========================

On the other hand, if the new drive is larger then you will need to
partition it, exactly like the old one.  On the new drive, create the
same entries you find with fdisk for your old drive:  # fdisk -l
/dev/hda

Also, don't forget to clone the MBR:
=========================
dd if=/dev/hda of=/dev/hdb  bs=446 count=1
=========================
If you also want to clone the partition table (as opposed to writing one
afresh with fdisk) then increase the bs=446 to 512.

2. Using tar
If at the same time you want to alter the partition sizes on the new
drive then you can use the tar command, for each partition except for
swap.  Besides creating partitions of a preferred size on the new drive,
you will also need to mkfs for each partition.  Still have to use dd to
clone the MBR.
=========================
# mkdir -p /mnt/new_boot
# mount /dev/hdb1 /mnt/new_boot
# cd /boot
# tar lcpf - .|(cd /mnt/new_boot; tar xpvf -)
=========================
Repeat for / and also use tar -d (check $ man tar) to verify that the
directories were copied over without any mishaps.  Personally I prefer
tar because it is faster, it defragments the drive's contents and can
verify that the new directory was not corrupted in the tarring/untarring
process.

3. There's a number of backup apps out there which can do more or less
the same using a different front end; e.g. partimage.

Good luck.
-- 
Regards,
Mick

-- 
gentoo-user@gentoo.org mailing list

Reply via email to