1 |
I do this quite frequently - except that in most cases I am |
2 |
replacing an old drive with a new larger driver, but want |
3 |
the existing partitions copied accross identically as if |
4 |
nothing has changed. To complicate matters, I often have |
5 |
more that one operating system installed on the disk. |
6 |
|
7 |
The basic appreach is really the same thing you would do if |
8 |
your old drive failed completely and you were recovering from |
9 |
backups - only this way you can make sure your backups are |
10 |
completely up to date so that nothing is lost. |
11 |
|
12 |
The best method (IMHO) is as follows: |
13 |
|
14 |
Firstly, always make sure your backups are completely up |
15 |
to date before you start plugging and unplugging hard drives. |
16 |
Use 'fdisk -l' or similar to get the exact partitioning of the |
17 |
old drive, and print a copy. |
18 |
|
19 |
Next connect and partition the new drive with identically sized |
20 |
partitions to the original drive. Any extra space will be available for |
21 |
new partitions - these can be created now or later. |
22 |
|
23 |
Now load all of the partitions with the content of the corresponding |
24 |
original. If I am using dump to backup ext2/ext3 filesystems, I usually |
25 |
just use restore at this point. |
26 |
|
27 |
Alternatively, boot your old system single user (so all filesystems |
28 |
are read-only) and dd each old filsystem to the corresponding |
29 |
new filesystem. |
30 |
|
31 |
Finally, move the new drive to its final address and remove the |
32 |
original, boot using a floppy or CD, and use grub/lilo to update your |
33 |
boot blocks. Then, of course, you chould run a filesystem check |
34 |
on each of the filesystems just to make sure. |
35 |
|
36 |
This ensures that the information in the boot sector is correct |
37 |
for the new drive. Two 120G drives will typically not have |
38 |
*exactly* the same number of sectors, and usually will have |
39 |
a different geometry. So long as the new drive has the same |
40 |
or more, then you are ok and just need to make sure you copy |
41 |
the original partition sizes exactly. If you have slightly less, |
42 |
then at least one partition will be smaller and should be |
43 |
formatted and copied file by file (although you could avoid |
44 |
this by choosing to shrink the swap partition). |
45 |
|
46 |
The dd means I don't have to worry about what operating system |
47 |
is in the partition, and there is no possibility that oversights |
48 |
with rsync will have resulted in subtle changes that might go |
49 |
un-noticed for a long time - such as forgetting to preserve |
50 |
hard links (archive mode does not preserve everything..). |
51 |
|
52 |
When I need to change the size of one or more filesystems, then |
53 |
I use dump/restore (for ext2/3 filesystem) or rsync for Unix |
54 |
based systems. |
55 |
|
56 |
Regards, |
57 |
DigbyT |
58 |
|
59 |
On Fri, Nov 11, 2005 at 02:50:22PM -0800, maxim wexler wrote: |
60 |
> Hello everyone, |
61 |
> |
62 |
> Just received a new, unformatted SATA 120G HD with the |
63 |
> intention of moving my entire gentoo OS over to it |
64 |
> from a flaky 120G ATA drive(reiserfs). Hopefully, I |
65 |
> can just boot up from the new drive as if nothing had |
66 |
> changed. |
67 |
> |
68 |
> Can anybody recommend any tool(s) for the job? |
69 |
> Gotchas? Does SATA prefer a certain fs? |
70 |
> |
71 |
> -mw |
72 |
> |
73 |
> |
74 |
> |
75 |
> __________________________________ |
76 |
> Yahoo! FareChase: Search multiple travel sites in one click. |
77 |
> http://farechase.yahoo.com |
78 |
> -- |
79 |
> gentoo-user@g.o mailing list |
80 |
|
81 |
-- |
82 |
Digby R. S. Tarvin digbyt@××××××.com |
83 |
http://www.digbyt.com |
84 |
-- |
85 |
gentoo-user@g.o mailing list |