Skip to contentSkip to conversation

Error creating FAT32 over Nand flash

DISCUSSION Ivan Li 4 participants 6 messages Aug 25, 2009 – Aug 30, 2009 Memory technology devices (MTD)

lore
Share & tools
lore

Ivan Li

author
#0 lore raw

Hi guys,

I have some problems with creating FAT32 fs over nand flash. I created FAT32 fs over nand flash with below command:

Quoted 2 lines

flash_eraseall /dev/mtdblock6
mkdosfs -v -F 32 /dev/mtdblock6

mkdosfs 3.0.2 (28 Feb 2009)
unable to get drive geometry, using default 255/63 /dev/mtdblock6 has 255 heads and 63 sectors per track, logical sector size is 512,
using 0xf8 media descriptor, with 638976 sectors; file system has 2 32-bit FATs and 8 sectors per cluster. FAT size is 623 sectors, and provides 79712 clusters.

with USB mass storage gadget I exported this FAT partition to WinXP. When I tried to copy some files into it, I got errors both on WinXP and Linux console:
In WinXP I got an error dialog, say "Can't copy ****, data error (CRC error).
In serial console I got:
end_request: I/O error, dev mtdblock6, sector 77584
end_request: I/O error, dev mtdblock6, sector 77568
Buffer I/O error on device mtdblock6, logical block 9696
lost page write due to I/O error on mtdblock6
end_request: I/O error, dev mtdblock6, sector 77576
Buffer I/O error on device mtdblock6, logical block 9697
lost page write due to I/O error on mtdblock6

I don't know if FAT32 can't handle bad blocks correctly, or something else. Any ideas?

The Nand Flash I am using is Samsung K9F4G08U0A, (512M = 4096 blocks, 1 block = 64 pages, 1 page = 2048 bytes, spare area = 64 bytes.)

Kernel configuration:
CONFIG_BLOCK, CONFIG_MTD, CONFIG_MTD_PARTITIONS, CONFIG_MTD_CHAR, CONFIG_MTD_BLKDEVS, CONFIG_MTD_BLOCK, CONFIG_MTD_NAND...

Thanks in advance.

Ivan

author
#1 lore raw

Some progress for it: I found the sector number mentioned in error message resides in BAD block. Is there any fix for that?

----- Original Message -----
From: "Ivan Li" <[email protected]>
To: <[email protected]>
Sent: Tuesday, August 25, 2009 9:35 PM
Subject: Error creating FAT32 over Nand flash

Quoted 39 lines

Hi guys,

I have some problems with creating FAT32 fs over nand flash. I created FAT32 fs over nand flash with below command:

Quoted 2 lines

flash_eraseall /dev/mtdblock6
mkdosfs -v -F 32 /dev/mtdblock6

mkdosfs 3.0.2 (28 Feb 2009)
unable to get drive geometry, using default 255/63 /dev/mtdblock6 has 255 heads and 63 sectors per track, logical sector size is 512,
using 0xf8 media descriptor, with 638976 sectors; file system has 2 32-bit FATs and 8 sectors per cluster. FAT size is 623 sectors, and provides 79712 clusters.

with USB mass storage gadget I exported this FAT partition to WinXP. When I tried to copy some files into it, I got errors both on WinXP and Linux console:
In WinXP I got an error dialog, say "Can't copy ****, data error (CRC error).
In serial console I got:
end_request: I/O error, dev mtdblock6, sector 77584
end_request: I/O error, dev mtdblock6, sector 77568
Buffer I/O error on device mtdblock6, logical block 9696
lost page write due to I/O error on mtdblock6
end_request: I/O error, dev mtdblock6, sector 77576
Buffer I/O error on device mtdblock6, logical block 9697
lost page write due to I/O error on mtdblock6

I don't know if FAT32 can't handle bad blocks correctly, or something else. Any ideas?

The Nand Flash I am using is Samsung K9F4G08U0A, (512M = 4096 blocks, 1 block = 64 pages, 1 page = 2048 bytes, spare area = 64 bytes.)

Kernel configuration:
CONFIG_BLOCK, CONFIG_MTD, CONFIG_MTD_PARTITIONS, CONFIG_MTD_CHAR, CONFIG_MTD_BLKDEVS, CONFIG_MTD_BLOCK, CONFIG_MTD_NAND...

Thanks in advance.

Ivan
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#2 lore raw
Quoted 2 lines · Ivan Li

Some progress for it: I found the sector number mentioned in error message resides in BAD block. Is there any fix for that?

Yes, do not use mtdblock but write a real FTL layer.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#4 lore raw
In reply to Ivan Li
Quoted 2 lines · Ivan Li

Some progress for it: I found the sector number mentioned in error message resides in BAD block. Is there any fix for that?

Use an FTL or mount FAT in loop mode over a file in a fs understanding NAND (ubifs, jffs2, ...).

Matthieu

author
#5 lore raw

Thanks for your reply.
Use FAT over yaffs can fix this problem, but the performance is not very good. Is there any existing open source FTL for FAT over nand flash which I can use in my product? Thanks.

----- Original Message -----
From: "Matthieu CASTET" <[email protected]>
To: "Ivan Li" <[email protected]>
Cc: <[email protected]>
Sent: Tuesday, August 25, 2009 10:56 PM
Subject: Re: Error creating FAT32 over Nand flash

Quoted 2 lines · Ivan Li

Some progress for it: I found the sector number mentioned in error message resides in BAD block. Is there any fix for that?

Use an FTL or mount FAT in loop mode over a file in a fs understanding NAND (ubifs, jffs2, ...).

Matthieu

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/