Jump to content











Photo
- - - - -

grub4dos error 30: disk read error


  • Please log in to reply
55 replies to this topic

#26 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 28 October 2007 - 01:28 PM

try the build 2007-10-28 and see what will happen.

#27 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 28 October 2007 - 05:34 PM

try the build 2007-10-28 and see what will happen.


Following are the results (3 experimentations) :

1) with load-length
----
(hd0,0)
Filesystem type is fat, partition type 0x0e

probed C/H/S = 22/255/63, probed total sector = 353430
Invalid partition table

2) without load-length
----
(hd0,0)
Filesystem type is fat, partition type 0x0e

probed C/H/S = 22/255/63, probed total sector = 353430
LED activity, then blinking cursor


3) without load-length + mapmem
----
(hd0,0)
Filesystem type is fat, partition type 0x0e
Lot of LED activity then nothing else, blink cursor

#28 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 29 October 2007 - 02:52 AM

Compare

cat	--hex	--length=512	/erdc2005.img

with

map	/erdc2005.img	(hd0)

map	--hook

cat	--hex	(hd0)+1

and see if there are any differences.

You may also cat the whole file and try to find out anything abnormal, with this command:

cat	--hex	 /erdc2005.img

or for the latter case:

cat	--hex	(hd0)+353430

and you may also compare them with the hexdumps of a utility from the Windows/Linux side.

---------

would you like to do a further check, please create a pure dos image and see if the dos could boot well?

I suspect there is something wrong with your programs inside the image.

#29 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 18 November 2007 - 03:09 PM

Hello tinybit,

I am back, I started with new data, I think there are some new information you may want to look at.

I built a hard disk image (to put XP system in the future), using fsz, vdk and related tools.
For specialists, following are the usual commands and results.

fsz m:\xphdd.img 4120865280

xphdd.pln:
DRIVETYPE ide
CYLINDERS 501
HEADS 255
SECTORS 63
ACCESS "m:\xphdd.img" 0 8048565

vdk open 0 xphdd.pln /rw
ptedit32 0c 80 0 1 1 500 254 63 63 8048502
mbrfix /drive 2 fixmbr
vdk close 0
vdk open 0 xphdd.pln /rw
format fat32
then just copy ntldr/ntdetect.com/boot.ini to the disk
vdk close 0


Tests results:
1)

Test Under QEMU:

qemu -M pc -hda m:\xphdd.img -m 256 -localtime -net nic -L .

got blinking cursor



2)

Test on real machine, grldr old version 0.4.3pre2 2007-07-25, with standard MBR (mbrfix) in the xphdd.img

Error loading operating system

 

cet --hex --length=512 (hd0)+1

Error 30: disk read error



3)

Test on real machine, grldr new version 2007-10-28, with standard MBR (mbrfix) in the xphdd.img 

Invalid partition table 



3)

Test on real machine, grldr new version 2007-10-28, with grldr new version 2007-10-28 in the xphdd.img

 (hd0,0)

 Filesystem type is fat, partition type 0xc

FAT32 BPB found with 0xEB (jmp) leading the boot sector.

info: BPB total sectors(8048502) is less than the number of sectors in the whole disk image(8048565).



probed C/H/S = 501/255/63, probed total sectors = 8048502

Missing MBR-helper.



cat --hex --length=512 /xphdd.img

 got correct 33 c0 8e d0 ended with 55 AA, looks like MBR (1st physical sector)



map /xphdd.img (hd0)

probed C/H/S = 501/255/63, probed total sectors = 8048565



cat --hex --length=512 (hd0)+1

  got EB 5e 82 05 ended with 55 AA looks like boot sector (string Missing MBR-helper starting at offset 0x191)



geometry (hd0)

drvie 0x80(LBA) : C/H/S=9734/255/63, Sector Count/Size=156376710/512

   Partition num: 0, filesystem type is fat, partition type 0xc



blocklist (hd0,0)/xphdd.img  (note: this command takes a long time to anwser, maybe due to the size of the image, since lot of disk accesses)

  (hd0,0)62603480+8048565



cat --hex (hd0)+8048565

  got EB 5e 82 05 ended with 55 AA looks like boot sector (string Missing MBR-helper starting at offset 0x191)

  (same as with cat --hex (hd0)+1


There differences between the probed total sectors that could be the grub4dos problem.
Also cat --hex /xphdd.img is different from cat --hex (hd0)+1, should they are identical from tinybit's previous post ?

Same results with grub4dos 0.4.3-2008-11-18 (same version in both host system and disk image).

#30 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 18 November 2007 - 03:29 PM

@ktp

Actually unrelated, but since you are into experimenting, can you try using my MBRBATCH.cmd + MKIMG.cmd to build the image? :
http://www.boot-land...LPHA-t3191.html

It should be a more convenient way to do it as compared to the manual method.

I am also curious to have the batch tested for largish images like yours.

jaclaz

#31 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 18 November 2007 - 04:58 PM

@jaclaz

OK I tested mkimg.cmd version 3. Comments:

1) I put the image on FAT32 disk and use /fsz method. I got the following temporary files left:
xpfloppy.$$$
TMPDATA.$$$
echoon.com
These files probably need to be deleted at the end of the batch.

2)
I asked for FAT32-LBA (0x0c), but I got as final result 0x0b (FAT32) (checked with ptedit32).
Maybe the built-in XP formatter set it as 0x0b due to the disk size is a little less than 4 GB ?

MBRBATCH001: I did not use it since apparently mkimg.cmd do everything, the disk image already has the MBR set.

Otherwise the mkimg.cmd works well, the pln file is correctly created with right values.

#32 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 18 November 2007 - 05:12 PM

@jaclaz

OK I tested mkimg.cmd version 3. Comments:

1) I put the image on FAT32 disk and use /fsz method. I got the following temporary files left:
xpfloppy.$$$
TMPDATA.$$$
echoon.com
These files probably need to be deleted at the end of the batch.

2)
I asked for FAT32-LBA (0x0c), but I got as final result 0x0b (FAT32) (checked with ptedit32).
Maybe the built-in XP formatter set it as 0x0b due to the disk size is a little less than 4 GB ?

MBRBATCH001: I did not use it since apparently mkimg.cmd do everything, the disk image already has the MBR set.

Otherwise the mkimg.cmd works well, the pln file is correctly created with right values.


1) yes, these are just temporary files (that in later versions will be automatically deleted, you can delete them manually for the moment)
2) yes, in some cases 2K/XP format "automagically" changes partition type.

MBRBATCH: no, for the moment I wrote MKIMG as a separate application that actually CALLs MBRBTCH.cmd to use some functions, it will later be included in MBRBATCH.cmd ( or I can add the functions now inside MBRBATCH into MKIMG)

jaclaz

#33 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 22 November 2007 - 05:13 AM

@tinybit

Just to be sure you that you are aware I have new data for you in post #29. Thank you.

#34 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 22 November 2007 - 09:50 AM

Oh I am sorry I have not noticed your post in #29. Thanks for your reminding me.

I would like to start at case 3) in floor #29

FAT32 BPB found with 0xEB (jmp) leading the boot sector.
info: BPB total sectors(8048502) is less than the number of sectors in the whole disk image(8048565).


This shows xphdd.img is a partition image with MBR(I mean the first track, i.e., 63 sectors) stripped out, and there are more 63 sectors in the end of xphdd.img than needed(Note: 8048565 - 8048502 = 63). So xphdd.img is not an image for whole hard disk, but an image for a partition, or for a floppy. Thus, you should not map it to a hard drive with this:

map  /xphdd.img  (hd0)

But you may try mapping it to a floppy with this

map  /xphdd.img  (fd0)

Check your Image building procedure and make sure it is not jumbled.

#35 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 22 November 2007 - 11:30 AM

@tinybit
I rechecked my build procedure, no problem so far. I rebuilt a new image and retested. Still error message "Error loading operating system"
(string in the MBR code). The xphdd.img is not stripped out of 63 first sectors as you can see when mounting with vdk (and checked
with hdhacker/ptedit32 on the MBR).

fsz m:\xphdd.img 4120865280



vdk open 0 xphdd.pln /rw

ptedit32 0c 80 0 1 1 500 254 63 63 8048502

vdk close 0

vdk open 0 xphdd.pln /rw

mbrfix /drive 2 fixmbr

vdk close 0

vdk open 0 xphdd.pln /rw

format fat32 with XP

then just copy ntldr/ntdetect.com/boot.ini to the disk

vdk close 0

vdk remove



title XP HDD (hard disk image)

find --set-root /xphdd.img

map /xphdd.img (hd0)

chainloader /xphdd.img

rootnoverify (hd0)





Test on real machine, grldr version 0.4.3-2007-11-18, with standard MBR (mbrfix) in the xphdd.img

(hd0,0)

Filesystemtype is fat, partition type 0xc

probed C/H/S = 501/255/63,probed total sectors = 8048565

Error loading operating system



cat --hex --length=512 /xphdd.img

got correct 33 c0 8e d0 ended with 55 AA, looks like MBR (1st physical sector)





map /xphdd.img (hd0)

probed C/H/S = 501/255/63, probed total sectors = 8048565



geometry (hd0)

drvie 0x80(LBA) : C/H/S=16383/255/63, Sector Count/Size=263192895/512

   Partition num: 0, filesystem type is fat, partition type 0xc



Note : with previous grldr version 2007-10-28, the result is completely different:

geometry (hd0)

drvie 0x80(LBA) : C/H/S=9734/255/63, Sector Count/Size=156376710/512

   Partition num: 0, filesystem type is fat, partition type 0xc





cat --hex (hd0)+8048565

  got EB 5e 82 05 ended with 55 AA looks like boot sector (string Missing MBR-helper starting at offset 0x191)

  (same as with cat --hex (hd0)+1


vdk open 0 xphdd.pln /rw
Virtual Disk Driver for Windows version 3.1
http://chitchat.at.i...k.co.jp/vmware/

Installed the Virtual Disk Driver.
Started the Virtual Disk Driver.
Virtual Disk 0
Access Type : Writable
Disk Capacity : 8048565 sectors (3929 MB)
Geometry : © 501 * (H) 255 * (S) 63
Number Of Files : 1

Type Size Path
------- ------- ----
FLAT 8048565 m:\xphdd.img

Partitions :
# Start Sector Length in sectors Type
-- ------------ --------------------- ----
0 0 8048565 ( 3929 MB) <disk>
F: 1 63 8048502 ( 3929 MB) 0bh:FAT32

#36 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 25 November 2007 - 07:14 AM

Test with this sequence:

map &#40;hd0,0&#41;/xphdd.img &#40;hd0&#41;

map --hook

debug 0x7FFFFFFF

geometry &#40;hd0&#41;

cat --hex &#40;hd0&#41;+1

cat --hex &#40;hd0&#41;1+1

and post what will be displayed before 'cat'. For the last two cat commands, you only need to report whether or not they issue the error message "disk read error".

If geometry (hd0) runs before map --hook, then it reports the geometry of the original real (hd0).
If geometry (hd0) runs after map --hook, then it reports the geometry of the new virtual (hd0).

-------------

You may consider to test it with a 1.44M DOS floppy image, mapped as (fd0), and see if it could success.

#37 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 26 November 2007 - 03:40 PM

Tested with grub4dos version 0.4.3 2007-11-23
1) geometry (hd0) after map --hook
map (hd0,0)/xphdd.img (hd0)
map --hook
debug 0x7FFFFFFF

probed C/H/S=501/255/63, probed total sectors = 8048565
int13/41(80), version=AA210001,
int13/48(80), err=0, C/H/S=501/255/63, sector count/size=8048565/0,
int13/08(80), version=1, C/H/S=16383/255/63,
int13/02(80),err=1
Error 25: disk read error

2) geometry (hd0) before map --hook
map (hd0,0)/xphdd.img (hd0)
probed C/H/S=501/255/63, probed total sectors = 8048565
int13/41(80), version=AA300007,
int13/48(80), err=0, C/H/S=0/0/0, sector count/size=156368016/0,
int13/08(80), version=0, C/H/S=16383/255/63,
int13/02(80),err=0, drive 0x80(LBA) : c/H/S=16383/255/63, sector count/size=263192895/512
int13/08(80), version=0, c/h/s=9734/255/63
int13/02(0),err=0 partition num:0, filesystem type is fat, partition type 0xc

cat --hex (hd0)+1
cat --hex (hd0)1+1
output are different

Reminder: using
find --set-root /xphdd.img
map /xphdd.img (hd0)
chainloader /xphdd.img
rootnoverify (hd0)

I got "Error loading operating system" message.

#38 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 29 November 2007 - 11:00 AM

try the new build 2007-11-29.

#39 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 29 November 2007 - 03:07 PM

@tinybit
I tried the 2007-11-27 version.

First time I got my full menu.lst, then after press on boot of xphdd.img, it gives me a simplified menu.lst screen with only 3 items,
then it presents again my full menu.lst. This time I pressed againt the xphdd.img item and got:

(hd0,0)
Filesystem type is ntfs, partition type 0x7
probed c/h/s=501/255/63, probed total sectors=804565
Starting cmain() ...
then it hangs (blinking cursor)

Note : this time I put the xphdd.img on a NTFS disk, normally it should not be the problem.
For me it did not even starting to boot the image, otherwise I would have the grub/menu.lst inside the xphdd.img displayed
(with different color as I set it to distinguish which grub are active).

#40 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 30 November 2007 - 03:43 AM

it gives me a simplified menu.lst screen with only 3 items,


it might be a menu preset inside the grub4dos.

then it presents again my full menu.lst.


The preset-menu mentioned above can find the menu.lst file in your drive(s), and run the new menu.lst.

This time I pressed again the xphdd.img item


you should not run this again, since it will do the "map" a second time.

press c to enter command line, at the grub prompt, type

map --status

This will report the map status.

#41 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 30 November 2007 - 04:00 AM

@tinybit
Here are the results:

map --status

floppies_orig=1, harddrives_orig=2, floppies_curr=1, harddrives_curr=2

Number of ATAPI CD-ROMs&#58; 0

ram_drive=0x7F, rd_base=0x0, rd_size=0x0

Fr To Hm Sm To_C _H _S Start_lo Start_hi Count_lo Count_hi Hk

-- -- -- -- ---- -- -- -------- -------- -------- -------- --

80 80 FE 3F 83FF FE 7F 04DE811F 00000000 007ACFB5 00000000 01

Does this help?

#42 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 30 November 2007 - 06:31 AM

This shows a map command has been executed, and 'map --hook' not yet.

This is normal.

You can now run this list:

map --hook

chainloader &#40;hd0&#41;+1

rootnoverify &#40;hd0&#41;

boot

or this list

map --hook

chainloader &#40;hd0,0&#41;/io.sys

boot

or whatever you would like.


The (hd0) in the above list will be new virtual hard drive since the map is hooked.

#43 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 30 November 2007 - 07:33 AM

@tinybit
I tried this:

title XP HDD &#40;hard disk image&#41;

find --set-root /xphdd.img

map /xphdd.img &#40;hd0&#41;

map --hook

chainloader &#40;hd0&#41;+1

rootnoverify &#40;hd0&#41;

boot

Now I got "Missing MBR-helper." at "boot" directive. All previous directives are OK.

If I used:
title XP HDD &#40;hard disk image&#41;

find --set-root /xphdd.img

map /xphdd.img &#40;hd0&#41;

map --hook

chainloader &#40;hd0,0&#41;/ntldr

boot

I got missing or bad boot.ini. Inside the xphdd.img there IS a boot.ini and ntdtect/ntldr.
If I put a boot.ini in the root of the key then it find it: this shows that the problem is (hd0) is not mapped !
If after the map --hook command I used "find (hd0,0)/" then press Tab key I can see that
all files that grub4dos find is my real USB key files, not the ones inside the image!
So why did the map did not work?

#44 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 30 November 2007 - 09:14 AM

If after the map --hook command I used "find (hd0,0)/" then press Tab key I can see that
all files that grub4dos find is my real USB key files, not the ones inside the image!


Just at this moment, type the command:

map --status

and see if there are any maps.

#45 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 30 November 2007 - 09:52 AM

Well, after map --hook, map --status gives exactely same result as before:
map --status

floppies_orig=1, harddrives_orig=2, floppies_curr=1, harddrives_curr=2

Number of ATAPI CD-ROMs&#58; 0

ram_drive=0x7F, rd_base=0x0, rd_size=0x0

Fr To Hm Sm To_C _H _S Start_lo Start_hi Count_lo Count_hi Hk

-- -- -- -- ---- -- -- -------- -------- -------- -------- --

80 80 FE 3F 83FF FE 7F 04DE811F 00000000 007ACFB5 00000000 01

The output from chainloader (hd0,0)/ntldr is:
Will boot NTLDR from drive 0x80, partition=0x0(hidden sectors=0x3f)

And the find (hd0,0)/ followed by Tab key gives as said before only files on my real hard disk used to boot grub4dos.
The "boot" command then loads the ntldr/boot.ini from my real hard disk, not from inside the disk image xphdd.img.

#46 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 30 November 2007 - 11:08 AM

Notice the Hk value '01' in the status report. The first digit '0' indicates the map is currently not hooked. The second digit '1' means the map will be hooked after an execution of 'map --hook' command.

So you need to "map --hook" in case you did not do so.

Another possible issue might be here: NTLDR may work in protected mode. If NTLDR tries to find BOOT.INI in protected mode, then it will not use BIOS int13, and instead, it will use protected-mode driver for the drive, and it will use the real drive. Thus our virtual/emulated drive cannot function at all.

Try to install real-mode DOS into the image and see if the virtual drive works well.

If the above assumption of 'CPU mode' is proved to be true, then you may try the partnew command to build a partition table entry in the real (hd0), instead of emulation, for the image file. But this time the image must be a partition image(i.e., without an MBR track). A harddrive image with an MBR(or in another word, a partition table) should not be used in this way with the partnew command. See details in README about PARTNEW.

#47 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 30 November 2007 - 12:46 PM

@tinybit

OK things are clearer now with your explantions about CPU protected mode. I tried with a Win98 hard disk image, and it works. Normal now
since it uses io.sys which apparently use real mode. So the conclusion is that we cannot use hard disk image emulation for protected mode loader
like ntldr.

Curiously though, floppy disk emulation seems to work with ntldr. Have you an explanation, maybe no int13h involved in this case?

The partnew command seems to be very interesting, thank you for mentioning it, otherwise I would never discover its existence.
I need to read carefully its short documentation, I hope that it does not copy the entire image on the "simulated" partition ?
(otherwise why use the partition image ?). But it does seem that the real partition table is modified. Is it true? Maybe you can give
more details on this partnew command.

I will try to understand and experiment with partnew command.

Thanks for your time and support.

#48 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 30 November 2007 - 06:03 PM

From grub4dos readme about partnew command :

******************************************************************************

***					  The PARTNEW Command Syntax						***

******************************************************************************

 

Besides the mappings in the above section, you may instead choose to create a

new primary partition with the PARTNEW command. PARTNEW can generate a primary

partition entry &#40;in the partition table&#41; for a logical partition.

 

For example,

 

	partnew &#40;hd0,3&#41; 0x07 &#40;hd0,4&#41;+1

 

where the file &#40;hd0,4&#41;+1 stands for the whole partition &#40;hd0,4&#41;. This command

will create a new primary partition &#40;hd0,3&#41; whose type is 0x07 and whose

contents/data is the same as that of the logical partition &#40;hd0,4&#41;.

 

Just like a whole logical partition, a contiguous partition image file can

also be used with PARTNEW&#58;

 

	partnew &#40;hd0,3&#41; 0x00 &#40;hd0,0&#41;/my_partition.img

 

The type 0x00 indicates a type-auto-detection of the image MY_PARTITION.IMG.

The above command will create a new primary partition &#40;hd0,3&#41; with a proper

type and with contents/data being exactly that of the contiguous file

&#40;hd0,0&#41;/my_partition.img.

 

PARTNEW will automatically correct the &#34;hidden sectors&#34; in the BPB and the

modification will be permanent. And PARTNEW modifies the partition table

permanently.

It looks like one must use this command with special caution since it modifies the MBR.
Apparently it does a partition copy either from another partition or from a partition image file, isn't it?

#49 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 01 December 2007 - 02:02 AM

Bug in 2007-11-29 found! Please retry with 2007-12-01 for everything!

I am sorry I made a mistake in 2007-11-29, causing emulation failure!

-------------------------------------

About the PARTNEW:

PARTNEW does NOT copy anything. It only build a primary partition for the specified logical partition in the extended partition.

PARTNEW is also capable of building a primary partition for a contiguous file on the drive. The file's first sector will become the first sector of the newly created primary partition, and the file's size will become the size of the newly created primary partition.

Of course you should avoid overwriting any existing entry in the partition table. Only empty entries should be overwritten with PARTNEW.

The contiguous file will become the partition data. And this is why the file should not have a leading MBR.

#50 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 01 December 2007 - 07:29 AM

@tinybit
So far so good, the 2007-12-01 version did correct the problem.
I now got Hk (hook) status 11 instead of 01 previously.

map --status

floppies_orig=1, harddrives_orig=2, floppies_curr=1, harddrives_curr=2

Number of ATAPI CD-ROMs&#58; 0

ram_drive=0x7F, rd_base=0x0, rd_size=0x0

Fr To Hm Sm To_C _H _S Start_lo Start_hi Count_lo Count_hi Hk

-- -- -- -- ---- -- -- -------- -------- -------- -------- --

80 80 FE 3F 83FF FE 7F 04DE811F 00000000 007ACFB5 00000000 11

Also, after map --hook
find (hd0,0)/ followed by Tab key did now give me the files INSIDE the xphdd.img disk image!

Now the disk image boots OK, I need to make furthur experimentations on real/protected mode loader/software involved, but at least
grub4dos has done its job at this point. I will report later new findings.

For partnew, it is confusing for me:

It only build a primary partition for the specified logical partition in the extended partition.

For me, extended partition is a primary partition. Its hosts multiple other logical partitions.
So I need to create an extended partition with let's say one unique logical partition inside it before parnew command?
Or I only must have unallocated space, and let partnew create the extended partition + logical partition from disk image (which should be
without MBR) ? Since there is no copy, for me it still will be a kind of mapping of the image file to the logical partition, isn't it?

Sorry for the quesitons but I hope it might help future users to understand this partnew command that seems to be useful.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users