update FAT32 file starting cluster number

0

I have a system that write files to a FAT32 partition but it frequently write the wrong starting cluster number for some files. I would like a software that is easy to use so I can just find the file in the root directory table and update that file's starting cluster number. If it is in command line mode it is more easy to use too . Is there such a software or how I can do that?

Au Kevin

Posted 2011-10-01T06:39:58.957

Reputation:

All these files are in the root directory of the partition. So we do not need go deep into the many sub-folders and files. – None – 2011-10-04T02:49:15.063

Answers

0

You can use the Win32 defrag API to move the clusters of a file to a specific location in the volume: http://msdn.microsoft.com/en-us/library/windows/desktop/aa363911%28v=VS.85%29.aspx#defragmenting_a_file

Note that for very small files (less than 1KB) the file may not occupy any clusters at all because it is stored in the file's page in the file table.

Eric Nicholson

Posted 2011-10-01T06:39:58.957

Reputation: 101

Hi, Thanks but I think this is not what I want. The file data has been written to the partition as well as the file. But the file's starting cluster number in the root directory table is wrong. It points to the wrong location. What I want is to update that file's starting cluster number to point to the correct location. Simply put, it is to read and update some information in the root directory table. – None – 2011-10-04T02:45:25.127

Are you implementing a FAT32 driver or using a broken one? If the directory table is wrong, how do you know where the file is? – Eric Nicholson – 2011-10-04T13:50:51.513

Actually the file, or more correctly, the file's root directory table information is wrong. – None – 2011-10-05T07:25:51.030