Jump to content











Photo
- - - - -

Booting non 512 byte sector size ?


  • Please log in to reply
67 replies to this topic

#1 mbzadegan

mbzadegan

    Frequent Member

  • Advanced user
  • 105 posts
  • Location:IFN
  •  
    Canada

Posted 04 February 2012 - 01:27 PM

Dear Forumer ,
How can i bootabled my pendrive that its sector size is 2048 and not 512b ??
With GRUB4DOS or SYSLINUX or ....

#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 February 2012 - 02:01 PM

Dear Forumer ,
How can i bootabled my pendrive that its sector size is 2048 and not 512b ??
With GRUB4DOS or SYSLINUX or ....


Are you really sure that the BIOS and OS see it as a 2K bytes/sector device?

From WHERE exactly did you gather the info that your stick uses a 2048 bytes sector size?

WHICH EXACT make/model/size USB stick is it? (and possibly a link to the product page)

:cheers:
Wonko

#3 mbzadegan

mbzadegan

    Frequent Member

  • Advanced user
  • 105 posts
  • Location:IFN
  •  
    Canada

Posted 04 February 2012 - 05:38 PM

Dear Wonko the Sane,

I found it by parted and fdisk ,

root@bt:~# parted /dev/sdb
Warning: Device /dev/sdb has a logical sector size of 2048. Not all parts of GNU Parted support this at the moment, and the working code is HIGHLY EXPERIMENTAL.

GNU Parted 2.2
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: SONY WALKMAN (scsi)
Disk /dev/sdb: 3974MB
Sector size (logical/physical): 2048B/2048B
Partition Table: msdos

Number Start End Size Type File system Flags

(parted) q
root@bt:~# fdisk -l

Disk /dev/sda: 1000.2 GB, 1000203804160 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xee9eee9e

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 12749 102297600 7 HPFS/NTFS
/dev/sda3 12749 117284 839680000 7 HPFS/NTFS
Partition 3 does not end on cylinder boundary.
/dev/sda4 117284 121602 34678785 5 Extended
/dev/sda5 117284 120931 29295616 83 Linux
/dev/sda6 120932 121602 5382144 82 Linux swap / Solaris
Note: sector size is 2048 (not 512)

Disk /dev/sdb: 3974 MB, 3974103040 bytes
123 heads, 62 sectors/track, 254 cylinders
Units = cylinders of 7626 * 2048 = 15618048 bytes
Sector size (logical/physical): 2048 bytes / 2048 bytes
I/O size (minimum/optimal): 2048 bytes / 2048 bytes
Disk identifier: 0x6f20736b

Device Boot Start End Blocks Id System

#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 February 2012 - 09:15 PM

WHICH EXACT make/model/size USB stick is it? (and possibly a link to the product page)



Model: SONY WALKMAN (scsi)
Disk /dev/sdb: 3974MB
Sector size (logical/physical): 2048B/2048B
Partition Table: msdos

Note: sector size is 2048 (not 512)

Disk /dev/sdb: 3974 MB, 3974103040 bytes
123 heads, 62 sectors/track, 254 cylinders
Units = cylinders of 7626 * 2048 = 15618048 bytes
Sector size (logical/physical): 2048 bytes / 2048 bytes
I/O size (minimum/optimal): 2048 bytes / 2048 bytes
Disk identifier: 0x6f20736b


From the PARTIAL info you posted it is not a USB stick, BUT a MP3 thingy.

Theoretically there is no problem with booting a non 512 bytes/sector device, BUT the MP3 thingy may pose another kind of problem, see here:
http://reboot.pro/8528/

:cheers:
Wonko

#5 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 February 2012 - 11:49 PM

Theoretically there is no problem with booting a non 512 bytes/sector device,
Wonko

Surely normal MBR booting via standard 'IBM' BIOS does present a big problem? AFAIK int 13h BIOSes assume 512 byte sectors, so does code in the MBR and PBR (e.g. read 2 sectors into a 1K buffer followed by code would cause a big problem if each sector was 4K in size). I think UEFI supports 4K sectors and so UEFI BIOSes would too (unsure??) but this does not use the MBR to boot (uses GPT). This is why all (99.9%??) of HDDs support 512byte emulation so you can boot from them.
  • mbzadegan likes this

#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2012 - 12:28 AM

