public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Disk migration boot loader not found
@ 2012-08-25 11:13 Florian Philipp
  2012-08-25 20:29 ` Mick
  2012-08-26 12:32 ` Florian Philipp
  0 siblings, 2 replies; 8+ messages in thread
From: Florian Philipp @ 2012-08-25 11:13 UTC (permalink / raw
  To: Gentoo User List

[-- Attachment #1: Type: text/plain, Size: 1978 bytes --]

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)")

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.

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?

Thanks in advance!
Florian Philipp


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Disk migration boot loader not found
  2012-08-25 11:13 [gentoo-user] Disk migration boot loader not found Florian Philipp
@ 2012-08-25 20:29 ` Mick
  2012-08-25 21:07   ` Florian Philipp
  2012-08-26 12:32 ` Florian Philipp
  1 sibling, 1 reply; 8+ messages in thread
From: Mick @ 2012-08-25 20:29 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: Text/Plain, Size: 2855 bytes --]

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 ...  :-/


> 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.

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.

> 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.

-- 
Regards,
Mick

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Disk migration boot loader not found
  2012-08-25 20:29 ` Mick
@ 2012-08-25 21:07   ` Florian Philipp
  2012-08-25 21:41     ` Mick
  0 siblings, 1 reply; 8+ messages in thread
From: Florian Philipp @ 2012-08-25 21:07 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 3691 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Disk migration boot loader not found
  2012-08-25 21:07   ` Florian Philipp
@ 2012-08-25 21:41     ` Mick
  0 siblings, 0 replies; 8+ messages in thread
From: Mick @ 2012-08-25 21:41 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: Text/Plain, Size: 556 bytes --]

On Saturday 25 Aug 2012 22:07:42 Florian Philipp wrote:

> `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).

No, I do have a separate /boot partition:

# df -h | grep /boot
/dev/sda10       46M   22M   22M  50% /boot


and I also have the symlink:

# ls -la /boot | grep boot
lrwxrwxrwx  1 root root       1 Feb 27  2010 boot -> .

-- 
Regards,
Mick

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Disk migration boot loader not found
  2012-08-25 11:13 [gentoo-user] Disk migration boot loader not found Florian Philipp
  2012-08-25 20:29 ` Mick
@ 2012-08-26 12:32 ` Florian Philipp
  2012-08-26 14:32   ` Hinnerk van Bruinehsen
  1 sibling, 1 reply; 8+ messages in thread
From: Florian Philipp @ 2012-08-26 12:32 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2873 bytes --]

Am 25.08.2012 13:13, schrieb Florian Philipp:
> 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)")
> 
> 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.
> 
> 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?
> 
> Thanks in advance!
> Florian Philipp



Turns out, I was wrong in thinking the immediate problem was solved. In
fact, the system just booted of the memory stick without me noticing.
I've now finally solved by re-creating the boot partition without
MiB-alignment, just good old cfdisk. So, the working partition scheme
looks like this:

Number  Start   End     Size    Type      File system     Flags
 1      32.3kB  316MB   316MB   primary   ext2            boot
 2      316MB   750GB   750GB   extended
 5      317MB   424MB   107MB   logical   ext2
 6      425MB   22.4GB  22.0GB  logical   ext3
 7      22.4GB  28.9GB  6441MB  logical   linux-swap(v1)
 8      28.9GB  750GB   721GB   logical

Is there an explanation for this?

Regards,
Florian Philipp


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Disk migration boot loader not found
  2012-08-26 12:32 ` Florian Philipp
@ 2012-08-26 14:32   ` Hinnerk van Bruinehsen
  2012-08-26 15:58     ` Mick
  0 siblings, 1 reply; 8+ messages in thread
From: Hinnerk van Bruinehsen @ 2012-08-26 14:32 UTC (permalink / raw
  To: gentoo-user

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 26.08.2012 14:32, Florian Philipp wrote:
> Am 25.08.2012 13:13, schrieb Florian Philipp:
<SNIP>
>> 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
>> 
<SNIP>
> Turns out, I was wrong in thinking the immediate problem was
> solved. In fact, the system just booted of the memory stick without
> me noticing. I've now finally solved by re-creating the boot
> partition without MiB-alignment, just good old cfdisk. So, the
> working partition scheme looks like this:
> 
> Number  Start   End     Size    Type      File system     Flags 1
> 32.3kB  316MB   316MB   primary   ext2            boot 2      316MB
> 750GB   750GB   extended 5      317MB   424MB   107MB   logical
> ext2 6      425MB   22.4GB  22.0GB  logical   ext3 7      22.4GB
> 28.9GB  6441MB  logical   linux-swap(v1) 8      28.9GB  750GB
> 721GB   logical
> 
> Is there an explanation for this?
> 

Hi there,

if my eye-integrated diff doesn't deceive me the problem was, that
your old bootpartition was ntfs. Since grub doesn't support ntfs
that's an easy explanation.
Your boot partition is the first one on the drive, isn't it?

WKR
Hinnerk

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJQOjN3AAoJEJwwOFaNFkYclu4IALAP/vyTUTiDolDjGyo2CBAH
T3dWl+9nw482HKdISpHyki9MzwMc/ObMokdpmwY4e1RrReCorHK5jCGxBQTa1wpo
C4l+aTPCsAhnZDMWKcJeL/EMB4dZeKVFEG2JxISJvBxFVrUcyzuv384+Dk/5UehE
/Do6kDALnnmhk3b6X13xlrj9dQOQ6S0S5940Qz6DfN4FtedDnkZrVr0csCTWwl5q
eWom3D8jpUul4hqvnRzTh6Er89ORWfDCcARBXSYNiAmp6lawUMa7dF8mIO5P6cB/
Viv0qE/myxGnvezlH745NEneGyuPSePEz4G9Qya3e5MYV7zmE4CU2DUcUEiebSw=
=IwzC
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Disk migration boot loader not found
  2012-08-26 14:32   ` Hinnerk van Bruinehsen
