Windows FAT32: cluster allocation question
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
Windows FAT32: cluster allocation question

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> File System
Author Message
_Dmitry_
Guest





Posted: Fri Oct 22, 2004 3:19 pm    Post subject: Windows FAT32: cluster allocation question Reply with quote

Hi,

I'd appreciate if a guru could answer following questions:

1. When creating a file on an empty Windows FAT32 volume, can I assume that
the file will be placed from the first available data cluster (that is, right
after the Root Directory)?

2. When populating a file on an empty FAT32 volume, can I assume that
cluster allocation will be linear (that is, written data will be stored in a
consecutive chain of clusters)?

------------------------------------------------------

Background: Our in-house hardware logs data to Compact Flash cards, and our
software extracts logged data afterwards. Before hardware can log data, we
need to initialise our cards by creating 1 file on the card that should take
the whole volume of the card.

OS: Windows XP, Windows 2000

Media: 512Mb, 1Gb, 4Gb Compact Flash cards formatted with FAT32

File creation technique: we use standard C library ( fopen, fwrite )

Encountered problems:
1) On Windows 2000 PCs we discovered that our file is not placed from the
beginning of the data area on the card but at an offset of 64K clusters from
the end of the Root Directory.

2) In some situations cluster allocation was not linear.

Thank you very much in advance.

Best regards,

Dmitry
Back to top
Dave August
Guest





Posted: Tue Oct 26, 2004 3:23 am    Post subject: Re: Windows FAT32: cluster allocation question Reply with quote

Dmitry,

In the old days what you said was true... but there are LOTS of caviets
here.. "empty" HAD to be freshly formatted, just deleting files is NOT good
enough... Again in the 'old days' Windows always allocated new files from
the unused area and not from where any files had been but were erased (most
likely to help keep things as consectuve as possible and to help file
recovery programs)...

You mat find that your best bet is to create "disk images" of what your
embedded hardware wants to see and use some other method to initilize your
cards... you can eaysily write a program using C that opens the PHYSICAL
device and does sector I/O to it... in effect 'cloning' an image that your
hardware will understand... Go check out the documentation ofn
CreateFile()... FYI I've done this for several clients who had similar
problems.... You can eaysilly write a special fromat program that does this
also....(creates the images it self instead of reading a file)

Dave



"_Dmitry_" <_Dmitry_@discussions.microsoft.com> wrote in message
news:6AC14657-E87E-4C15-AB96-F7C671CAEB6F@microsoft.com...
Quote:
Hi,

I'd appreciate if a guru could answer following questions:

1. When creating a file on an empty Windows FAT32 volume, can I assume
that
the file will be placed from the first available data cluster (that is,
right
after the Root Directory)?

2. When populating a file on an empty FAT32 volume, can I assume that
cluster allocation will be linear (that is, written data will be stored in
a
consecutive chain of clusters)?

------------------------------------------------------

Background: Our in-house hardware logs data to Compact Flash cards, and
our
software extracts logged data afterwards. Before hardware can log data, we
need to initialise our cards by creating 1 file on the card that should
take
the whole volume of the card.

OS: Windows XP, Windows 2000

Media: 512Mb, 1Gb, 4Gb Compact Flash cards formatted with FAT32

File creation technique: we use standard C library ( fopen, fwrite )

Encountered problems:
1) On Windows 2000 PCs we discovered that our file is not placed from the
beginning of the data area on the card but at an offset of 64K clusters
from
the end of the Root Directory.

2) In some situations cluster allocation was not linear.

Thank you very much in advance.

Best regards,

Dmitry
Back to top
Alex Nichol
Guest





Posted: Tue Oct 26, 2004 1:10 pm    Post subject: Re: Windows FAT32: cluster allocation question Reply with quote

_Dmitry_ wrote:

Quote:
Encountered problems:
1) On Windows 2000 PCs we discovered that our file is not placed from the
beginning of the data area on the card but at an offset of 64K clusters from
the end of the Root Directory.

Without being certain, that I think is quite likely policy. Possibly to
ensure there is space available to expand the root directory if needed.
Also space is needed in the root of the disk to hold the core data when
doing a dump; that again may need to be at this point so it can be
accessed without needing to explore.

Quote:
2) In some situations cluster allocation was not linear.

On a fresh formatted disk I would not expect that, provided a single
file was made in a manner that did not involve putting other files on
the disk as well (indexes, restore point directories in XP and the
like)

--
Alex Nichol MS MVP (Windows Technologies)
Bournemouth, U.K. Alexn@mvps.D8E8L.org (remove the D8 bit)
Back to top
_Dmitry_
Guest





Posted: Fri Nov 12, 2004 8:39 pm    Post subject: Re: Windows FAT32: cluster allocation question Reply with quote

Dave,

Thank you very much for your answers.
Direct IO is the way we are going to go, and it's great to hear you've done
it successfully on several occasions. It means it's not going to be too many
pitfalls :)
Again, thanks a million!
Dmitry


"Dave August" wrote:

Quote:
Dmitry,

In the old days what you said was true... but there are LOTS of caviets
here.. "empty" HAD to be freshly formatted, just deleting files is NOT good
enough... Again in the 'old days' Windows always allocated new files from
the unused area and not from where any files had been but were erased (most
likely to help keep things as consectuve as possible and to help file
recovery programs)...

You mat find that your best bet is to create "disk images" of what your
embedded hardware wants to see and use some other method to initilize your
cards... you can eaysily write a program using C that opens the PHYSICAL
device and does sector I/O to it... in effect 'cloning' an image that your
hardware will understand... Go check out the documentation ofn
CreateFile()... FYI I've done this for several clients who had similar
problems.... You can eaysilly write a special fromat program that does this
also....(creates the images it self instead of reading a file)

Dave



"_Dmitry_" <_Dmitry_@discussions.microsoft.com> wrote in message
news:6AC14657-E87E-4C15-AB96-F7C671CAEB6F@microsoft.com...
Hi,

I'd appreciate if a guru could answer following questions:

1. When creating a file on an empty Windows FAT32 volume, can I assume
that
the file will be placed from the first available data cluster (that is,
right
after the Root Directory)?

2. When populating a file on an empty FAT32 volume, can I assume that
cluster allocation will be linear (that is, written data will be stored in
a
consecutive chain of clusters)?

------------------------------------------------------

Background: Our in-house hardware logs data to Compact Flash cards, and
our
software extracts logged data afterwards. Before hardware can log data, we
need to initialise our cards by creating 1 file on the card that should
take
the whole volume of the card.

OS: Windows XP, Windows 2000

Media: 512Mb, 1Gb, 4Gb Compact Flash cards formatted with FAT32

File creation technique: we use standard C library ( fopen, fwrite )

Encountered problems:
1) On Windows 2000 PCs we discovered that our file is not placed from the
beginning of the data area on the card but at an offset of 64K clusters
from
the end of the Root Directory.

2) In some situations cluster allocation was not linear.

Thank you very much in advance.

Best regards,

Dmitry



Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> File System All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB