Re: [Hampshire] FAT32 problems

Top Page

Reply to this message
Author: Chris Simmonds
Date:  
To: rogermunford, Hampshire LUG Discussion List
Subject: Re: [Hampshire] FAT32 problems
Roger Munford wrote:
> I have written a data logging programme which stores data on an 8GB USB
> drive and has worked without problem for some time until disk access to
> the drive became more and more sluggish (files were deleted and so the
> number at any time was no bigger that 100). The hardware is a National
> Instruments cRio, VxWorks OS.
> The only possible problem that I discovered is a warning in
> documentation is that the file system is FAT and filenames should be
> limited to the 8.3 format. I wasn't aware of that and used filenames 14
> characters long.
>
> The problem only shows itself when using FTP to list files. It seems
> that data transfer is OK from the USB drive. It looks as if the system
> drive is OK for all FTP operations.
>
> I suppose I will have to change the software to conform to the 8.3 limit
> but I am not at all confident that this is the root of the problem
> since the datalogging software seems to work well and it has taken a
> long time for problem to emerge. Another worry is that by having used
> the illegal filename size, somehow the structure of the disk has been
> changed and it may have to be reformatted.
>
> Can anybody throw light on this.
>
> Thanks
>
> Roger
>


Hi Roger,

FAT32 (vfat in Linux) allows long file names, up to 256 characters. It
does it in a way that is compatible with 8.3 file names in earlier FAT
file systems by constructing a unique 8.3 name and then adding a chain
of "hidden" directory entries which together contain the long name.
Older software does not see the hidden entries and so only shows the
short name. Try mounting a fat32 file system on Linux with -t msdos to
get the feeling of how it works.

Regarding the slow disk access you are seeing, I can think of two
reasons. First, FAT file systems suffer greatly from fragmentation. The
long names contribute slightly to that, but I doubt it makes that much
difference. Try reformatting the drive and see if that improves things.
The other possibility is the drive itself. If it is a flash drive, as I
suspect from the size, they have a limited lifetime. After a while some
of the storage blocks in flash become bad (unusable) and the micro
controller that manages the flash memory has to start moving data around
every time there is a write or delete operation - this is called wear
levelling. Data logging type applications are especially bad because
they do a lot of regular short writes. To test this theory, try it with
a new USB flash stick.

HTH,
Chris.

-- 
Chris Simmonds                   2net Limited
chris@???                 http://www.2net.co.uk/