I have console access to an embedded linux device. This device has flash memory part of which is partitioned as a FAT filesystem.

Its running linux-2.6.31.

However I am seeing these errors on the console these days and the FAT file system becomes read only.

111109:154925 FAT: Filesystem error (dev loop0)
111109:154925 fat_get_cluster: invalid cluster chain (i_pos 0)
111109:154925 FAT: Filesystem error (dev loop0)
111109:154925 fat_get_cluster: invalid cluster chain (i_pos 0)

I cannot understand why this happened? What is the root cause? And what is the fix? I would appreciate answers that can point me how to investigate the possible root cause of this issue on the device.

link|improve this question

60% accept rate
is the flash memory corrupted? – The Unix Janitor Nov 16 '11 at 22:44
1  
Have you performed a disk check? chkdsk in a windows for example. – The_aLiEn Nov 16 '11 at 22:52
Flash memory is not corrupted, however I see this error every now and then. I want to figure out why is it happening ? Because of the bug in the software or is it the flash memory part that has a problem. – abc Nov 16 '11 at 23:00
Probably not a software bug, FAT is very well tested. Maybe the flash is corrupted to to sudden powerloss. Make sure you have backup / dd image of that disk. – AndreasM Nov 17 '11 at 8:03
Thanks Andreas. Do you think there could be a kernel bug. Because this device has kernel customized for the device. – abc Nov 17 '11 at 19:21
feedback

1 Answer

The errors you are getting invalid cluster chain and filesystem error clearly shows that it is filesystem error.

Wikipedia entry on FAT says:

A partition is divided up into identically sized clusters, small blocks of contiguous space. Cluster sizes vary depending on the type of FAT file system being used and the size of the partition, typically cluster sizes lie somewhere between 2 kB and 32 kB. Each file may occupy one or more of these clusters depending on its size; thus, a file is represented by a chain of these clusters (referred to as a singly linked list). However these clusters are not necessarily stored adjacent to one another on the disk's surface but are often instead fragmented throughout the Data Region.

The File Allocation Table (FAT) is a list of entries that map to each cluster on the partition. Each entry records one of five things:

  • the cluster number of the next cluster in a chain
  • a special end of clusterchain (EOC) entry that indicates the end of a chain
  • a special entry to mark a bad cluster
  • a zero to note that the cluster is unused

This link says that somebody had solved similar problem with memory card using fsck.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.