Motherboard Forums


Reply
Thread Tools Display Modes

Partition table or boot sector?

 
 
Vladimir Vassilevsky
Guest
Posts: n/a
 
      10-14-2008, 02:58 PM

I have encountered the following problem:

It appears that some FAT32 formatted Compact Flash cards have the
partition table whereas some other cards don't. This creates trouble
during the initialization of the file system.

I couldn't find a standard procedure to distinguish the boot sector and
the partition table. We can do some speculation on the values of the
different fields, however that may not be valid for all cases, such as
for the different file systems.

Do you know if there is a standard recommended procedure for that purpose?


Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com





 
Reply With Quote
 
 
 
 
Simon Clubley
Guest
Posts: n/a
 
      10-14-2008, 04:38 PM
In article <ds2Jk.2555$(E-Mail Removed)>, Vladimir Vassilevsky <(E-Mail Removed)> writes:
>
> I have encountered the following problem:
>
> It appears that some FAT32 formatted Compact Flash cards have the
> partition table whereas some other cards don't. This creates trouble
> during the initialization of the file system.
>
> I couldn't find a standard procedure to distinguish the boot sector and
> the partition table. We can do some speculation on the values of the
> different fields, however that may not be valid for all cases, such as
> for the different file systems.
>
> Do you know if there is a standard recommended procedure for that purpose?
>


Are we talking about a x86, BIOS valid, boot sector ?

If so, then traditional disks require 0xAA55 in the last couple of bytes in
the boot sector for the BIOS to detect it as a valid boot sector. I would
assume that bootable CF cards have the same requirements.

See http://en.wikipedia.org/wiki/Boot_sector . It's been a while since I've
written boot sector code, so I can't remember if 0xAA55 is stored as a
big or little endian number on disk.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980's technology to a 21st century world
 
Reply With Quote
 
 
 
 
Vladimir Vassilevsky
Guest
Posts: n/a
 
      10-14-2008, 04:44 PM


Simon Clubley wrote:

> In article <ds2Jk.2555$(E-Mail Removed)>, Vladimir Vassilevsky <(E-Mail Removed)> writes:
>
>>I have encountered the following problem:
>>
>>It appears that some FAT32 formatted Compact Flash cards have the
>>partition table whereas some other cards don't. This creates trouble
>>during the initialization of the file system.
>>
>>I couldn't find a standard procedure to distinguish the boot sector and
>>the partition table. We can do some speculation on the values of the
>>different fields, however that may not be valid for all cases, such as
>>for the different file systems.
>>
>>Do you know if there is a standard recommended procedure for that purpose?
>>

>
>
> Are we talking about a x86, BIOS valid, boot sector ?
>
> If so, then traditional disks require 0xAA55 in the last couple of bytes


Thank you for the useless advice. Partition table has 0xAA55, too.


Vladimir Vassilevsky

DSP and Mixed Signal Design Consultant

http://www.abvolt.com
 
Reply With Quote
 
Simon Clubley
Guest
Posts: n/a
 
      10-14-2008, 04:49 PM
In article <(E-Mail Removed)>, clubley@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley) writes:
> In article <ds2Jk.2555$(E-Mail Removed)>, Vladimir Vassilevsky <(E-Mail Removed)> writes:
>>
>> I have encountered the following problem:
>>
>> It appears that some FAT32 formatted Compact Flash cards have the
>> partition table whereas some other cards don't. This creates trouble
>> during the initialization of the file system.
>>
>> I couldn't find a standard procedure to distinguish the boot sector and
>> the partition table. We can do some speculation on the values of the
>> different fields, however that may not be valid for all cases, such as
>> for the different file systems.
>>
>> Do you know if there is a standard recommended procedure for that purpose?
>>

>
> Are we talking about a x86, BIOS valid, boot sector ?
>
> If so, then traditional disks require 0xAA55 in the last couple of bytes in
> the boot sector for the BIOS to detect it as a valid boot sector. I would
> assume that bootable CF cards have the same requirements.
>
> See http://en.wikipedia.org/wiki/Boot_sector . It's been a while since I've
> written boot sector code, so I can't remember if 0xAA55 is stored as a
> big or little endian number on disk.
>


