1 |
> -----Original Message----- |
2 |
> From: Paul [mailto:gentoo@××××××××××××.com] |
3 |
> Sent: 16 September 2005 15:23 |
4 |
> To: gentoo-user@l.g.o |
5 |
> Subject: [gentoo-user] Replacing main harddisk |
6 |
> |
7 |
> |
8 |
> Hi all, |
9 |
> |
10 |
> My main harddisk is starting to go, making awful noise and |
11 |
> causing the |
12 |
> computer to freeze. |
13 |
> I have another spare disk and I wondered if somebody would |
14 |
> list out the |
15 |
> procedure I need to follow to create and format the |
16 |
> partitions and to copy |
17 |
> all of the faulty disk contents. Then how to boot from the new disk. |
18 |
> The new disk will need the following partitions:- |
19 |
> /boot ext2 |
20 |
> /swap |
21 |
> / reiserfs |
22 |
|
23 |
1. Using the dd command or a cloning software derivative: |
24 |
If the new disk is *exactly* the same size like the old one, then using |
25 |
the dd command you can basically clone your failing disk, including MBR |
26 |
and all partitions, including swap!, bit by bit: |
27 |
========================= |
28 |
dd if=/dev/hda of=/dev/hdb |
29 |
========================= |
30 |
|
31 |
On the other hand, if the new drive is larger then you will need to |
32 |
partition it, exactly like the old one. On the new drive, create the |
33 |
same entries you find with fdisk for your old drive: # fdisk -l |
34 |
/dev/hda |
35 |
|
36 |
Also, don't forget to clone the MBR: |
37 |
========================= |
38 |
dd if=/dev/hda of=/dev/hdb bs=446 count=1 |
39 |
========================= |
40 |
If you also want to clone the partition table (as opposed to writing one |
41 |
afresh with fdisk) then increase the bs=446 to 512. |
42 |
|
43 |
2. Using tar |
44 |
If at the same time you want to alter the partition sizes on the new |
45 |
drive then you can use the tar command, for each partition except for |
46 |
swap. Besides creating partitions of a preferred size on the new drive, |
47 |
you will also need to mkfs for each partition. Still have to use dd to |
48 |
clone the MBR. |
49 |
========================= |
50 |
# mkdir -p /mnt/new_boot |
51 |
# mount /dev/hdb1 /mnt/new_boot |
52 |
# cd /boot |
53 |
# tar lcpf - .|(cd /mnt/new_boot; tar xpvf -) |
54 |
========================= |
55 |
Repeat for / and also use tar -d (check $ man tar) to verify that the |
56 |
directories were copied over without any mishaps. Personally I prefer |
57 |
tar because it is faster, it defragments the drive's contents and can |
58 |
verify that the new directory was not corrupted in the tarring/untarring |
59 |
process. |
60 |
|
61 |
3. There's a number of backup apps out there which can do more or less |
62 |
the same using a different front end; e.g. partimage. |
63 |
|
64 |
Good luck. |
65 |
-- |
66 |
Regards, |
67 |
Mick |
68 |
|
69 |
-- |
70 |
gentoo-user@g.o mailing list |