chenall/grub4dos

GRUB4DOS UEFI does not recognize all partitions in GPT HDD/SSD and ISO formats

nvcdhl1975 opened this issue · 40 comments

Thank the developers for your effort

I have used GRUB4DOS legacy to boot ISO files that stored in USB flash drive (NTFS file system). It boot successfully into ISO live CD/DVD (Linux and Windows)

But when I use GRUB4DOS UEFI (2023-11-29) with same MENU.LST (has been changed the suitable path for ISO files) to boot ISO files that stored in HDD/SSD drive, it is failed to boot. The HDD/SSD partition types is GPT with NTFS file system. GRUB4DOS UEFI can mount the first NTFS partition only, others NTFS partition can not be recognized. And the ISO files can not be loaded although the ISO files can be loaded by GRUB4DOS legacy.

WIN10-0
WIN10-1
WIN10-2
WIN10-3
WIN10-4

Please make some changes for GRUB4DOS UEFI (2023-11-29):

  1. To mount ALL NTFS partitions on GPT HDD/SDD.
  2. To load ISO file correctly as same as GRUB4DOS legacy

Boot the system using 'GRUB4DOS legacy'.
Execute 'geometry (hd0)' on the command line.
Execute 'root (hd0,3)' on the command line.
Execute 'root (hd0,5)' on the command line.
Start windows 10 mini on partition (hd0,3) and see if it succeeds.

Hi yaya2002
Following your instruction, I have used GRUB4DOS legacy to boot ISO files on my HDD
No luck, same as GRUB4DOS UEFI the GRUB4DOS legacy 0.46a (2023-11-27) did not detect all of partitions in HDD (GPT partition table)
I have checked HDD by GEOMETRY command and the results is same as GRUB4DOS UEFI. In the attached picture, HDD is (hd1) because I use USB drive (hd0) to boot my system to check all partitions table of my HDD
Now I understand that, I can use GRUB4DOS legacy to boot ISO files successfully because the ISO files were stored in the first partition of my USB which can be detect by both GRUB4DOS UEFI the GRUB4DOS legacy, other partitions may not be detected

ba072201948c3fd2669d

Boot the system using 'GRUB4DOS legacy'.
Execute 'geometry (hd1)' on the command line.
Execute 'root (hd1,3)' on the command line.
Execute 'root (hd1,5)' on the command line.
Start windows 10 mini on partition (hd1,3) and see if it succeeds.

Hi yaya2002

I have tried GRUB4DOS UEFI with MENU.LST

color light-green/black light-red/black white/black white/black
timeout 30
default /default

title Windows 10 Mini (64bit)
map --mem (hd0,3)/LIVE1064.ISO (0xff)
map --hook
chainloader (0xff)
boot

