AnsweredAssumed Answered

MFS FAT Corruption

Question asked by Robert Hodson on Sep 26, 2012
Latest reply on Oct 1, 2012 by Fabi
Branched to a new discussion

We had a unit returned that we believe was powered down when MFS was in an unsafe state. It ended up on my desk with a wiped boot sector, and I tried to design an experiment to replicate the problem, by cutting power to a unit, with MFS in various random states such as:files open, the middle of write, and in process of deletion (this one really jacks things up BTW). I was able to seriously mangle things up, and was surprised to find that Microsoft chkdsk.exe couldn't make things even partly right.

 

Then I remembered seeing a reference in MFS source that set  #define MFSCFG_NUM_OF_FATS 1, and reading some white papers on chkdsk.exe suggested that a single FAT table might cause prevent a chkdsk type program from fixing common errors as the secondary FAT provides backup and is relied on for certain errors (2 FAT tables are the standard).

 

Well adding #define MFSCFG_NUM_OF_FATS 2 in my User_Config.h file really made a mess of things.

Here is a screen shot of the directory structure after rebuilding MQX 3.8 with the new setting. Then my code calling

ioctl(fshandle, IO_IOCTL_DEFAULT_FORMAT,NULL);

followed by several hundred ioctl(fshandle, IO_IOCTL_CREATE_SUBDIR, (uint_32_ptr)dirName) and fwrite operations.

 

 

QUESTION TIME: IF I missed a step what do I need to do to make it all work nice?

Outcomes