bad block in jffs2 partition

Jeffrey Hall jhall at healthhero.com
Mon Jul 7 21:12:37 EDT 2008


Hello folks,

I have an embedded device with a NAND flash partition that contains a
single bad block that was marked bad by the NAND flash manufacturer
(Samsung) during their QA process. As long as the number of bad blocks
doesn't exceed some threshold, the part is still good. 


So, if I use:
# flash_eraseall -j /dev/mtd4
Erasing 16 Kibyte @ d3c000 -- 88 % complete. Cleanmarker written at
d3c000.
Skipping bad block at 0x00d40000
Erasing 16 Kibyte @ efc000 -- 99 % complete. Cleanmarker written at
efc000.

You can see the bad block at offset 0x00d40000.

Ok, so far so good. If I understand jffs2, it's able to handle bad
blocks, so this shouldn't be a problem. 

But, when I mount the partition, I get:

# mount /dev/mtdblock4
mount: Mounting /dev/mtdblock4 on /usr/local failed: Input/output error

Examining the kernel log I see:

Cowardly refusing to erase blocks on filesystem with no valid JFFS2
nodes
empty_blocks 0, bad_blocks 0, c->nr_blocks 960

This looks fishy to me. So the question is: Shouldn't flash_eraseall
leave the partition in a blank, but ready to go state for the mount
command, even if the partition has a bad block in it? Any hints on what
might be happening here would be very much appreciated.

Trying this same thing on a flash part with no bad blocks in the
partition yields the correct result - the partition is mounted and
working.

Here's something else you might want to see 
# cat /etc/fstab:

# /etc/fstab: static file system information.
#
# <file system> <mount pt>     <type>   <options>         <dump> <pass>
/dev/root       /              ext2     rw,noauto         0      1
proc            /proc          proc     defaults          0      0
devpts          /dev/pts       devpts   defaults,gid=5,mode=620   0
0
tmpfs           /tmp           tmpfs    defaults          0      0
usbfs           /proc/bus/usb  usbfs    defaults          0      0
sysfs           /sys           sysfs    defaults          0      0

/dev/sda1       /mnt/usbstick vfat
codepage=437,iocharset=iso8859-1,noauto,umask=0 0 0

/dev/mtdblock4  /usr/local      jffs2   rw                0       0
/dev/mtdblock5  /usr/hb         jffs2   rw                0       0
/dev/mtdblock6  /var/hbdata     jffs2   rw,noauto         0       0
/dev/mtdblock7  /var/hbdata/box jffs2   rw,noauto         0       0

Thanks,
-Jeff-






More information about the linux-mtd mailing list