Skip to contentSkip to conversation

jffs2: Too few erase blocks (1)

DISCUSSION Dzuy Nguyen 3 participants 6 messages Feb 9, 2009 – Feb 10, 2009 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hello,

I've allocated a small (64K) "user_config" partition in my flash for persistence storage:

mtd0: 00020000 00010000 "u-boot"
mtd1: 00010000 00010000 "Config"
mtd2: 00100000 00010000 "vmlinux"
mtd3: 002a0000 00010000 "rootfs"
mtd4: 00010000 00010000 "user_config"
mtd5: 00020000 00010000 "ART"

When I tried to mount -t jffs2 /dev/mtdblock4, I get

jffs2: Too few erase blocks (1)

I understand that my erasesize is 64K, which gives me only 1 block, and jffs2 needs more than 1 block, but the kernel defaults the erasesize to 64K.

If I made a jffs2 file with eraseblock=8, would this work or would I have to set it at the kernel?

Dzuy

#1 lore raw
Quoted 10 lines · Dzuy Nguyen

I've allocated a small (64K) "user_config" partition in my flash for persistence storage:

mtd0: 00020000 00010000 "u-boot"
mtd1: 00010000 00010000 "Config"
mtd2: 00100000 00010000 "vmlinux"
mtd3: 002a0000 00010000 "rootfs"
mtd4: 00010000 00010000 "user_config"
mtd5: 00020000 00010000 "ART"

Quoted 7 lines

When I tried to mount -t jffs2 /dev/mtdblock4, I get

jffs2: Too few erase blocks (1)

I understand that my erasesize is 64K, which gives me only 1 block, and jffs2 needs more than 1 block, but the kernel defaults the erasesize to 64K.

The kernel does that probably because that is the size of the blocks on your flash chip. It is not so much a default as detection of the properties of the chip.

Quoted 2 lines

If I made a jffs2 file with eraseblock=8, would this work or would I have to set it at the kernel?

You need to allocate more space if you want to use jffs2 quite simply. The exact number is not exact; 8 should be ok, meaning you need to partition your flash so you have 64K * 8 = 512K in your user_config partition.

If you can't afford that much space, you could consider writing your user configurations to a file and just dumping the file with dd into your flash partition. Not at all as flexible, but doable in a pinch.

/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30

#2 lore raw

Thanks, Ricard. I didn't realize that jffs2 is not suitable for a small partition. Yes,
64K is all I can afford. I suppose I can dd the file, but doesn't that provide no wear
leveling feature that jffs2 does?

Quoted 49 lines · Ricard Wanderlof
Quoted 10 lines · Dzuy Nguyen

I've allocated a small (64K) "user_config" partition in my flash for persistence storage:

mtd0: 00020000 00010000 "u-boot"
mtd1: 00010000 00010000 "Config"
mtd2: 00100000 00010000 "vmlinux"
mtd3: 002a0000 00010000 "rootfs"
mtd4: 00010000 00010000 "user_config"
mtd5: 00020000 00010000 "ART"

Quoted 8 lines

When I tried to mount -t jffs2 /dev/mtdblock4, I get

jffs2: Too few erase blocks (1)

I understand that my erasesize is 64K, which gives me only 1 block, and jffs2 needs more than 1 block, but the kernel defaults the erasesize to 64K.

The kernel does that probably because that is the size of the blocks on your flash chip. It is not so much a default as detection of the properties of the chip.

Quoted 3 lines

If I made a jffs2 file with eraseblock=8, would this work or would I have to set it at the kernel?

You need to allocate more space if you want to use jffs2 quite simply. The exact number is not exact; 8 should be ok, meaning you need to partition your flash so you have 64K * 8 = 512K in your user_config partition.

If you can't afford that much space, you could consider writing your user configurations to a file and just dumping the file with dd into your flash partition. Not at all as flexible, but doable in a pinch.

/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30

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

#3 lore raw
Quoted 5 lines · Dzuy Nguyen

Thanks, Ricard. I didn't realize that jffs2 is not suitable for a small partition. Yes,
64K is all I can afford. I suppose I can dd the file, but doesn't that provide no wear
leveling feature that jffs2 does?

No. But with one eraseblock you can't get much wear levelling anyway.

It might not be too difficult to write an application that appends new data to existing data to the partition, erasing the whole block when it fills up and write the latest. Then you need something that will search for the latest version of the file. Something that jffs2 does, but on a smaller scale, acceptable for your application.

/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30

#4 lore raw

I think I'll just use ext2. ext2 doesn't mind small partition. Writing to it
should work the same as dd.

Quoted 28 lines · Ricard Wanderlof
Quoted 6 lines · Dzuy Nguyen

Thanks, Ricard. I didn't realize that jffs2 is not suitable for a small partition. Yes,
64K is all I can afford. I suppose I can dd the file, but doesn't that provide no wear
leveling feature that jffs2 does?

No. But with one eraseblock you can't get much wear levelling anyway.

It might not be too difficult to write an application that appends new data to existing data to the partition, erasing the whole block when it fills up and write the latest. Then you need something that will search for the latest version of the file. Something that jffs2 does, but on a smaller scale, acceptable for your application.

/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30

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

#5 lore raw
Quoted 2 lines · Dzuy Nguyen

I think I'll just use ext2. ext2 doesn't mind small partition. Writing to it should work the same as dd.

Be careful. Writing to ext2 over mtdblock may wear out the flash faster than dd over mtd.

-- Jamie