1 |
Am 25.08.2012 22:29, schrieb Mick: |
2 |
> On Saturday 25 Aug 2012 12:13:41 Florian Philipp wrote: |
3 |
>> Hi list! |
4 |
>> |
5 |
>> I've just completed migrating my system from one hard disk to another. |
6 |
>> Although the new disk reports 512 byte blocks just like the old one, I |
7 |
>> thought it would be a good idea to re-align the partitions anyway. I've |
8 |
>> done it this way: |
9 |
>> |
10 |
>> 1. Create new partitions with gparted, at least as large as the old ones |
11 |
>> (rounded up to full MiB). |
12 |
>> |
13 |
>> 2. `dd` from the old to the new disk. |
14 |
>> |
15 |
>> 3. `resize2fs` to match the new sizes. |
16 |
>> |
17 |
>> 4. Install grub ("root (hd1,4); setup (hd1); setup (hd1,4)") |
18 |
> |
19 |
> Why did you run setup twice? Once to install to the MBR of the second disk |
20 |
> and once to install on the boot record of the 5th partition ... :-/ |
21 |
> |
22 |
|
23 |
Probably cargo cult. I tried it without this, to no avail. |
24 |
|
25 |
> |
26 |
>> 4. Swap disks and reboot. |
27 |
>> |
28 |
>> Unfortunately, the system failed to find the boot loader. There was no |
29 |
>> grub error. The disk was simply skipped, as if it was unformatted. |
30 |
>> |
31 |
>> The following steps were taken: |
32 |
>> |
33 |
>> 1. Verified that the `dd`ed partitions were sane. |
34 |
>> |
35 |
>> 2. Reinstalled grub from live-CD chroots several times. |
36 |
>> |
37 |
>> 3. Installed grub on a memory stick and booted from that. |
38 |
>> |
39 |
>> At this point, my partition table looked like this: |
40 |
>> |
41 |
>> Number Start End Size Type File system Flags |
42 |
>> 1 1049kB 316MB 315MB primary ntfs |
43 |
>> 2 316MB 750GB 750GB extended |
44 |
>> 5 317MB 424MB 107MB logical ext2 boot |
45 |
>> 6 425MB 22.4GB 22.0GB logical ext3 |
46 |
>> 7 22.4GB 28.9GB 6441MB logical linux-swap(v1) |
47 |
>> 8 28.9GB 750GB 721GB logical |
48 |
>> |
49 |
>> The first logical partition was the boot partition. The first primary |
50 |
>> partition was a laptop-specific recovery partition. This setup was |
51 |
>> identical to the old one except that I removed a primary partition which |
52 |
>> resided /after/ the end of the extended partition. |
53 |
> |
54 |
> You didn't need to remove it. You could have entered x (extra functionality) |
55 |
> and then f (fix partition order). Write the new table and run partprobe to |
56 |
> see what the kernel sees the partitions as now. |
57 |
> |
58 |
|
59 |
I failed to make myself clear: I didn't create a corresponding partition |
60 |
on the new disk because the content of the old partition was no longer |
61 |
required. The whole "primary partition after extended one" business was |
62 |
there just because HP was brain dead enough to format the disk with 4 |
63 |
primary partitions for Windows and recovery. Needless to say, I wasn't |
64 |
to thrilled when I tried to install Gentoo on it :-/ |
65 |
|
66 |
> Another thing to check is what grub sees: |
67 |
> |
68 |
> grub> find /boot/grub/stage1 |
69 |
> (hd0,9) |
70 |
> |
71 |
> The above is from a laptop of mine, where the linux boot partition is on |
72 |
> partition 10. |
73 |
> |
74 |
|
75 |
Tried that. |
76 |
|
77 |
`find /boot/grub/stage1` -> File not found |
78 |
`find /grub/stage1` -> "(hd0,4)" (which is correct). I understand the |
79 |
difference arises because I have a separate boot partition and you don't |
80 |
(or maybe a symlink /boot/boot -> /boot). |
81 |
|
82 |
>> At this point, I've reformatted the first primary partition as ext2 and |
83 |
>> moved boot to this partition. This solved my problem. |
84 |
>> |
85 |
>> Now, my question is: Why does this work and the old solution doesn't? |
86 |
>> Why can't grub boot from a logical partition when it's MiB-aligned? I've |
87 |
>> changed nothing that should affect the MBR. Then why wasn't at least the |
88 |
>> stage 1 detected? |
89 |
> |
90 |
> I've got at least 4 machines with logical boot partitions and all boot fine. |
91 |
> Mind you though, the partition order is correct on all of them. I don't know |
92 |
> if that had something to do with it. |
93 |
> |