Any recommendation regarding flash file system and media?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Any recommendation regarding flash file system and media?

1,832 Views
EdSutter
Senior Contributor II

I've got my SABRESD board booting through SPI-NOR on ECSPI5 (hardware modified), and

I've installed the Kernel image and ROOTFS (ext2) on the eMMC, so I can now boot independent of

both the network and the SD card.  So far so good.

With this configuration in place, I was on the SABRESD's console while testing a driver

and I noticed something scary...

I tftp'd a file (script) to the board and ran it.  It worked fine.

Then I reset the board and allowed it to reboot (through SPI-NOR, using eMMC for kernel & rootfs).

I log in (root) and see the script where I put it, with the correct size but when I tried to execute

it, nothing happened.  Then I just tried to 'cat' the file and it acted like the file was empty; however

ls -l showed me that the file size was correct.  I was able to re-download the file; however, I have

no idea why the file kinda disappeared.  Not good!

So, my first question is: how resilient is the file system to arbitrary resets?

Second question: is there any data regarding the best FS choice (yaffs/jffs2/ext/etc...) to use

with eMMC?

Thanks for any thoughts,

Ed

Labels (2)
0 Kudos
4 Replies

946 Views
bryanthomas
NXP Employee
NXP Employee

ext2 is ok to use for short term projects, but it is not a file system that is designed for extended use on a flash device in production. UBIFS and then eventually UFS are better candidates for your long term needs. In any case, unexpected resets can cause file corruption unless a write on power failure method is employed to save data that is not committed.

There are a couple of things you can do to stop corruption from happening in a limited development environment while you are testing.

1. use the halt command on shutdown

2. use the sync command after writing small amounts of data to the media

If you are generating your file system using LTIB then the jffs2 file system is created by default and could be used without much extra effort.

You can also try the other file systems by selecting them in the ltib configuration menu

$ ./ltib -m config

Then select:

Target Image Generation -> Options -> Choose your root filesystem image type

This will bring up a list of many file systems that you can choose from for the Target image

of note are ubifs and jffs2

946 Views
EdSutter
Senior Contributor II

Thanks much, what about the underlying media?  I'm hoping to use eMMC, does JFFS2 care about that?

AFAIK, JFFS2 is for NOR and NAND, does it work on an SD-ish memory interface?

0 Kudos

946 Views
bryanthomas
NXP Employee
NXP Employee

For managed NAND devices like eMMC you should use btrfs or ext2/3/4.

0 Kudos

946 Views
EdSutter
Senior Contributor II

Bryan,

Thanks again, never heard of btrfs, so I'll look into that.

Meanwhile, if anyone else finds themselves on a similar quest I found this

paper from Micron which seems reasonably recent and helpful...

http://www.micron.com/~/media/Documents/Products/Software%20Article/SWNL_choosing_linux_fs_for_flash...

0 Kudos