Skip to contentSkip to conversation

FAT on NAND

SPAM [email protected] 5 participants 9 messages Apr 4, 2003 – Apr 7, 2003 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi, all:

What I am doing now is to build a filesystem which can be recognized on _raw_ NAND flash. So, I think FAT will be the only choice(though I know it's very unstable). And I have following question now:

1.How unstable would it be? Does it support:
a.journaling (crash/power-off safe ,I mean)
b.bad block management
c.wear levelling
d.error correction
e.something else I dont know to make the FS reliable
2.I have checked the NAND flash docoment (especially
the "Filesystems supporting NAND"chapter) and I found out that
it seems no way to build a FAT on a bare NAND flash but only on
the SmartMediaCards, am I right? Or the SM card and the bare NAND
are just the same thing when a FAT on it.
3.Maybe I misunderstood,but David Woodhouse had told me that I should apply layers like FAT->NFTL->NAND if I wanna build a FAT on a NAND flash.But I learned that the NFTL only support Doc from the
NAND flash document, isnt it? And what should I do to support the
FAT ?
4.Everybody tells me that the Fat on a NAND is not reliable,but I
think USB mass storage are based on NAND and got a FAT (or some
filesystem which windows can recognize) on it, so ,how comes it
happen?

BTW:Why my mail sent to the maillist always "awaits moderator approval"?

TIA

Jim Zeus

______________________________________

===================================================================

#1 lore raw
Quoted 6 lines · On Fri, 2003-04-04 at 07:21, [email protected] wrote:

Hi, all:

What I am doing now is to build a filesystem which can be recognized on _raw_ NAND flash. So, I think FAT will be the only choice(though I know it's very unstable). And I have following question now:

Windows won't recognise raw NAND flash anyway. You'll have to write _some_ kind of driver for Windows.

Quoted 2 lines

1.How unstable would it be? Does it support:
a.journaling (crash/power-off safe ,I mean)

No.

Quoted 1 line

b.bad block management

No.

Quoted 1 line

c.wear levelling

No.

Quoted 1 line

d.error correction

No.

Quoted 1 line

e.something else I dont know to make the FS reliable

No.

Quoted 9 lines

2.I have checked the NAND flash docoment (especially
the "Filesystems supporting NAND"chapter) and I found out that
it seems no way to build a FAT on a bare NAND flash but only on
the SmartMediaCards, am I right? Or the SM card and the bare NAND
are just the same thing when a FAT on it.
3.Maybe I misunderstood,but David Woodhouse had told me that I should apply layers like FAT->NFTL->NAND if I wanna build a FAT on a NAND flash.But I learned that the NFTL only support Doc from the
NAND flash document, isnt it? And what should I do to support the
FAT ?

I told you to use the SmartMedia format, not NFTL. You can do that on any NAND hardware; NFTL has silly patent problems in some parts of the world.

But really you should have a file system directly on the flash, not a translation layer pretending to be a block device.

Quoted 4 lines

4.Everybody tells me that the Fat on a NAND is not reliable,but I think USB mass storage are based on NAND and got a FAT (or some filesystem which windows can recognize) on it, so ,how comes it happen?

It's not reliable, as you were told.

Quoted 1 line

BTW:Why my mail sent to the maillist always "awaits moderator approval"?

The ones you send as HTML get bounced for that reason. The rest are trapped because SpamAssassin doesn't like them...

X-Spam-Status: Yes, hits=7.7 required=5.0

        tests=AWL,NO_REAL_NAME,RCVD_IN_OSIRUSOFT_COM,RCVD_IN_RFCI,
        SPAM_PHRASE_00_01,X_OSIRU_SPAM_SRC version=2.44
Signature · 1 line
dwmw2
#5 lore raw
In reply to [email protected]
Quoted 4 lines · On Friday 04 April 2003 08:21, [email protected] wrote:

What I am doing now is to build a filesystem which can be recognized on _raw_ NAND flash. So, I think FAT will be the only choice(though I know it's very unstable). And I have following question now:

For what ? Why don't you use JFFS2 or YAFFS, which handle NAND out of the box ?

Quoted 6 lines

1.How unstable would it be? Does it support:
a.journaling (crash/power-off safe ,I mean) b.bad block management
c.wear levelling
d.error correction
e.something else I dont know to make the FS reliable

JFFS2 and YAFFS have all this, read the source and build a new one, if you have enough time.

Quoted 5 lines

2.I have checked the NAND flash docoment (especially the "Filesystems supporting NAND"chapter) and I found out that it seems no way to build a FAT on a bare NAND flash but only on the SmartMediaCards, am I right? Or the SM card and the bare NAND are just the same thing when a FAT on it.

SMCard and bare NAND is just the same, only packaging is different

Quoted 5 lines

3.Maybe I misunderstood,but David Woodhouse had told me that I should apply layers like FAT->NFTL->NAND if I wanna build a FAT on a NAND flash.But I learned that the NFTL only support Doc from the NAND flash document, isnt it? And what should I do to support the
FAT ?

Hack NTFL :)

Quoted 4 lines

4.Everybody tells me that the Fat on a NAND is not reliable,but I think USB mass storage are based on NAND and got a FAT (or some filesystem which windows can recognize) on it, so ,how comes it happen?

Yes, this is Smart-Media-FAT, which is not exactly the same as DOS-FAT. SmartMedia-FAT is used on SmartMedia cards for MP3-Players, Digicams ... There exist various adapters (USB, serial, LPT) to access it via a PC. SmartMedia-FAT is designed for NAND-FLASH and handles bad block management and error correction.
If you want compability to this, you have to write a fs-driver, which is compatible to the SMART-Media-FAT definition, which is available from Toshiba under a non disclosure aggreement.

Signature · 5 lines
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: [email protected]
#8 lore raw
In reply to [email protected]

Jim

As you see from David and Thomas, there is wide agreement that FAT on NAND is not a good idea if you want reliable storage.

Some associates of mine using WinCE tried three different commercial FAT-on-NAND solutions before they gave up and moved to YAFFS for data integrity and speed reasons.

The easiest way to get FAT-on-NAND is to use SmartMedia. This is used by MP3 players, cameras etc. It works OK, has wear levelling (of a sort - not explicit wear levelling). As Thomas says, this is not pure FAT but is very close and it looks like FAT from the operating system. I would not trust it for any data I cared about or if I needed a fast file system.

I have had a look at what is required to get YAFFS working on Windows (98, 2000, XP). I think this would be far easier, and give far better results, than trying to make FAT robust.

-- CHarles

author
#2 lore raw
In reply to David Woodhouse
Quoted 7 lines
Quoted 3 lines

What I am doing now is to build a filesystem which can be recognized on _raw_ NAND flash. So, I think FAT will be the only choice(though I know it's very unstable). And I have following question now:

Windows won't recognise raw NAND flash anyway. You'll have to write _some_ kind of driver for Windows.

Since the MTD block device(which include nand.c,mtdcore.c and mtdblock.c) is a block device, why I can't build any filesystem on it?
And, what's the difference between MTD block device and NFTL if they stay on the same layer? Even though I cant use NFTL because of some "silly patent problem" ,I still wanna know it, thanks.

Quoted 13 lines
Quoted 2 lines

1.How unstable would it be? Does it support:
a.journaling (crash/power-off safe ,I mean)

No.

Quoted 1 line

b.bad block management

No.

Quoted 1 line

c.wear levelling

No.

Quoted 7 lines
Quoted 1 line

d.error correction

No.

Quoted 1 line

e.something else I dont know to make the FS reliable

No.

Then, maybe the lower layer (MTD or NFTL) support it? or all the stuff(a.b.c.d.e) are supported only by the file system (JFFS2/YAFFS,I mean)?

Quoted 11 lines
Quoted 10 lines

2.I have checked the NAND flash docoment (especially
the "Filesystems supporting NAND"chapter) and I found out that
it seems no way to build a FAT on a bare NAND flash but only on
the SmartMediaCards, am I right? Or the SM card and the bare NAND
are just the same thing when a FAT on it.
3.Maybe I misunderstood,but David Woodhouse had told me that I should apply layers like FAT->NFTL->NAND if I wanna build a FAT on a NAND flash.But I learned that the NFTL only support Doc from the
NAND flash document, isnt it? And what should I do to support the
FAT ?

Quoted 3 lines

I told you to use the SmartMedia format, not NFTL. You can do that on any NAND hardware; NFTL has silly patent problems in some parts of the world.

Thank you, but what is the SmartMedia format? Sorry I am not familiar with that.

Quoted 4 lines

But really you should have a file system directly on the flash, not a translation layer pretending to be a block device.

Do you mean build a totally new FS on a _bare_ NAND flash or on a MTD? You are so right, but I must build a FS which Windows can recognize and I have no enough time to do this before the time limit.

Quoted 11 lines
Quoted 4 lines

4.Everybody tells me that the Fat on a NAND is not reliable,but I think USB mass storage are based on NAND and got a FAT (or some filesystem which windows can recognize) on it, so ,how comes it happen?

It's not reliable, as you were told.

Quoted 1 line

BTW:Why my mail sent to the maillist always "awaits moderator approval"?

The ones you send as HTML get bounced for that reason. The rest are trapped because SpamAssassin doesn't like them...

I think my mail is txt but not in HTML.Whatever, I hope it won't happen anymore:)

Quoted 10 lines

X-Spam-Status: Yes, hits=7.7 required=5.0

        tests=AWL,NO_REAL_NAME,RCVD_IN_OSIRUSOFT_COM,RCVD_IN_RFCI,
        SPAM_PHRASE_00_01,X_OSIRU_SPAM_SRC version=2.44
Signature · 1 line
dwmw2
author
#6 lore raw
In reply to Thomas Gleixner
Quoted 6 lines
Quoted 4 lines

What I am doing now is to build a filesystem which can be recognized on _raw_ NAND flash. So, I think FAT will be the only choice(though I know it's very unstable). And I have following question now:

For what ? Why don't you use JFFS2 or YAFFS, which handle NAND out of the box ?

Because I've got to build a FS which can be accessed by Windows and Linux at the same time.I think JFFS2/YAFFS can't be recognized by Windows nowadays.
And , it seems like I have to support some device layer between the FS and Flash so the Linux can access it, isn't it?
Is there anyway else I can choose?

Quoted 9 lines
Quoted 7 lines

1.How unstable would it be? Does it support:
a.journaling (crash/power-off safe ,I mean) b.bad block management
c.wear levelling
d.error correction
e.something else I dont know to make the FS reliable

JFFS2 and YAFFS have all this, read the source and build a new one, if you have enough time.

Are all the functions supported by JFFS2/YAFFS? Somebody told me the wear levelling is supported by MTD

And It seems like I don't have enough time ,maybe I can finish it with all my leisure time.

Quoted 4 lines
Quoted 4 lines

4.Everybody tells me that the Fat on a NAND is not reliable,but I think USB mass storage are based on NAND and got a FAT (or some filesystem which windows can recognize) on it, so ,how comes it happen?

Quoted 8 lines

Yes, this is Smart-Media-FAT, which is not exactly the same as DOS-FAT. SmartMedia-FAT is used on SmartMedia cards for MP3-Players, Digicams ... There exist various adapters (USB, serial, LPT) to access it via a PC. SmartMedia-FAT is designed for NAND-FLASH and handles bad block management and error correction.
If you want compability to this, you have to write a fs-driver, which is compatible to the SMART-Media-FAT definition, which is available from Toshiba under a non disclosure aggreement.

Does the SMART-Media-FAT build directly on a _bare_ NAND Flash ? If it is, That's nothing useful to me 'cause Linux cant access it.

Thanks a lot for answering my questions

Your Faithful
Jim Zeus

#7 lore raw
Quoted 7 lines · Jim Zeus
Quoted 2 lines

For what ? Why don't you use JFFS2 or YAFFS, which handle NAND out of the box ?

Because I've got to build a FS which can be accessed by Windows and Linux at the same time.I think JFFS2/YAFFS can't be recognized by Windows nowadays. And , it seems like I have to support some device layer between the FS and Flash so the Linux can access it, isn't it?
Is there anyway else I can choose?

No, but AFAIK is there a Windows driver for YAFFS.

Quoted 2 lines

Are all the functions supported by JFFS2/YAFFS? Somebody told me the wear levelling is supported by MTD

Crap, MTD just provides the low level interface. Bad block management, wear levelling and journalling must be done in the fs driver.

Quoted 2 lines

Does the SMART-Media-FAT build directly on a _bare_ NAND Flash ? If it is, That's nothing useful to me 'cause Linux cant access it.

You can build it on bare FLASH: But that's not the correct way for LINUX. Your have to build a filesystem driver, which acts on top of MTD.

1. fs-driver
2. MTD-block-device-driver
3. MTD-partition-driver
4. Generic NAND-driver
5. yourHardwareInterface-driver

2, 3 and 4 exist.
5 is easy to build (copy an existing one and modify it to fit your hardware)

1 has to be written from scratch.
The specifications of SmartMedia-FAT are available from
http://www.ssfdc.or.jp/english/index.htm

Signature · 5 lines
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: [email protected]
#3 lore raw
In reply to Jim Zeus

David didn't respond (yet), so you have to settle with my words of lesser wisdom. :)

Quoted 8 lines · Jim Zeus
Quoted 4 lines

Windows won't recognise raw NAND flash anyway. You'll have to write _some_ kind of driver for Windows.

Since the MTD block device(which include nand.c,mtdcore.c and mtdblock.c) is a block device, why I can't build any filesystem on it?

Oh, you can. But you won't have a-d, unless you use a working nftl.

Quoted 4 lines

And, what's the difference between MTD block device and NFTL if they stay on the same layer? Even though I cant use NFTL because of some "silly patent problem" ,I still wanna know it, thanks.

Disclaimer: I've never even tried nftl or know of anyone that has.

Nftl (or any variant of that theme) should take care of b, d, possibly c and - as a side effect - also of a.
Nftl has no knowledge about the file system on top of it. So you can still get the possibility of inconsistent file systems, unless you use some variant of ffs or a journaling file system.

Whether existing implementations actually do this under all circumstances is highly questionable, given the userbase the code has. Do you own tests.

Quoted 17 lines
Quoted 17 lines
Quoted 2 lines

1.How unstable would it be? Does it support:
a.journaling (crash/power-off safe ,I mean)

No.

Quoted 1 line

b.bad block management

No.

Quoted 1 line

c.wear levelling

No.

Quoted 1 line

d.error correction

No.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

e.something else I dont know to make the FS reliable

No.

Then, maybe the lower layer (MTD or NFTL) support it? or all the stuff(a.b.c.d.e) are supported only by the file system (JFFS2/YAFFS,I mean)?

Jffs2 does support it, yaffs should also (not sure, never used it).

Quoted 7 lines
Quoted 2 lines

But really you should have a file system directly on the flash, not a translation layer pretending to be a block device.

Do you mean build a totally new FS on a _bare_ NAND flash or on a MTD? You are so right, but I must build a FS which Windows can recognize and I have no enough time to do this before the time limit.

Mtd is as good as a bare nand. In the traditional unix world of character and block devices, flash is neither one nor the other. Thus, mtd devices were created as a third kind. They usually give you enough abstraction to ignore chip specifics, sometimes not even that.

A *very* thin layer.

Jörn

Signature · 4 lines
To recognize individual spam features you have to try to get into the
mind of the spammer, and frankly I want to spend as little time inside
the minds of spammers as possible.
-- Paul Graham
#4 lore raw
In reply to Jim Zeus
Quoted 4 lines · Jim Zeus
Quoted 4 lines
Quoted 4 lines

What I am doing now is to build a filesystem which can be recognized on _raw_ NAND flash. So, I think FAT will be the only choice(though I know it's very unstable). And I have following question now:

I think the easiest route would be to get yaffs working under Windows. It works under WinCE already, which has a similar file system driver level.

Quoted 6 lines
Quoted 4 lines

Windows won't recognise raw NAND flash anyway. You'll have to write _some_ kind of driver for Windows.

Quoted 7 lines

Since the MTD block device(which include nand.c,mtdcore.c and mtdblock.c) is a block device, why I can't build any filesystem on it?
And, what's the difference between MTD block device and NFTL if they stay on the same layer? Even though I cant use NFTL because of some "silly patent problem" ,I still wanna know it, thanks.

The mtd drivers are pretty much Linux specific. They also carry a lot of stuff that is not really required to support a NAND-based file system.

The journaling file systems (YAFFS and JFFS2) do not use block drivers. They know about flash. It is this knowledge that gives them both efficiency and robusness. FAT file systems on NAND are inefficient and lack robustness because of the block driver layer (and to some degree because of FAT).

[snip]

Quoted 3 lines

Then, maybe the lower layer (MTD or NFTL) support it? or all the stuff(a.b.c.d.e) are supported only by the file system (JFFS2/YAFFS,I mean)?

I don't know about JFFS2, but YAFFS handles all robustness inside itself. I think JFFS2 does too.

Quoted 2 lines

Thank you, but what is the SmartMedia format? Sorry I am not familiar with that.

Look up the Samsung flash website or google for "SmartMedia specification".

This is the format for file systems using SmartMedia cards so that you get interoperability between cameras, PCs etc.

SmartMedia is like FAT.

Quoted 8 lines
Quoted 6 lines

But really you should have a file system directly on the flash, not a translation layer pretending to be a block device.

Quoted 4 lines

Do you mean build a totally new FS on a _bare_ NAND flash or on a MTD? You are so right, but I must build a FS which Windows can recognize and I have no enough time to do this before the time limit.

This is what YAFFS and JFFS2 do. They talk directly to the flash chips. mtd just gives a standard interface under Linux.

YAFFS makes all its NAND accesses through 5 functions. Under Linux, these functions access mtd functions. Under other environments they are implemented in other ways. This makes it very easy to port.

The more difficult side is porting the top side of the file system (ie. where it interfaces to the operating system). There are functions in CVS to do this for WinCE - that would be a good starting point.