EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Forcing a FAT16 format onto a 4MB FAT12 CompactFlash card

Started by Ben Nguyen February 12, 2004
I have a 4MB card formatted with FAT12 and the code Ive inherited is
for
FAT16.  I bought a USB CF Card reader so that Windows XP/DOS could
format it,
but it also formats it to FAT12.  Is there any way to force a 4MB 
(currently FAT12) CF to FAT16.  I now its not as efficient, but it
would make things much easier for development.


Ben
Wouldn't it be easier to patch the code for FAT12 instead? FAT12 is used for
drives up to about 16MB, and FAT16 is used for 16MB to about 2GB.  The
reason FAT12 will always be chosen is because the tools will try to use the
optimized filesystem. By switching the 4MB card to FAT16, you will loose
some capacity. I do not see why it would be impossible to format the card as
FAT16, but if you cannot find a tool to do it, you will probably have to
write one yourself (or modify/hack the tool you use to format so that it
CANNOT choose FAT16.)

Another option would be to just use a 32MB CF card instead of the 4MB card,
this would force formatting to FAT16. Also, last time I checked, 32MB was
the smallest you can find easily nowadays (not that you CAN'T get 4, 8, or
16MB; they just aren't as availible.) This is the option I would go with,
but without knowing your specific needs or intentions, that may not be
possible.

At any rate, I thought FDISK allowed you to choose only FAT16 or FAT32 (by
choosing no when it asks if you want to enable large disk support.) I doubt
it would work with DOS and USB though. What about a CF-IDE adapter? Then you
can access the CF card like any other drive. Maybe "Partition Magic" from
PowerQuest would allow you to do this? I know it allows you to change
cluster sizes, but don't remember if it lets you change filesystems as well.

These are my thoughts, not necessarily expert opinions. I haven't messed
with filesystems in quite some time. Maybe somebody more knowledgable will
give a better answer.

Scott

P.S. Check out http://www.penguin.cz/~mhi/projects.html and see if it has
anything of help.
Specifically
http://www.penguin.cz/~mhi/fs/Filesystems-HOWTO/Filesystems-HOWTO.html
gnuPart looks like perhaps it could do the job you want.

"Ben Nguyen" <benn686@hotmail.com> wrote in message
news:e604be8.0402121829.5e5f8253@posting.google.com...
> I have a 4MB card formatted with FAT12 and the code Ive inherited is > for > FAT16. I bought a USB CF Card reader so that Windows XP/DOS could > format it, > but it also formats it to FAT12. Is there any way to force a 4MB > (currently FAT12) CF to FAT16. I now its not as efficient, but it > would make things much easier for development. > > > Ben
benn686@hotmail.com (Ben Nguyen) wrote in message news:<e604be8.0402121829.5e5f8253@posting.google.com>...
> I have a 4MB card formatted with FAT12 and the code Ive inherited is > for > FAT16. I bought a USB CF Card reader so that Windows XP/DOS could > format it, > but it also formats it to FAT12. Is there any way to force a 4MB > (currently FAT12) CF to FAT16. I now its not as efficient, but it > would make things much easier for development.
The type of FAT (FAT12/16/32) is dependant *only* on the number of clusters on the volume. If you have fewer than 4085, then you must use FAT12, volumes with 4085-65525 clusters must be formatted FAT16. Further, there are many, many, many implementations that are just a bit off at the boundaries, so it's strongly recommended that you do not create any volumes with sizes within about 16 clusters of the actual boundaries (leave some space unused at the end of the physical device if necessary). That being said, it's basically impossible to create enough 1KB clusters on a 4MB device to exceed 4084 (you don't count the reserved areas at the beginning of the volume - up to, and including, the root directory area). To manage it you'd have to create a volume with only a single FAT and a root directory with no more than 96 entries (you'll need to check my math here). And in any event that leaves you way too close to 4085 for comfort. If you format with 512 byte clusters, you should always get FAT16. Probably the definitive definition of FAT: http://www.microsoft.com/whdc/hwdev/hardware/fatgen.mspx
benn686@hotmail.com (Ben Nguyen) wrote in message news:<e604be8.0402121829.5e5f8253@posting.google.com>...
> I have a 4MB card formatted with FAT12 and the code Ive inherited is > for > FAT16. I bought a USB CF Card reader so that Windows XP/DOS could > format it, > but it also formats it to FAT12. Is there any way to force a 4MB > (currently FAT12) CF to FAT16.
Format with 512 bytes (1 sector) per cluster, at 4MB you'll just squeeze into FAT16. Infact I suspect you may encounter a problem finding a formatter that lets you specify such things on the command line or via a dialogue box, it's probably just as quick to use a disc editor.
> I now its not as efficient, but it > would make things much easier for development.
Sure, it makes the FAT a bit bigger, but for small files 1 sector per cluster could be more efficient for you... Sprow.
Ben Nguyen <benn686@hotmail.com> wrote:

> I have a 4MB card formatted with FAT12 and the code Ive inherited is > for FAT16. I bought a USB CF Card reader so that Windows XP/DOS > could format it, but it also formats it to FAT12. Is there any way > to force a 4MB (currently FAT12) CF to FAT16. I now its not as > efficient, but it would make things much easier for development.
First, I second the other opinions that this probably isn't a good plan. You're practically begging for trouble down the road. If you still insist you have to do id that way, you may have better luck with non-MS tools. GNU mtools, e.g., come with a program that does let you choose the FAT type (and just about everything else, too) explicitly. If they don't work on Windows, you could still use a friendly Linux near you to do this once, then image the CF and replay that image instead of formatting. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
I found a utility that looks promising (Diskman : www.diskman.co.uk).
Ill try it tonight and post my results.

Im not very familiar with this file systems so Ill just cut and paste 
what it says about it:

"4MB is VERY SMALL for FAT16. You will be able to do but
only just 4MB

=4194304 bytes
=8192 sectors

Therefore, using very small clusters (1 sector sized) you will have about
8000 clusters. The minimum for FAT16 is 4085, therefore this is okay.
However, if bigger clusters were required (2 sectors) there wouldn't be
enough of them to make it FAT16. Looking at the DM source code it appears
that the smallest FAT16 volume possible (by my sums) is about 2.5MB.
FAt12 make better use of the space in small volumes."
In article <e604be8.0402121829.5e5f8253@posting.google.com>,
Ben Nguyen <benn686@hotmail.com> wrote:
>I have a 4MB card formatted with FAT12 and the code Ive inherited is >for >FAT16. I bought a USB CF Card reader so that Windows XP/DOS could >format it, >but it also formats it to FAT12. Is there any way to force a 4MB >(currently FAT12) CF to FAT16. I now its not as efficient, but it >would make things much easier for development.
Format the card on a linux system. fdisk /dev/hde Alternatively : Format the card on a digital camera that accepts it. Windows XP can handle FAT16 cards, at least on my Toshiba and PCMCIA interface. (If you are a developer, you should at least consider Linux. As a system for development, it beats Windows XP ten times over.)
>Ben
Groetjes Albert -- Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS One man-hour to invent, One man-week to implement, One lawyer-year to patent.
On 12 Feb 2004 18:29:14 -0800, benn686@hotmail.com (Ben Nguyen) wrote:

>I have a 4MB card formatted with FAT12 and the code Ive inherited is >for >FAT16. I bought a USB CF Card reader so that Windows XP/DOS could >format it, >but it also formats it to FAT12. Is there any way to force a 4MB >(currently FAT12) CF to FAT16. I now its not as efficient, but it >would make things much easier for development. >
Hi, Try Partition Magic. It can convert from different file formats. It can convert from FAT-16 <-> FAT-32. I am not sure if it can convert from FAT-12 <-> FAT-16. Regards Anton Erasmus

Memfault Beyond the Launch