steve,
it is likely that there is NO MBR at all on the device :dubbio:, it is - just like "standard" USB sticks - a "super-floppy", and according to the smart guy from MS that wrote about FAT 1x in the known FAT32 document (with the attitude of "you demented that thought that, you are wrong" forgetting that assumptions were made by a lot of people because the actual info was not disclosed) it seems like as long as there is the 55AA at offset 510 sector size is not an issue. :unsure:

BPB_BytsPerSec 11 2 Count of bytes per sector. This value may take on only the
following values: 512, 1024, 2048 or 4096. If maximum
compatibility with old implementations is desired, only the value
512 should be used. There is a lot of FAT code in the world that is
basically “hard wired” to 512 bytes per sector and doesn’t bother to
check this field to make sure it is 512. Microsoft operating systems
will properly support 1024, 2048, and 4096.

Note: Do not misinterpret these statements about maximum
compatibility. If the media being recorded has a physical sector size
N, you must use N and this must still be less than or equal to 4096.
Maximum compatibility is achieved by only using media with
specific sector sizes.


There is one other important note about Sector 0 of a FAT volume. If we consider the contents of the
sector as a byte array, it must be true that sector[510] equals 0x55, and sector[511] equals 0xAA.

NOTE: Many FAT documents mistakenly say that this 0xAA55 signature occupies the “last 2 bytes
of the boot sector”. This statement is correct if — and only if — BPB_BytsPerSec is 512. If
BPB_BytsPerSec is greater than 512, the offsets of these signature bytes do not change (although it is
perfectly OK for the last two bytes at the end of the boot sector to also contain this signature).


http://www.msfn.org/...-torito__st__81

And if you look a bit in here:
http://www.msfn.org/...d-their-images/
you will see how there is a "historical" floppy format that used 1,024 bytes/sector (that we anyway decided to exclude from the WIP).

At least, this is what I meant with "Theoretically". :)


:cheers:
Wonko

#7 mbzadegan

mbzadegan

    Frequent Member

  • Advanced user
  • 105 posts
  • Location:IFN
  •  
    Canada

Posted 05 February 2012 - 04:08 AM

@ Finally How can i do it ?
Is it possible to bootabled my favorite USB PenDrive ? :dubbio:

#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2012 - 08:37 AM

@ Finally How can i do it ?

We won't know until you do some tests.

Is it possible to bootabled my favorite USB PenDrive ? :dubbio:

Maybe, or maybe not.

You could try answering the questions that are asked you (rest assured that they are asked with the scope of learning more on the device and consequently attempting to help you):

WHICH EXACT make/model/size USB stick is it? (and possibly a link to the product page)


Please do a dd copy of first few sectors of the device, let's say 100 sectors or 204,800 bytes, compress it in a .zip archive and attach the file to your next post (or post it on a hosting site and give a link to it).

:cheers:
Wonko
  • mbzadegan likes this

#9 mbzadegan

mbzadegan

    Frequent Member

  • Advanced user
  • 105 posts
  • Location:IFN
  •  
    Canada

Posted 05 February 2012 - 10:06 AM

Dear Wonko ,
@ This link you will find EXACT make/model/size of my USB stick ,
http://www.sony-asia...u/nwz-b163f_bce ---->> Specification TAB

How can i use dd command to copy my initial sector DATA ?

#10 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 05 February 2012 - 10:31 AM

Some things to try - use LATEST BETA RMPrepUSB...

1. Run RMPrepUSB in Windows and see if the drive appears - if so click on the Drive Info button and see if you can actually read from it. As this will use a Windows driver to access the USB device, it may work.
2. The latest version of RMPrepUSB has a Disk Doctor utility (CTRL+ALT+F5) you could see if that can access the device (be careful as you can also write to your hard disk if you select disk 0!)
3. Try other Disk edit utils WinHex, Hxd, etc.
4. Boot from a bootable USB pen (normal 512 byte one) with the 4K device connected - boot to grub4dos menu - press c - type cat --hex (hd1)+4 and see what you get. hd1 should be the 4K device. This uses the BIOS and may not work.
5. Use RMPrepUSB to prepare the 4K device for FreeDos booting (use the FreeDos folder that you will be prompted with) - see if it boots under QEMU (press F11) and for real.

RMPrepUSB has a 'dd' like function, use the Drive -> File button and save Start=0, Length=20SEC, FilePos=0 to a file and attach it.
  • mbzadegan likes this

#11 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2012 - 11:57 AM

How can i use dd command to copy my initial sector DATA ?

http://wiki.linuxque...ome_dd_examples

dd if=/dev/sdb of=/home/sam/first400512.bin bs=512 count=400
or
dd if=/dev/sdb of=/home/sam/first1002048.bin bs=2048 count=100

adapt "/home/sam/" to your path structure and make sure that the device is still /dev/sdb.

BTW, I suggested dd because you reported using Linux tool, under Windows NT you can use dsfo as sugggested in the referenced thread to ktp in this case the syntax would be:
dsfo .Physicaldrive2 0 204800 C:somewherefirst204800.bin
make sure that the device is .PhysicalDrive2 or change it to the right number, adapt "C:somewhere" to your path structure.

As expected the device is NOT a "USB stick", but rather a MP3 player.
This kind of device, as we have seen in the previously referenced thread, may have a feature that "auto-corrects" the filesystem/bootsector/what not :ph34r:.

:cheers:
Wonko
  • mbzadegan likes this

#12 mbzadegan

mbzadegan

    Frequent Member

  • Advanced user
  • 105 posts
  • Location:IFN
  •  
    Canada

Posted 05 February 2012 - 12:51 PM

http://wiki.linuxque...ome_dd_examples

dd if=/dev/sdb of=/home/sam/first400512.bin bs=512 count=400
or
dd if=/dev/sdb of=/home/sam/first1002048.bin bs=2048 count=100

adapt "/home/sam/" to your path structure and make sure that the device is still /dev/sdb.

BTW, I suggested dd because you reported using Linux tool, under Windows NT you can use dsfo as sugggested in the referenced thread to ktp in this case the syntax would be:
dsfo .Physicaldrive2 0 204800 C:somewherefirst204800.bin
make sure that the device is .PhysicalDrive2 or change it to the right number, adapt "C:somewhere" to your path structure.

As expected the device is NOT a "USB stick", but rather a MP3 player.
This kind of device, as we have seen in the previously referenced thread, may have a feature that "auto-corrects" the filesystem/bootsector/what not :ph34r:.

:cheers:
Wonko


Dear Wonko ,
Your request is @ http://mbzadegan.ifa...m/first_bin.zip

Some things to try - use LATEST BETA RMPrepUSB...

1. Run RMPrepUSB in Windows and see if the drive appears - if so click on the Drive Info button and see if you can actually read from it. As this will use a Windows driver to access the USB device, it may work.
2. The latest version of RMPrepUSB has a Disk Doctor utility (CTRL+ALT+F5) you could see if that can access the device (be careful as you can also write to your hard disk if you select disk 0!)
3. Try other Disk edit utils WinHex, Hxd, etc.
4. Boot from a bootable USB pen (normal 512 byte one) with the 4K device connected - boot to grub4dos menu - press c - type cat --hex (hd1)+4 and see what you get. hd1 should be the 4K device. This uses the BIOS and may not work.
5. Use RMPrepUSB to prepare the 4K device for FreeDos booting (use the FreeDos folder that you will be prompted with) - see if it boots under QEMU (press F11) and for real.

RMPrepUSB has a 'dd' like function, use the Drive -> File button and save Start=0, Length=20SEC, FilePos=0 to a file and attach it.


Dear Steve6375,
I downloaded and install RMPREPUSB 2.1.630 but when i refreshed (F5) will not appear any drive !!

Note1 : in windows explorer did not map my usb content to any DRIVE !!! ( such as D: or E: or F: , ... ) .
Note2 : in linux bash did not listed my device to BLKID command and only create sdb file in /dev when i connect to my pc .

With Disk Doctor utility (CTRL+ALT+F5) listed my HDD only and never appear my USB !

#13 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 05 February 2012 - 01:33 PM

How do you copy mp3 files to it - does it uses a special Windows utility?

#14 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2012 - 01:38 PM

Link not working. :(

:cheers:
Wonko

#15 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 05 February 2012 - 01:56 PM

It says drag and drop - but how can you if it doesn't show up in Explorer?



 Hint

 You can also transfer data to the player by dragging and dropping in Windows Explorer on

your computer


#16 mbzadegan

mbzadegan

    Frequent Member

  • Advanced user
  • 105 posts
  • Location:IFN
  •  
    Canada

Posted 05 February 2012 - 03:40 PM

in windows When i connect it to my PC a window opened an i drop my files to it and this window have not any drive letter !!!
Note : diskmgmt.msc in windows not listed my device !!!
in linux i must be mount /dev/sdb to a folder and blkid not listed my device.
this follow link to dd output -->> http://www.files.com...1/first_bin.zip

Edited by mbzadegan, 05 February 2012 - 03:43 PM.


#17 betrand

betrand

    Frequent Member

  • Advanced user
  • 467 posts
  •  
    France

Posted 05 February 2012 - 04:08 PM

Hello.
Did a quick read-through,

in windows When i connect it to my PC a window opened an i drop my files to it and this window have not any drive letter !!!
Note : diskmgmt.msc in windows not listed my device !!!

Maybe OT,
You know you can refresh in diskmgmt, as well as change drive letter if not appearing in explorer.Does the drive appear in Cmd. ?
Sometimes a drive won't appear in explorer, but does in Cmd. Sometimes you can download an html page (or whatever) to an invisible drive, from IE or firefox. You can even use Midnight commander and it will display the drive when Explorer doesnt.

:)

