FAT file system on NAND flash memory

Seongsu Lee senux at senux.com
Tue May 29 13:09:26 EDT 2007


On Thu, Apr 12, 2007 at 08:55:23AM -0500, Josh Boyer wrote:
> On 4/12/07, Seongsu Lee <senux at senux.com> wrote:
> > Hi,
> >
> > In my knowledge, mtdblock.c must be used to use
> > FAT filesystem on bare NAND flash memories
> > because NFTL is made only for a specific hardware,
> > DiskOnChip.
> >
> > (Layer 0) VFS
> > (Layer 1) FAT (or EXT2, EXT3)
> > (Layer 2) mtdblock.c (nftl.c can be used only with DiskOnChip)
> > (Layer 3) NAND flash memory driver (vendor specific)
> > (Layer 4) Physical NAND flash memory
> >
> > Please let me know if it is wrong.
> 
> That layering is correct, but your results will be bad.  mtdblock
> doesn't handle bad blocks.  So if you have one in the middle of your
> filesystem, it will break things.  You need some kind of translation
> layer if you're going to use NAND.
> 
> josh

I did not know that ftl.c is can be used also in 'Layer 2' instead
of dummy mtdblock.c. It's working. I confirmed that the ftl.c can 
be used on mtdram. I will test whether it works on a physical 
bare-nand flash memory. (maybe tomorrow)

Follow is what I have tested for a mtdram (64MB).

root at thermopylae:/mnt # modprobe mtdram

root at thermopylae:/mnt # modprobe mtdchar

root at thermopylae:/mnt # ftl_format /dev/mtd0
Partition size = 64 mb, erase unit size = 128 kb, 1 transfer units
Reserved 5%, formatted size = 62883328 bytes
Erasing all blocks...
+++++++*+++++++*+++++++*+++++++*+++++++*+++++++*+++++++*+++++++*
Writing erase unit headers...
format successful.

root at thermopylae:/mnt # modprobe ftl

root at thermopylae:/mnt # lsmod
Module                  Size  Used by
ftl                    11404  0
mtd_blkdevs            10368  1 ftl
mtdchar                 9092  0
mtdram                  3972  0
mtdcore                 7172  6 mtd_blkdevs,mtdchar,mtdram
autofs4                22788  1
3c59x                  43560  0
b44                    27276  0
ext3                  122504  1
jbd                    59048  1 ext3

root at thermopylae:/mnt # mkfs.ext3 /dev/ftla
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
15360 inodes, 61408 blocks
3070 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=62914560
8 block groups
8192 blocks per group, 8192 fragments per group
1920 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

root at thermopylae:/mnt # mount /dev/ftla /mnt/data0

root at thermopylae:/mnt # df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1              29G  9.7G   18G  36% /
tmpfs                 507M     0  507M   0% /dev/shm
/dev/hdb1              95G  126M   90G   1% /mnt/data1
/dev/ftla              59M  5.2M   50M  10% /mnt/data0

-- 
Seongsu's personal blog - http://www.senux.com/
lp1 on fire (One of the more obfuscated kernel
messages)




More information about the linux-mtd mailing list