I should also point out that the primary partition table _is_ part of the
boot sector on traditional disks and resides at a known location within the
boot sector.

Therefore if CF cards are laid out like normal disks, you would either get
a boot area (even if not filled in) _and_ partition table or neither.

I've found the following that might be of interest:

http://bootmaster.filerecovery.biz/appnote4.html

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980's technology to a 21st century world
 
Reply With Quote
 
Vladimir Vassilevsky
Guest
Posts: n/a
 
      10-14-2008, 05:05 PM


Simon Clubley wrote:

> In article <(E-Mail Removed)>, clubley@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley) writes:
>>In article <ds2Jk.2555$(E-Mail Removed)>, Vladimir Vassilevsky <(E-Mail Removed)> writes:
>>
>>>I have encountered the following problem:
>>>
>>>It appears that some FAT32 formatted Compact Flash cards have the
>>>partition table whereas some other cards don't. This creates trouble
>>>during the initialization of the file system.
>>>
>>>I couldn't find a standard procedure to distinguish the boot sector and
>>>the partition table. We can do some speculation on the values of the
>>>different fields, however that may not be valid for all cases, such as
>>>for the different file systems.
>>>
>>>Do you know if there is a standard recommended procedure for that purpose?
>>>

>>
>>Are we talking about a x86, BIOS valid, boot sector ?
>>
>>If so, then traditional disks require 0xAA55 in the last couple of bytes in
>>the boot sector for the BIOS to detect it as a valid boot sector. I would
>>assume that bootable CF cards have the same requirements.
>>
>>See http://en.wikipedia.org/wiki/Boot_sector . It's been a while since I've
>>written boot sector code, so I can't remember if 0xAA55 is stored as a
>>big or little endian number on disk.
>>

>
>
> I should also point out that the primary partition table _is_ part of the
> boot sector on traditional disks and resides at a known location within the
> boot sector.
>
> Therefore if CF cards are laid out like normal disks, you would either get
> a boot area (even if not filled in) _and_ partition table or neither.
>
> I've found the following that might be of interest:
> http://bootmaster.filerecovery.biz/appnote4.html



On the compact flash, there could be either MBR or VBR. This is the
experimental fact, although it may not be exactly correct from the point
of view of the specifications.

The question is: what is the standard procedure to distinguish if this
is MBR or VBR.


Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com



 
Reply With Quote
 
Rich Webb
Guest
Posts: n/a
 
      10-14-2008, 05:23 PM
On Tue, 14 Oct 2008 09:58:20 -0500, Vladimir Vassilevsky
<(E-Mail Removed)> wrote:

>
>I have encountered the following problem:
>
>It appears that some FAT32 formatted Compact Flash cards have the
>partition table whereas some other cards don't. This creates trouble
>during the initialization of the file system.
>
>I couldn't find a standard procedure to distinguish the boot sector and
>the partition table. We can do some speculation on the values of the
>different fields, however that may not be valid for all cases, such as
>for the different file systems.


WinHex from http://www.x-ways.net/winhex/ comes with a set of template
files for breaking down the contents of key physical disk sectors,
including the master boot record and partition table entries. I don't
want to post his templates but the product itself is pretty reasonably
priced and a useful tool if you need to work with disk-like objects at
that low level.

--
Rich Webb Norfolk, VA
 
Reply With Quote
 
Simon Clubley
Guest
Posts: n/a
 
      10-14-2008, 05:29 PM
In article <uj4Jk.4909$(E-Mail Removed)>, Vladimir Vassilevsky <(E-Mail Removed)> writes:
>
> On the compact flash, there could be either MBR or VBR. This is the
> experimental fact, although it may not be exactly correct from the point
> of view of the specifications.
>


Interesting; I wasn't aware of that - the last time that I came across VBRs
on the primary boot sector was when experimenting with boot blocks on
floppy devices.

> The question is: what is the standard procedure to distinguish if this
> is MBR or VBR.
>


Is there some reason why you have to use the devices as is or can you
wipe them ?

