Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FAT16: root directory

221 views
Skip to first unread message

highland

unread,
Mar 26, 2003, 11:06:54 AM3/26/03
to
Hello
I want to write program which could create file by modyfing
FAT and root directory. But where does Root Directory starts ?
How can i check it ? And where Root Directory finish and starts data space ?
Do you know any good links where i can find such information ?

Thanx
Michal


arargh...@not.at.enteract.com

unread,
Mar 26, 2003, 3:27:45 PM3/26/03
to
On Wed, 26 Mar 2003 17:06:54 +0100, highland <hi...@piaski.eu.org>
wrote:

Byt the time you do the research in order to answer these questions,
you will know how to do it. It is not for the faint of heart.


--
Arargh (at arargh dot com) http://www.arargh.com
To reply by email, change the domain name, and remove the garbage.
(Enteract can keep the spam, they are gone anyway)

Ben Peddell

unread,
Mar 27, 2003, 1:20:05 AM3/27/03
to
highland <hi...@piaski.eu.org> wrote in message
news:3E81D01...@piaski.eu.org...

Try the official FAT documentation from Microsoft, which can be found at
http://www.singlix.com/trdos/v1vlla89.pdf

================ Start of Excerpt ================
Page 13 - FAT Data Structure

The next data structure that is important is the FAT itself. What this data
structure does is define a singly linked list of the "extents" (clusters) of
a file. Note at this point that a FAT directory or file container is nothing
but a regular file that has a special attribute indicating it is a
directory. The only other special thing about a directory is that the data
or contents of the "file" is a series of 32=byte FAT directory entries (see
discussion below). In all other respects, a directory is just like a file.
The FAT maps the data region of the volume by cluster number. The first data
cluster is cluster 2.

The first sector of cluster 2 (the data region of the disk) is computed
using the BPB fields for the volume as follows. First, we determine the
count of sectors occupied by the root directory:

RootDirSectors = ((BPB_RootEntCnt * 32) + (BPB_BytsPerSec - 1)) /
BPB_BytsPerSec;

Note that on a FAT32 volume the BPB_RootEntCnt value is always 0, so on a
FAT32 volume RootDirSectors is always 0. The 32 in the above is the size of
one FAT directory entry in bytes. Note also that this computation rounds up.

The start of the data region, the first sector of cluster 2, is computed as
follows:

If(BPB_FATSz16 != 0)
FATSz = BPB_FATSz16;
Else
FATSz = BPB_FATSz32;

FirstDataSector = BPB_ResvdSecCnt + (BPB_NumFATs * FATSz) + RootDirSectors;

NOTE: This sector number is relative to the first sector of the volume that
contains the BPB (the sector that contains the BPB is sector number 0). This
does not necessarily map directly onto the drive, because sector 0 of the
volume is not necessarily sector 0 of the drive due to partitioning.
Given any valid data cluster number N, the sector number of the first sector
of that cluster (again relative to sector 0 of the FAT volume) is computed
as follows:

FirstSectorofCluster = ((N - 2) * BPB_SecPerClus) + FirstDataSector;

NOTE: Because BPB_SecPerClus is restricted to powers of 2 (1,2,4,8,16,32..),
this means that division and multiplication by BPB_SecPerClus can actually
be performed via SHIFT operations on 2s complement architectures that are
usually faster instructions than MULT and DIV instructions. On current Intel
X86 processors, this is largely irrelevant though because the MULT and DIV
machine instructions are heavily optimized for multiplication and division
by powers of 2.
================ End of Excerpt ================

================ Start of Excerpt ================
Page 22 - FAT Directory Structure:

We will first talk about short directory entries and ignore long directory
entries for the moment.

A FAT directory is nothing but a "file" composed of a linear list of 32-byte
structures. The only special directory, which must always be present, is the
root directory. For FAT12 and FAT16 media, the root directory is located in
a fixed location on the disk immediately following the last FAT and is of a
fixed size in sectors computed from the BPB_RootEntCnt value (see
computations for RootDirSectors earlier in this document). For FAT12 and
FAT16 media, the first sector of the root directory is sector number
relative to the first sector of the FAT volume:

FirstRootDirSecNum = BPB_ResvdSecCnt + (BPB_NumFATs * BPB_FATSz16);

