1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Partition table or boot sector?

Discussion in 'Embedded' started by Vladimir Vassilevsky, Oct 14, 2008.

  1. 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
    Vladimir Vassilevsky, Oct 14, 2008
    #1
    1. Advertising

  2. In article <ds2Jk.2555$>, Vladimir Vassilevsky <> 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
    Simon Clubley, Oct 14, 2008
    #2
    1. Advertising

  3. Simon Clubley wrote:

    > In article <ds2Jk.2555$>, Vladimir Vassilevsky <> 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
    Vladimir Vassilevsky, Oct 14, 2008
    #3
  4. In article <>, clubley@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley) writes:
    > In article <ds2Jk.2555$>, Vladimir Vassilevsky <> 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
    Simon Clubley, Oct 14, 2008
    #4
  5. Simon Clubley wrote:

    > In article <>, clubley@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley) writes:
    >>In article <ds2Jk.2555$>, Vladimir Vassilevsky <> 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
    Vladimir Vassilevsky, Oct 14, 2008
    #5
  6. Vladimir Vassilevsky

    Rich Webb Guest

    On Tue, 14 Oct 2008 09:58:20 -0500, Vladimir Vassilevsky
    <> 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
    Rich Webb, Oct 14, 2008
    #6
  7. In article <uj4Jk.4909$>, Vladimir Vassilevsky <> 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
    Simon Clubley, Oct 14, 2008
    #7
  8. 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.
    Hans-Bernhard Bröker, Oct 14, 2008
    #8
  9. Vladimir Vassilevsky

    Guest

    On Tue, 14 Oct 2008 11:44:45 -0500, Vladimir Vassilevsky
    <> 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.
    , Oct 14, 2008
    #9
  10. 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
    Stefan Reuther, Oct 14, 2008
    #10
  11. Stefan Reuther wrote:


    > 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...


    That's what I am trying to do, too. However, just for example, Windows
    have no problems accessing media formatted either way. That makes me
    think that there should be a standard method for distinguishing VBR and
    MBR.

    > 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.


    Exactly. There could be somewhat ~five equally valid variants of start
    for MBR or VBR.

    > Actually, I believe one
    > of those I wrote did that.


    Vladimir Vassilevsky
    DSP and Mixed Signal Design Consultant
    http://www.abvolt.com
    Vladimir Vassilevsky, Oct 14, 2008
    #11
  12. Vladimir Vassilevsky wrote:
    > Stefan Reuther wrote:
    >> 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...

    >
    > That's what I am trying to do, too. However, just for example, Windows
    > have no problems accessing media formatted either way. That makes me
    > think that there should be a standard method for distinguishing VBR and
    > MBR.


    Linux tries to read the partition table and if it fails no partition nodes
    are created. So you will end up with a "/dev/sda" only (or sdb, ...). If
    you know the filesystem you can try to mount this full device.
    If Linux detects a partition table it will also create at least a /dev/sda1
    (or sdb1,....). If it is present you must mount this one instead of the
    raw /dev/sda.

    jbe
    Juergen Beisert, Oct 15, 2008
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    291
  2. Replies:
    0
    Views:
    538
  3. Juergen Marquardt

    Any check of MBR, Boot Sector a.s.o. at boot time?

    Juergen Marquardt, Sep 6, 2004, in forum: Embedded
    Replies:
    2
    Views:
    459
    Lewin A.R.W. Edwards
    Sep 6, 2004
  4. csibra

    partition table restoring

    csibra, Oct 4, 2004, in forum: Sun Hardware
    Replies:
    0
    Views:
    239
    csibra
    Oct 4, 2004
  5. ATM121784

    Invaild partition table

    ATM121784, Jul 8, 2003, in forum: Hardware
    Replies:
    0
    Views:
    364
    ATM121784
    Jul 8, 2003
Loading...

Share This Page