Am 25.08.2012 22:29, schrieb Mick:
> On Saturday 25 Aug 2012 12:13:41 Florian Philipp wrote:
>> Hi list!
>>
>> I've just completed migrating my system from one hard disk to another.
>> Although the new disk reports 512 byte blocks just like the old one, I
>> thought it would be a good idea to re-align the partitions anyway. I've
>> done it this way:
>>
>> 1. Create new partitions with gparted, at least as large as the old ones
>> (rounded up to full MiB).
>>
>> 2. `dd` from the old to the new disk.
>>
>> 3. `resize2fs` to match the new sizes.
>>
>> 4. Install grub ("root (hd1,4); setup (hd1); setup (hd1,4)")
> 
> Why did you run setup twice?  Once to install to the MBR of the second disk 
> and once to install on the boot record of the 5th partition ...  :-/
>

Probably cargo cult. I tried it without this, to no avail.

> 
>> 4. Swap disks and reboot.
>>
>> Unfortunately, the system failed to find the boot loader. There was no
>> grub error. The disk was simply skipped, as if it was unformatted.
>>
>> The following steps were taken:
>>
>> 1. Verified that the `dd`ed partitions were sane.
>>
>> 2. Reinstalled grub from live-CD chroots several times.
>>
>> 3. Installed grub on a memory stick and booted from that.
>>
>> At this point, my partition table looked like this:
>>
>> Number  Start   End     Size    Type      File system     Flags
>>  1      1049kB  316MB   315MB   primary   ntfs
>>  2      316MB   750GB   750GB   extended
>>  5      317MB   424MB   107MB   logical   ext2            boot
>>  6      425MB   22.4GB  22.0GB  logical   ext3
>>  7      22.4GB  28.9GB  6441MB  logical   linux-swap(v1)
>>  8      28.9GB  750GB   721GB   logical
>>
>> The first logical partition was the boot partition. The first primary
>> partition was a laptop-specific recovery partition. This setup was
>> identical to the old one except that I removed a primary partition which
>> resided /after/ the end of the extended partition.
> 
> You didn't need to remove it.  You could have entered x (extra functionality) 
> and then f (fix partition order).  Write the new table and run partprobe to 
> see what the kernel sees the partitions as now.
> 

I failed to make myself clear: I didn't create a corresponding partition
on the new disk because the content of the old partition was no longer
required. The whole "primary partition after extended one" business was
there just because HP was brain dead enough to format the disk with 4
primary partitions for Windows and recovery. Needless to say, I wasn't
to thrilled when I tried to install Gentoo on it :-/

> Another thing to check is what grub sees:
> 
> grub> find /boot/grub/stage1
>  (hd0,9)
> 
> The above is from a laptop of mine, where the linux boot partition is on 
> partition 10.
> 

Tried that.

`find /boot/grub/stage1` -> File not found
`find /grub/stage1` -> "(hd0,4)" (which is correct). I understand the
difference arises because I have a separate boot partition and you don't
(or maybe a symlink /boot/boot -> /boot).

>> At this point, I've reformatted the first primary partition as ext2 and
>> moved boot to this partition. This solved my problem.
>>
>> Now, my question is: Why does this work and the old solution doesn't?
>> Why can't grub boot from a logical partition when it's MiB-aligned? I've
>> changed nothing that should affect the MBR. Then why wasn't at least the
>> stage 1 detected?
> 
> I've got at least 4 machines with logical boot partitions and all boot fine.  
> Mind you though, the partition order is correct on all of them.  I don't know 
> if that had something to do with it.
> 


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to