On Linux, I format new devices by using dd to wipe the first few sectors
of the device, then use fdisk to create a partition table, before using
the standard filesystem formatting utilities on the individual partitions.

If I need a boot block on the device I either install grub or let the
operating system that I'm installing write one.

Simon.

PS: Warning to anyone reading this: you don't get a second chance when using
dd; if you make a mistake and get the wrong target disk you _will_ wipe the
wrong device.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980's technology to a 21st century world
 
Reply With Quote
 
Hans-Bernhard Bröker
Guest
Posts: n/a
 
      10-14-2008, 07:27 PM
Simon Clubley wrote:

> Interesting; I wasn't aware of that - the last time that I came across VBRs
> on the primary boot sector was when experimenting with boot blocks on
> floppy devices.


Which is why this style of formatting block devices is referred to as
the "super floppy" format. It went out of fashion in the PC field
somewhere between MO disks and ZIP disks.

> On Linux, I format new devices by using dd to wipe the first few sectors
> of the device, then use fdisk to create a partition table, before using
> the standard filesystem formatting utilities on the individual partitions.


And if you want a super-floppy, just drop the fdisk step, and format the
primary device as-is --- assuming the system allows this for the device.
Some will only do so for removable drives.
 
Reply With Quote
 
ArarghMail810NOSPAM@NOT.AT.Arargh.com
Guest
Posts: n/a
 
      10-14-2008, 08:06 PM
On Tue, 14 Oct 2008 11:44:45 -0500, Vladimir Vassilevsky
<(E-Mail Removed)> wrote:
>Simon Clubley wrote:

<snip>
>> Are we talking about a x86, BIOS valid, boot sector ?
>> If so, then traditional disks require 0xAA55 in the last couple of bytes

>
>Thank you for the useless advice. Partition table has 0xAA55, too.


Boot sectors generally start with hex "EB ?? 90" followed by 8 bytes
of readable text (which some versions of windows clobber) followed by
a BPB, which contains a filesystem indicator in readable text "FAT16"
or "FAT32" . . . NTFS boot sectors appear not to have it.

Partition tables (that I have seen) generally start with hex "33 C0",
and generally don't any readable text until near the end.

I have only really seen DOS & Windows versions of each, and this
assumes that the sector is not just a dummy.

--
ArarghMail810 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the extra stuff from the reply address.
 
Reply With Quote
 
Stefan Reuther
Guest
Posts: n/a
 
      10-14-2008, 08:43 PM
Hans-Bernhard Bröker wrote:
> Simon Clubley wrote:
>> Interesting; I wasn't aware of that - the last time that I came across
>> VBRs
>> on the primary boot sector was when experimenting with boot blocks on
>> floppy devices.

>
> Which is why this style of formatting block devices is referred to as
> the "super floppy" format. It went out of fashion in the PC field
> somewhere between MO disks and ZIP disks.


It's still known in certain circles because formatting the raw device
gives you a little more space, and you don't want to waste that!!!!1

Recently, a customer came to me with a SD card formatted this way. SD
cards are even worse because the CSD register can explicitly say "this
card has a partition table", but if J.R.Lamer has formatted it, it of
course has none.

I now try to parse the whole partition table, and if it doesn't make
sense, I retry parsing it as a superfloppy boot sector. Of course this
can fail, but that's the problem if you violate the format specs...

I don't think parsing opcodes makes too much sense. Boot sectors start
with an x86 jump instruction, 0xE9 or 0xEB, but I don't see a reason why
a partition table should not start with a jump. Actually, I believe one
of those I wrote did that.


Stefan

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Fix partition 26 from its saved partition table? news@absamail.co.za PC Hardware 0 11-11-2005 04:12 AM
Fix partition 26 from its saved partition table? news@absamail.co.za PC Hardware 1 10-26-2005 02:57 PM
partition table restoring csibra Sun Hardware 0 10-04-2004 07:36 PM
Partition table recovery knowing start cylinders Behemot Hardware 0 06-28-2004 10:44 AM
Invaild partition table ATM121784 Hardware 0 07-08-2003 08:31 AM


All times are GMT. The time now is 03:27 PM.


Welcome!
Welcome to Motherboard Point
 

Advertisment