Both grub4dos and grub4UEFI can't see partitions beyond a deleted partition on GPT drives
Mythenadia opened this issue · 7 comments
Please bear with me. It's been years since I've posted here.
Both grub4dos and grub4UEFI can't see partitions beyond a deleted partition on GPT drives.
Take a drive with a GPT partition table and create 5 partitions on it.
Install grub4dos or grub4UEFI on the first partition (hd0,0) and boot it.
From a grub4dos command line, the "find" command returns:
(hd0,0)
(hd0,1)
(hd0,2)
(hd0,3)
(hd0,4)
Next, delete the 3rd partition (hd0,2) and reboot grub4dos.
From a grub4dos command line, the "find" command now returns:
(hd0,0)
(hd0,1)
No attempts to access (hd0,3) or (hd0,4), which still exist, from grub4dos are successful.
Is this a bug in grub4dos/grub4UEFI?
Can anyone else reproduce this?
Should grub4dos scan all 128 GPT partition table entries to find partitions?
How to delete it, please explain in detail
In more detail:
Boot a live Linux distro from USB (I used Porteus in this example).
Run gparted.
Set up a GPT partition table on a hard drive.
Create 5 partitions on the hard drive, sda1 thru sda5.
Make the first partition grub4dos-compatible, like fat16 or fat32.
The partition types of the remaining 4 partitions does not matter (I used ext2).
Install grub4dos on the first partition and make it bootable (I copied over grub4dos files, ran bootlace.com, and made sure a grub4dos command line option existed in menu.lst).
Shut down Linux.
Boot the hard drive (grub4dos) and go to the grub4dos command line.
The "find" command returns:
(hd0,0)
(hd0,1)
(hd0,2)
(hd0,3)
(hd0,4)
Shut down grub4dos and reboot Linux from USB.
Run gparted and delete the third partition (sda3 in Linux, (hd0,2) in grub4dos).
In Linux you can still see and mount the remaining 4 partitions:
sda1
sda2
sda4
sda5
Shut down Linux and boot the hard drive (grub4dos) as before.
The "find" command from a grub4dos command line returns only:
(hd0,0)
(hd0,1)
The still-existing partitions (hd0,3) and (hd0,4) are not visible.
There is no problem using DiskGenius to delete partitions.
Perhaps gparted is not working properly, it deleted partition item 3 and did not move partition items 4 and 5 earlier, forming a hole.
There is no problem using DiskGenius to delete partitions. Perhaps gparted is not working properly, it deleted partition item 3 and did not move partition items 4 and 5 earlier, forming a hole.
Lines 769 to 795 in f036076
If an empty partition entry is encountered, it should be skipped instead of ending the search until the number of partitions matches the number of partitions recorded in the GPT header.
判断逻辑是有点问题。windows下删除分区会移动后面的分区项。
可以修复。
一般是扩大缩小分区,或者格式化分区,不清楚删除分区为哪般。
Is moving subsequent partition entries down after deleting a partition in the middle a requirement of the GPT specification?
This is not clear. But Linux adaptation and Windows development projects are strange and innovative.