Edit:
Did a re-read of the last

in windows When i connect it to my PC a window opened an i drop my files to it and this window have not any drive letter !!!
Note : diskmgmt.msc in windows not listed my device !!!

Reminds me of the Lcd topic(small lcd picture frame),
Anyway, a program opens, says drag 'n' drop, to a drive that doesn't appear in Explorer, and there we go.

:unsure:

r

#18 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2012 - 04:20 PM

this follow link to dd output -->> http://www.files.com...1/first_bin.zip


Good, now the link works.

The contents of it make very little sense :w00t: unless you (or someone else) already fiddled with the device. :dubbio:

The bootsector has a sector size of 2048 bytes set, and at first sight contains some GRUB, it is a FAT32, BUT the normally present "FAT32 " string is missing.
However it has the (standard for FAT32 filesystem) the backup bootsector at sector 6.

Since it is 6*2048=12,288 there is the backup bootsector, which is a standard 2K/XP one (invoking NTLDR).

The geometry set in BOTH boootsector and backup is 255/63 and media type is F8 (hard disk volume) BUT the drive number in the backup bootsector is 0 (should be 80) and in the bootsector 81 (should be 80).

@24576 there is anothe "whatever" piece of code that ends with the 55AA "Magic Bytes".

About Windows not seeing it as a drive, it is very likely that the thingy uses MTP AND NOT MSC, as it is a MP3 player AND NOT a USB stick:
http://reboot.pro/8528/page__st__18
http://en.wikipedia....ansfer_Protocol
http://en.wikipedia....ge_device_class

You need to set it as MSC.
http://movingtowards...g/sony-walkman/
http://en.kioskea.ne...etting-detected
http://en.kioskea.ne...usb-to-mtp-mode

:cheers:
Wonko
  • mbzadegan likes this

#19 mbzadegan

mbzadegan

    Frequent Member

  • Advanced user
  • 105 posts
  • Location:IFN
  •  
    Canada

Posted 05 February 2012 - 05:09 PM

dear Wonko :clap:
with link of http://en.kioskea.ne...etting-detected its drive letter was appear on windows explorer by changing from MTP .

BUT , Now when i try bootabling with rmpreusb these messages telling me :

Error accessing sector 0 on drive 5

ERROR: The parameter is incorrect

How can i bootabled my device ?

#20 NetFanTom

NetFanTom

    Frequent Member

  • .script developer
  • 117 posts
  •  
    Germany

Posted 05 February 2012 - 06:14 PM

Sorry for blending.

You can try
bootsect / nt60 x: /force /mbr
if x: is your USB drive..
Certainly you get an error message.

Try the install of Grub4dos in to the mbr. :good:

http://sourceforge.n...ubinst%201.0.1/
http://reboot.pro/16274/

The menu.lst and grldr files must be located in the root directory of the USB partition.

Regards,
NetFanTom
:cheers:

#21 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2012 - 06:40 PM

If I may, we are not going anywhere UNTIL the device is RESET.
Right now there is - as said - everything (and the opposite of it) on that stoopid device.
We need to understand what is on the drive when "fresh".

Leave alone RMPREPUSB and any other "intelligent" utility.

First thing FORMAT the device from it's internal menu:
http://pdf.crse.com/...6/01/10/10.html



Do again a dd of the same first few sectors. This time a few more.
There are (from the data posted):
32 reserved sectors
474 sectors for 1st FAT
474 sectors for 2nd FAT

32+474+474=980 x 2048 = 2,007,040 bytes so please dd 1000 sectors x 2048 or 4000 x 512 this way we have also the first few sectors of the clusters of the filesystem (the data says that a cluster is made of 8 sectors).

Verify, by using DIR command (or by clicking on the device properties) the EXACT (in bytes) space available, the specs:
http://pdf.crse.com/...9/01/01/01.html

Capacity (User available capacity) (*1)
NWZ-B162/B162F: 2 GB (Approx. 1.73 GB = 1,853,587,456 bytes)
NWZ-B163/B163F: 4 GB (Approx. 3.54 GB = 3,798,007,808 bytes)
(*1) Available storage capacity of the player may vary.
A portion of the memory is used for data management functions.

are not perfectly clear if that amount is unformatted or formatted capacity.

BEFORE taking the dd image, copy to the device TWO small .txt files, each sized around 1 KB (or however smaller than 16384 bytes), put a copy of the two text files in a .zip archive together with the output of dd and post the archive).

Check again with DIR and/or device properties in bytes after having copied the two text files.

:cheers:
Wonko
  • mbzadegan likes this

#22 mbzadegan

mbzadegan

    Frequent Member

  • Advanced user
  • 105 posts
  • Location:IFN
  •  
    Canada

Posted 05 February 2012 - 07:45 PM

i Formated it with its menu factory that you linked and put 2 small TXT file on it and repeat your dd commands :
:coffee:
http://www.files.com...c59/bin_txt.zip

#23 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2012 - 09:40 PM

Do again a dd of the same first few sectors. This time a few more.
There are (from the data posted):
32 reserved sectors
474 sectors for 1st FAT
474 sectors for 2nd FAT

32+474+474=980 x 2048 = 2,007,040 bytes so please dd 1000 sectors x 2048 or 4000 x 512 this way we have also the first few sectors of the clusters of the filesystem (the data says that a cluster is made of 8 sectors).


:whistling: :frusty:

Anyway, it seems like the internal Format - BTW as expected - couldn't care less about the bootsector and similar structures, though there are a handful of bytes that have been changed.

Let's try again.

This time you need to preventively 0 (wipe) first 1000 (one thousand) sectors.
With dd that would be:
dd if=/dev/zero of=/dev/sdb bs=2048 count=1000

Then make a copy if the first 1000 (one thousand) sectors.
dd if=/dev/sdb of=/home/sam/wiped10002048.bin bs=2048 count=1000

Then, format the device from it's internal menu.


Then make a copy of the first 1000 (one thousand) sectors.
dd if=/dev/sdb of=/home/sam/format10002048.bin bs=2048 count=1000

Then write to it (from windows) the files 1.txt and 2.txt

Then make a copy if the first 1000 (one thousand) sectors.
dd if=/dev/sdb of=/home/sam/withtxt10002048.bin bs=2048 count=1000

Zip together 1.txt, 2.txt, wiped10002048.bin, format10002048.bin, withtxt10002048.bin and post the .zip.

Before creating each file, run a DIR or check device properties for the EXACT size in bytes you can see (BOTH total size and free space) AND §@ç#ing POST :realmad: this info as well.

This is the 2nd (second) time that I ask you for some piece of info and you blatantly ignore these requests or reply with partial or incorrect data.
As said, I ask this info because I NEED them to try and understand the issues AND I NEED them in order to help you with YOUR problem.

If anything that I ask you is not clear, please ask for explanations BEFORE doing ANOTHER thing you must be sure to have understood what I ask you, and I will gladly try to explain whatever you might have not perfectly clear, BUT DO NOT post something else or only part of what I ask you.

I won't tell you this a third time. :ranting2:

:cheers:
Wonko

#24 mbzadegan

mbzadegan

    Frequent Member

  • Advanced user
  • 105 posts
  • Location:IFN
  •  
    Canada

Posted 06 February 2012 - 03:24 AM

:frusty: :ranting2: When i wiped with your dd command
dd if=/dev/zero of=/dev/sdb bs=2048 count=1000
my MP3 Player did not boot !!!!! and i could not format it with internal menu !!
can i recovery it with first10002048.bin ?

Edited by mbzadegan, 06 February 2012 - 03:38 AM.


#25 NetFanTom

NetFanTom

    Frequent Member

  • .script developer
  • 117 posts
  •  
    Germany

Posted 06 February 2012 - 07:41 AM

Well, if the grub4dos sequence would be located in the MBR,
you need absolutely no PBR. :D

The grub4dos sequence MBR directly searching for the grldr file and the menu.lst file.

Then it would not matter if the boot sector has 512 or 2048 bytes.

The proof of the pudding is in the eating. :worship:

Regards,
  • mbzadegan likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users