For FAT32, the root directory can be of variable size and is a cluster
chain, just like any other directory is. The first cluster of the root
directory on a FAT32 volume is stored in BPB_RootClus. Unlike other
directories, the root directory itself on any FAT type does not have any
date or time stamps, does not have a file name (other than the implied file
name "\"), and does not contain "." and ".." files as the first two
directory entries in the directory. The only other special aspect of the
root directory is that it is the only directory on the FAT volume for which
it is valid to have a file that has only the ATTR_VOLUME_ID attribute bit
set (see below).
================ End of Excerpt ================


Frank Buss

unread,
Mar 27, 2003, 10:41:23 AM3/27/03
to
"Ben Peddell" <lights...@hotmail.com> wrote:

> Try the official FAT documentation from Microsoft, which can be found
> at http://www.singlix.com/trdos/v1vlla89.pdf

The link doesn't work, but this works:

http://bad.caltech.edu/~iryll/ee5x/fs/V1VLLA89.pdf

BTW: I'm searching such a good documentation for NTFS. There is some
documentation about it in the Linux NTFS project, but many detailed
information are missing.

--
Frank Bu_, f...@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de

Tim Roberts

unread,
Mar 28, 2003, 12:49:49 AM3/28/03
to
Frank Buss <f...@frank-buss.de> wrote:
>
>BTW: I'm searching such a good documentation for NTFS. There is some
>documentation about it in the Linux NTFS project, but many detailed
>information are missing.

...and, unfortunately, that will continue to be the case because of patent
and licensing restrictions. NTFS is complicated, proprietary, and fluid.
--
- Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Ben Peddell

unread,
Mar 28, 2003, 3:57:00 AM3/28/03
to

Frank Buss <f...@frank-buss.de> wrote in message
news:b5v633$31m$2...@newsreader2.netcologne.de...

> "Ben Peddell" <lights...@hotmail.com> wrote:
>
> > Try the official FAT documentation from Microsoft, which can be found
> > at http://www.singlix.com/trdos/v1vlla89.pdf
>
> The link doesn't work, but this works:
>
> http://bad.caltech.edu/~iryll/ee5x/fs/V1VLLA89.pdf

I guess that they moved it. After all, I got it in the beginning of
February.

>
> BTW: I'm searching such a good documentation for NTFS. There is some
> documentation about it in the Linux NTFS project, but many detailed
> information are missing.

I'll see what I can find.
One overview is http://www.executive.com/whats-new/whitepaper.asp
There's also
http://searchwin2000.techtarget.com/whitepapersByCategory/0,293837,sid1_tax2
92941_idx0_off10,00.html

Ben Peddell

unread,
Mar 28, 2003, 5:34:37 AM3/28/03
to
Frank Buss <f...@frank-buss.de> wrote in message
news:b5v633$31m$2...@newsreader2.netcologne.de...
> "Ben Peddell" <lights...@hotmail.com> wrote:
>
> > Try the official FAT documentation from Microsoft, which can be found
> > at http://www.singlix.com/trdos/v1vlla89.pdf
>
> The link doesn't work, but this works:
>
> http://bad.caltech.edu/~iryll/ee5x/fs/V1VLLA89.pdf

I guess that they moved it. After all, I got it in the beginning of
February.

>


> BTW: I'm searching such a good documentation for NTFS. There is some
> documentation about it in the Linux NTFS project, but many detailed
> information are missing.

One overview is http://www.executive.com/whats-new/whitepaper.asp
There's also http://tinyurl.com/8bz9 (which is
http://searchwin2000.techtarget.com/whitepapersByCategory/0,293837,sid1_tax2
92941_idx0_off10,00.html )

Frank Buss

unread,
Mar 28, 2003, 5:34:49 AM3/28/03
to
"Ben Peddell" <lights...@hotmail.com> wrote:

> There's also
> http://searchwin2000.techtarget.com/whitepapersByCategory/0,293837,sid1
> _tax2 92941_idx0_off10,00.html

You have to register before you can read this article. I've tried, but
after spending some time for the register form and hitting the "submit"
button, the next page could not be found, so forget it.

With the title I've found another interesting page, where you can read this
article (and some more) without previous registration:

http://www.techtutorials.info/win2kfs.html

But there is no (free) detailed specification, I think. Perhaps you could
write your own, if you collect all information from all documents, but I'm
sure there will be many errors.

Ben Peddell

unread,
Mar 28, 2003, 7:22:52 AM3/28/03
to
Frank Buss <f...@frank-buss.de> wrote in message
news:b618g9$hsa$1...@newsreader2.netcologne.de...

> "Ben Peddell" <lights...@hotmail.com> wrote:
>
> > There's also
> > http://searchwin2000.techtarget.com/whitepapersByCategory/0,293837,sid1
> > _tax2 92941_idx0_off10,00.html
>
> You have to register before you can read this article. I've tried, but
> after spending some time for the register form and hitting the "submit"
> button, the next page could not be found, so forget it.

They want to know too much.

>
> With the title I've found another interesting page, where you can read
this
> article (and some more) without previous registration:
>
> http://www.techtutorials.info/win2kfs.html
>
> But there is no (free) detailed specification, I think. Perhaps you could
> write your own, if you collect all information from all documents, but I'm
> sure there will be many errors.
>

Well, anyway, the best I could find at the moment is
http://linux-ntfs.sourceforge.net/ntfs/help/layout.html
Though, it's got some urgent todos.


Bill Marcum

unread,
Mar 28, 2003, 2:59:16 PM3/28/03
to
On Thu, 27 Mar 2003 15:41:23 +0000 (UTC), Frank Buss
<f...@frank-buss.de> wrote:
>
> BTW: I'm searching such a good documentation for NTFS. There is some
> documentation about it in the Linux NTFS project, but many detailed
> information are missing.
>
There probably isn't any better doc available to the public, which is why
Linux systems have read-only access to NTFS partitions by default, and
enabling write access is not recommended.

--
No problem is so formidable that you can't just walk away from it.
-- C. Schulz

0 new messages