2009-05-14 06:22:03 a problem of file-backed vfat filesystem
Nicole Otsuka (CHINA)
Message: 74052
according to the docs of File-backed Storage Gadget, i created a file-backed vfat fs and did a test:
1,use "cd" to enter the vfat directory
2,use "mkdir" to create a new directory and "ls" to make sure it is created
3,TURN off the power of board directly,and then turn on the power
4,"ls" the vfat directory
the result is that directory i created during STEP2 disappears.
i also did the same test on a yaffs filesystem,the result is different.
i can see the dir i created before i turned off the power
i think it is a character of file-backed vfat fs. the "mkdir" just created a directory in the cache of filesystem.
but my application should consider this emergency.can you give me some ideas?thank you~
p.s. i also found that the bigger file like .jpg can be reserved while a text file(only hundreds bytes) would disappear.
QuoteReplyEditDelete
2009-05-14 06:30:29 Re: a problem of file-backed vfat filesystem
Mike Frysinger (UNITED STATES)
Message: 74053
umm, nowhere in the documentation does it tell you to turn off the power to the board. that's how you lose data. FAT filesystems cannot handle power failure gracefully while flash based filesystems (like yaffs) can. so what you describe sounds like expected behavior.
QuoteReplyEditDelete
2009-05-14 06:59:57 Re: a problem of file-backed vfat filesystem
Nicole Otsuka (CHINA)
Message: 74057
thank you mike
i know what you said but our application need to cope with the expected behavior
our testing engineer did this kind of test in our application and found some data would be lost in this situation...
so, i just want to find some resolution to prepare for it.
oh~ i find another problem just now......after vfat fs is using for some period of time ,it will be set to readonly
does it mean that i cant read and wirte the fs for many times?
QuoteReplyEditDelete
2009-05-14 07:11:29 Re: a problem of file-backed vfat filesystem
Mike Frysinger (UNITED STATES)
Message: 74058
then you need to add code to your system to periodically force a full filesystem sync
besides, the behavior you describe is how any USB device is expected to behave. even under Windows, you cant go yanking the USB device and expect things to magically work. that is why Windows has an icon in the system tray to safely remove USB storage devices. this sends a notice to the USB device that it should save all of its state.
QuoteReplyEditDelete
2009-05-14 07:33:05 Re: a problem of file-backed vfat filesystem
Nicole Otsuka (CHINA)
Message: 74059
if i want to force a sync,can you tell me how can i do or give me some example code?
you bet.but i think it's just the situation when connecting PC as a USB device.
any of embedded device like PSP or NDSL,it will also write a save log to the flash(SD,TF,MEMORY CARD) if a player save his game. And in most time he may turn off the power after saving.
maybe the file-backed fs is only designed for USB device.but we also need to consider the other situation.
thank you mike~
QuoteReplyEditDelete
2009-05-14 07:45:20 Re: a problem of file-backed vfat filesystem
Mike Frysinger (UNITED STATES)
Message: 74060
read the sync or fsync man page
your PSP/DS example is also invalid. every time a console goes to save the game or write any other kind of information to flash, it displays a huge (often flashing) warning about *not* turning off the power while this operation is occurring. that means if the end user ignores it and turns off the power anyways, it's *their fault* if something goes wrong.
QuoteReplyEditDelete
2009-05-15 23:32:21 Re: a problem of file-backed vfat filesystem
Nicole Otsuka (CHINA)
Message: 74122
i'll try it~
you did gave me a good advice.thank you very much