About FAT32 and mkfs.vfat
Posted: Wed Sep 13, 2017 1:47 pm
Hello again !
I finished implementing a read/write FAT32 driver, and it was working fine (did not do delete or mkdir but everything else was good) until i started to read files that are more than 512 bytes in size. The FAT says that the files are 1 clusters (= the first cluster of the file points to 0x0, not EOC but whatever...), and the BPB tells me that sectors_per_cluster = 1. I formatted the partition with mkfs.vfat -F 32, and after a lots of checks and considerations, i read that on the wiki :
"Several developers also make the error of passing -F to mkdosfs in an attempt to choose a FAT size, which often has the effect of creating a corrupt filesystem since the result doesn't follow the official rule for FAT sizes anymore." (http://wiki.osdev.org/FAT#Creating_a_fr ... filesystem)
I was wondering : What does "a corrupt filesystem" means ? Could it be the source of my problems ? And then how does linux to deal with this filesystem (because editing files, even files that are more than 512 bytes, is working fine on it) ? Finally, how should i format the partition without using mkfs.vfat -F 32 ?
Thanks for reading ! (and sorry if my english is bad, i'm french)
(EDIT: i also have problems to read directory that have lots of entries, and i think again that it could be because the dir is taking more than 1 sector or cluster, but the FAT tells me the opposite)
I finished implementing a read/write FAT32 driver, and it was working fine (did not do delete or mkdir but everything else was good) until i started to read files that are more than 512 bytes in size. The FAT says that the files are 1 clusters (= the first cluster of the file points to 0x0, not EOC but whatever...), and the BPB tells me that sectors_per_cluster = 1. I formatted the partition with mkfs.vfat -F 32, and after a lots of checks and considerations, i read that on the wiki :
"Several developers also make the error of passing -F to mkdosfs in an attempt to choose a FAT size, which often has the effect of creating a corrupt filesystem since the result doesn't follow the official rule for FAT sizes anymore." (http://wiki.osdev.org/FAT#Creating_a_fr ... filesystem)
I was wondering : What does "a corrupt filesystem" means ? Could it be the source of my problems ? And then how does linux to deal with this filesystem (because editing files, even files that are more than 512 bytes, is working fine on it) ? Finally, how should i format the partition without using mkfs.vfat -F 32 ?
Thanks for reading ! (and sorry if my english is bad, i'm french)
(EDIT: i also have problems to read directory that have lots of entries, and i think again that it could be because the dir is taking more than 1 sector or cluster, but the FAT tells me the opposite)