@ 2012-08-26 15:58     ` Mick
  2012-08-26 16:33       ` Florian Philipp
  0 siblings, 1 reply; 8+ messages in thread
From: Mick @ 2012-08-26 15:58 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: Text/Plain, Size: 1893 bytes --]

On Sunday 26 Aug 2012 15:32:23 Hinnerk van Bruinehsen wrote:
> On 26.08.2012 14:32, Florian Philipp wrote:
> > Am 25.08.2012 13:13, schrieb Florian Philipp:
> <SNIP>
> 
> >> 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
> 
> <SNIP>
> 
> > Turns out, I was wrong in thinking the immediate problem was
> > solved. In fact, the system just booted of the memory stick without
> > me noticing. I've now finally solved by re-creating the boot
> > partition without MiB-alignment, just good old cfdisk. So, the
> > working partition scheme looks like this:
> > 
> > Number  Start   End     Size    Type      File system     Flags 1
> > 32.3kB  316MB   316MB   primary   ext2            boot 2      316MB
> > 750GB   750GB   extended 5      317MB   424MB   107MB   logical
> > ext2 6      425MB   22.4GB  22.0GB  logical   ext3 7      22.4GB
> > 28.9GB  6441MB  logical   linux-swap(v1) 8      28.9GB  750GB
> > 721GB   logical
> > 
> > Is there an explanation for this?
> 
> Hi there,
> 
> if my eye-integrated diff doesn't deceive me the problem was, that
> your old bootpartition was ntfs. Since grub doesn't support ntfs
> that's an easy explanation.
> Your boot partition is the first one on the drive, isn't it?

Originally the boot partition was on /dev/sda5 which was partitioned as ext2.

Was this legacy GRUB Florian?  (TBH I'm not sure that it would make a 
difference.  I can boot here fine from logical non-MiB aligned partitions with 
legacy GRUB.)
-- 
Regards,
Mick

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Disk migration boot loader not found
  2012-08-26 15:58     ` Mick
@ 2012-08-26 16:33       ` Florian Philipp
  0 siblings, 0 replies; 8+ messages in thread
From: Florian Philipp @ 2012-08-26 16:33 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1986 bytes --]

Am 26.08.2012 17:58, schrieb Mick:
> On Sunday 26 Aug 2012 15:32:23 Hinnerk van Bruinehsen wrote:
>> On 26.08.2012 14:32, Florian Philipp wrote:
>>> Am 25.08.2012 13:13, schrieb Florian Philipp:
>> <SNIP>
>>
>>>> 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
>>
>> <SNIP>
>>
>>> Turns out, I was wrong in thinking the immediate problem was
>>> solved. In fact, the system just booted of the memory stick without
>>> me noticing. I've now finally solved by re-creating the boot
>>> partition without MiB-alignment, just good old cfdisk. So, the
>>> working partition scheme looks like this:
>>>
>>> Number  Start   End     Size    Type      File system     Flags 1
>>> 32.3kB  316MB   316MB   primary   ext2            boot 2      316MB
>>> 750GB   750GB   extended 5      317MB   424MB   107MB   logical
>>> ext2 6      425MB   22.4GB  22.0GB  logical   ext3 7      22.4GB
>>> 28.9GB  6441MB  logical   linux-swap(v1) 8      28.9GB  750GB
>>> 721GB   logical
>>>
>>> Is there an explanation for this?
>>
>> Hi there,
>>
>> if my eye-integrated diff doesn't deceive me the problem was, that
>> your old bootpartition was ntfs. Since grub doesn't support ntfs
>> that's an easy explanation.
>> Your boot partition is the first one on the drive, isn't it?
> 
> Originally the boot partition was on /dev/sda5 which was partitioned as ext2.
> 

Right.

> Was this legacy GRUB Florian?  (TBH I'm not sure that it would make a 
> difference.  I can boot here fine from logical non-MiB aligned partitions with 
> legacy GRUB.)

Right again.

Regards,
Florian Philipp


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-08-26 16:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-25 11:13 [gentoo-user] Disk migration boot loader not found Florian Philipp
2012-08-25 20:29 ` Mick
2012-08-25 21:07   ` Florian Philipp
2012-08-25 21:41     ` Mick
2012-08-26 12:32 ` Florian Philipp
2012-08-26 14:32   ` Hinnerk van Bruinehsen
2012-08-26 15:58     ` Mick
2012-08-26 16:33       ` Florian Philipp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox