Export to GitHub

grub4dos-chenall - issue #165

usb --init causes sector access issues near end of disk


Posted on Feb 6, 2014 by Happy Kangaroo

What steps will reproduce the problem? 1. Create 32GB NTFS USB Flash drive or FAT16 512MB flash drive 2. Try to access near end of disk using batch file (see below)

cat --length=16 --hex (hd0)963965+1

works OK on 0.4.6a 2014-01-17

BUT If add usb --init to start of menu.lst, the same batch file fails.

usb --init cat --length=16 --hex (hd0)963965+1 -> FAILS cat --length=16 --hex (hd0)963700+1 -> FAILS cat --length=16 --hex (hd0)963600+1 -> OK

BATCH FILE IS:

!BAT

check can access last sector - warn if problem (allow for >1TB drives)

if not "%?_BOOT:~1,1%"=="h" goto :EOF setlocal set result=0 echo -n %?_BOOT% > (md)0x3000+1 cat --locate=, --replace=)\x00 (md)0x3000+1 cat (md)0x3000+1 | set driv= if "%driv%"=="" goto :skipca dd if=%driv%+1 of=(md)0x3000+1 > nul

:: in case number is > 0x80000000 divide by 4 set /a s1=*0x6001c6 & 0xffffffff >>2 > nul set /a l1=*0x6001ca & 0xffffffff >>2 > nul set /a s2=*0x6001d6 & 0xffffffff >>2 > nul set /a l2=*0x6001da & 0xffffffff >>2 > nul set /a s3=*0x6001e6 & 0xffffffff >>2 > nul set /a l3=*0x6001ea & 0xffffffff >>2 > nul set /a s4=*0x6001f6 & 0xffffffff >>2 > nul set /a l4=*0x6001fa & 0xffffffff >>2 > nul

set s=%s1% && set l=%l1% if %s2%>=%s% set s=%s2% && set l=%l2% if %s3%>=%s% set s=%s3% && set l=%l3% if %s4%>=%s% set s=%s4% && set l=%l4% set /a lba=%s%+%l%-1 > nul set /a lba=%lba%<<2 > nul echo Last Sector of last partition of %driv% is %lba% %redir% echo -n Checking last sector is accessible... %redir% cat --length=16 --hex %driv%%%lba%+1 > nul && set result=1

if "%result%"=="1" echo BIOS OK %redir% || echo $[0114]BIOS BAD! && pause --wait=2 WARNING: THIS BIOS MAY HAVE PROBLEMS ACCESSING FILES ON THIS DRIVE! :skipca

endlocal

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system? 0.4.6a 2014-01-17

Please provide any additional information below.

Comment #1

Posted on Feb 6, 2014 by Happy Kangaroo

On 32GB USB Flash drive (NTFS)

after using usb --init

block 62603125+1 OK block 62603126+1 FAILS

without usb --init block 62605296+1 OK

Comment #2

Posted on Feb 17, 2014 by Helpful Elephant

Please try this.

Attachments

Comment #3

Posted on Feb 17, 2014 by Happy Kangaroo

Can now access sectors up to and past the end of the drive.

e.g. without using usb --init and access past end of 32GB flash drive: cat --length=16 --hex (hd0)64627460+1 takes a few minutes and then shows 00000000: 55 53 42 53 D3 25 00 00 00 02 00 00 01 41 44 3f : USBS......AD?

Is this a USB packet data?

If I add usb --init, then it hangs on same cat command.

Comment #4

Posted on Feb 18, 2014 by Helpful Elephant

Don't know, You can use the WINHEX to look.

Comment #5

Posted on Feb 24, 2014 by Happy Kangaroo

WinHEx (or any Windows program) will not allow access past the last sector of the reported size of the disk.

Status: New

Labels:
Type-Defect Priority-Medium