title Ubuntu 22 (64bit)
map --mem (hd0,3)/UBT2204.ISO (0xff) || map --heads=0 --sectors-per-track=0 (hd0,3)/UBT2204.ISO (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity iso-scan/filename=(hd0,3)/UBT2204.ISO quiet splash ---
initrd /casper/initrd

title Reboot System
reboot

title Halt System
halt

It is OK to boot into both WinPE and Live UBUNTU
But when I execute 'root (hd0,5)' on the command line as your instruction, GRUB4DOS UEFI give an error message "CANNOT MOUNT SELECTED PARTITION".
GRUB4DOS UEFI has been installed on my HDD.

With GRUB4DOS legacy installed on my USB drive, I have tried same steps and get same results, only change parameters (hd0) to (hd1) because ISO files were stored on my HDD

Execute 'root (hd1,3)' on the command line.
Start windows 10 mini on partition (hd1,5) and see if it succeeds.

Can I intercept the PBR of (hd1,3) and (hd1,5) partitions, that is, the boot sector, and intercept 4 sectors.

Hi yaya 2007

Following your instruction, I tried to boot WinPE on partition (hd1,5). No luck

dff6ea05b8ba13e44aab

I don't have conditional testing here. Please help me test it and provide screenshots for feedback.
Execute on the command line: root (hd0,5).
grldr.rar.txt

Hi yaya2007,
Because you attached legacy version (not UEFI version) of GRUB4DOS, so I have tested it on USB drive to boot.
The USB drive is (hd0), the HDD drive is (hd1)
The 1st picture shows the results after executing of the command GEOMETRY
The 2nd picture shows the results after executing of the command ROOT
The 3rd picture shows the results after executing of the command MAP ISO file
01
02
03

There is a problem with the BPB table of the (hd1,5) partition table.
The number of sectors per track is 0.Usually 0x3f.
Give it another try.
grldr.rar.txt

Hi yaya2007,
After trying your copy of GRUB4DOS, the pictures bellow are the results

  • geometry hd(1)
  • root hd(1,5)
  • map hd(1,5)/BACKUP/INSTALL/LIVE1064.ISO (0xff)

01
03
04

correct: (hd1,5)
error: hd(1,5)

correct: (hd1,5)
error: hd(1,5)

Please test again

Hi yaya2007,
Please see the pictures for the results

geometry (hd1) - pictures 1 & 2
root (hd1,5) - picture 3 - this command makes my computer freeze. I have to press CTRL+ALT+DEL to restart
map (hd1,5)/BACKUP/INSTALL/LIVE1064.ISO (0xff) - pictures 4 & 5
chainloader (0xff) - pictures 6
boot - pictures 6

01
02
03
04
05
06

Can we copy the logical 0 sector of the (hd1,5) (hd1,4) partition? The first sector contains BPB

Hi yaya2007
I have taken long time to get knowledge of BPB, but not successfully.
Can you tell me what is BPB and how to get it

Install WINHEX on your computer. Learn simple usage methods. Then we can interact. I ask you to start copying from a certain byte, and copy and upload as many bytes as you want.

This is a dull and boring thing. If you can do it and are interested, let's work together to complete it. Otherwise, let's give up.

Hi yaya2007,

I have no intention to give up.
I downloaded WINHEX, please give me the instruction to continue

Clip

Open the disk in Winhex, find your test disk, copy 0x2000 bytes from logical sector 0 to 0. bin, then rename it to 0. bin. txt, and upload it here.

Hi yaya2007

As your instruction, I have copied some bin files and attached into this post. I do not know whether I did correctly or not.
If I am wrong please tell me how to do again

Clip
Partition1.bin.txt
Partition2.bin.txt
Partition3.bin.txt
Partition4.bin.txt
Partition5.bin.txt
Partition6.bin.txt
StartSector.bin.txt

The screenshot is very good!

partitions 4 and 5 have issues:

  1. offset 0x18 Number of sectors per track, Usually 0x3f, Actual value is 0.
  2. offset 0x1A Number of magnetic heads, Usually 0xff, Actual value is 0.
  3. offset 0x1C Starting sector of partition, Actual value is 0.

Excuse me, what program was used to format these two partitions?

map (hd1,5)/BACKUP/INSTALL/LIVE1064.ISO (0xff) - pictures 4 & 5 chainloader (0xff) - pictures 6 boot - pictures 6

Should be:
map (hd1,5)/BACKUP/INSTALL/LIVE1064.ISO (0xff)
//The following line must exist for G4D; For G4E, it can be omitted.
map --hook
chainloader (0xff)
boot

Please retest it

Hi yaya2007

I used Macrorit Partition Expert 5.1 to create and format them

Following your instruction, I used Windows Explorer to these partitions. Both versions of GRUB4DOS Legacy and UEFI can recognize them. Now I can boot ISO successfully files from HDD directly.

map (hd0,5)/BACKUP/INSTALL/LIVE1064.ISO (0xff)
map --hook
chainloader (0xff)
boot

I attached 2 binary files of these partitions formatted by Windows Explorer.

Partition5_2.bin.txt
Partition6_2.bin.txt

Thank you very much for helping

The errors in partitions 4 and 5 have been fixed.
Value assigned at offset 0x18, 0x1A,0x1C.

There's a problem:
Using 'Macrorit Partition Expert 5.1' to format partition 3/4/5, why is only partition 4/5 incorrect and partition 3 correct?

Hi yaya2007

I do not know how it happened, I try Macrorit Partition Expert 8.1 and the result is same as version 5.1, so I have to use Windows Explorer to format these partitions

And there is another issue. When I use USB flash drive to boot Ubuntu 22.04 with ISO file stored in USB flash drive, G4D boot properly

title Ubuntu 22 (64bit)
fallback 3
find --set-root /EFI/BOOT/UBT2204.ISO
map /EFI/BOOT/UBT2204.ISO (0xff) || map --heads=0 --sectors-per-track=0 /EFI/BOOT/UBT2204.ISO (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity iso-scan/filename=/EFI/BOOT/UBT2204.ISO quiet splash ---
initrd /casper/initrd

But if ISO file was
stored in HDD, it fails. There are 3 cases to try, but same result, all fail

title Ubuntu 22 (64bit)
map (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff) || map --heads=0 --sectors-per-track=0 (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity iso-scan/filename=(hd1,5)/BACKUP/INSTALL/UBT2204.ISO quiet splash ---
initrd /casper/initrd

title Ubuntu 22 (64bit)
map (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff) || map --heads=0 --sectors-per-track=0 (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity iso-scan/filename=/UBT2204.ISO quiet splash ---
initrd /casper/initrd

title Ubuntu 22 (64bit)
map (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff) || map --heads=0 --sectors-per-track=0 (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity iso-scan/filename=UBT2204.ISO quiet splash ---
initrd /casper/initrd

01
02
03

Hi yaya2007

I do not know how it happened, I try Macrorit Partition Expert 8.1 and the result is same as version 5.1, so I have to use Windows Explorer to format these partitions

And there is another issue. When I use USB flash drive to boot Ubuntu 22.04 with ISO file stored in USB flash drive, G4D boot properly

title Ubuntu 22 (64bit) fallback 3 find --set-root /EFI/BOOT/UBT2204.ISO map /EFI/BOOT/UBT2204.ISO (0xff) || map --heads=0 --sectors-per-track=0 /EFI/BOOT/UBT2204.ISO (0xff) map --hook root (0xff) kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity iso-scan/filename=/EFI/BOOT/UBT2204.ISO quiet splash --- initrd /casper/initrd

But if ISO file was stored in HDD, it fails. There are 3 cases to try, but same result, all fail

title Ubuntu 22 (64bit) map (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff) || map --heads=0 --sectors-per-track=0 (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff) map --hook root (0xff) kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity iso-scan/filename=(hd1,5)/BACKUP/INSTALL/UBT2204.ISO quiet splash --- initrd /casper/initrd

title Ubuntu 22 (64bit) map (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff) || map --heads=0 --sectors-per-track=0 (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff) map --hook root (0xff) kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity iso-scan/filename=/UBT2204.ISO quiet splash --- initrd /casper/initrd

title Ubuntu 22 (64bit) map (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff) || map --heads=0 --sectors-per-track=0 (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff) map --hook root (0xff) kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity iso-scan/filename=UBT2204.ISO quiet splash --- initrd /casper/initrd

title Ubuntu 22 (64bit)
map (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff) || map --heads=0 --sectors-per-track=0 (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff)
map --hook root (0xff)
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity iso-scan/filename=/BACKUP/INSTALL/UBT2204.ISO quiet splash ---
initrd /casper/initrd

There is a clue in the name "iso-scan/filename" - it scans for the file on all devices. The path must be correct and must not have any spaces in it.
Also grub2 does not understand grub4dos disk naming.

Hi yaya2007
I am confused that with same version of G4D it can scan ISO file on USB but it cannot scan ISO file on HDD

A1ive provides a solution:
title Ubuntu 22 (64bit)
map (hd1,5)/BACKUP/INSTALL/UBT2204.ISO (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity iso-scan/filename=/BACKUP/INSTALL/UBT2204.ISO quiet splash ---
initrd /casper/initrd

Have you tested it yet? What was the result?

Hi yaya2007

Thank you very much for the solution. I can boot Ubuntu 22.04.1 ISO file on HDD which use 4.7GB DVD format.
Another issue appeared. Ubuntu 22.04.2 use format of 8.5GB DVD format, so G4D cannot mount this type of ISO file
I use Ultra ISO 9.6.5 to find out the different between Ubuntu 22.04.1 ISO file and Ubuntu 22.04.2 ISO file

9ae8acfd65f5c8ab91e4
Clip1
Clip2

Use the final GRLDR test with internal debugging code provided by me and provide feedback.

Use the final GRLDR test with internal debugging code provided by me and provide feedback.

Hi yaya2007

Please see the picture

9fad2fe4f7ee5ab003ff

File has too many fragments.
You must defrag the file. It is a limitation of grub4dos filesystem handler.
Just use Defraggler.exe and defrag the file.

Hi yaya2007

It is correct.
The issue has been solved after ISO file was defragged

good

Hi yaya007,
Can you give me instruction to compile G4D legacy and G4D UEFI from your source code
Thanks in advanced

Download the source code and compile it in a Linux environment.

Hi yaya007,
I have downloaded G4D source code and used Ubuntu 22.04 with GCC 11.4 to compile G4D.
It failed. I do not know why it happened. Please see the pictures and give me some advices
Thanks in advanced

Screenshot from 2024-03-30 17-47-54
Screenshot from 2024-03-30 17-51-28
Screenshot from 2024-03-30 17-51-46