[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Grub rescue mode after removing extended partition in MBR
From: |
유혁 |
Subject: |
Grub rescue mode after removing extended partition in MBR |
Date: |
Thu, 6 Dec 2018 10:58:02 +0900 |
Hello, My name is Hyuck.
Recently, I install ubuntu in MBR, and the firmware is BIOS.
I already uses 7 partitions in MBR (3 primary, 4 extended I think), so I
install Ubuntu in /dev/sda8.
It works well until I remove one of the extended partition.
I removed /dev/sda7 which is ext4 partition, then system moves /dev/sda8 to
/dev/sda7 automatically.
After rebooting grub goes to rescue mode.
When I type “set” in rescue mode, then it shows
- Root=hd0,msdos8
- prefix=(hd0,msdos8)/boot/grub
When I type ls, then it shows
- (hd0) (hd0,msdos7) … (hd0,msdos1)
I know the reason why it goes to grub rescue, because it can’t find the root,
prefix location.
When I see the code of grub, I found grub-core find the bootlocation in
somewhere.
(I don’t understand fully, but in the code
$git/grub-core/kern/i386/pc/init.c:69, it finds boot_drive, dos_part with
grub_boot_device.
Grub_boot_device is a variable declared in
$git/grub-core/kern/i386/pc/startup.S. I can’t follow more, so I can’t strongly
said where it came from ☹)
I think it will be core.img, because
- When I see the site:
https://www.slideshare.net/MikeWang45/grub2-booting-process, it said core.img
has information about boot drive, boot dev.
Anyway, I can boot ubuntu in
- Rescue shell with setting variable
- Re-install grub in /dev/sda
I think, If grub-core finds the booting device with uuid (which may be saved in
core.img), then this can be fixed.
Therefore, is there any way to setting prefix and root with uuid instead of
(hdX, msdosY) so that booting can process smoothly even if former extended
partition is removed?!
I think I should find the way to insert uuid into core.img. (And grub-core
should support uuid finding)
Or do you have any idea to solve this problem??
Thanks.
Best Regards,
Hyuck
- Grub rescue mode after removing extended partition in MBR,
유혁 <=