Skip to contentSkip to conversation

help request, jffs2 fs files get lost

DISCUSSION Angelo Dureghello 2 participants 5 messages May 1, 2011 – May 2, 2011 1 message not in the archive Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi all,

i am looking for some help on an issue with jffs2: i can create jffs2 fs, mount, store edit/write some files, unmount, but in a next mount i find no more files/dirs.

MTD probe detect correctly my flash, the chip allows erase sectors of 4KB, or blocks of 64KB. MTD shows correctly a 0x1000 erase size.

/ # / # cat /proc/mtd
dev: size erasesize name
mtd0: 00010000 00001000 "Colilo (64K)"
mtd1: 002f0000 00001000 "Kernel+ROMfs (3008K)"
mtd2: 00100000 00001000 "JFFS2 (1024K)" <--- want to use this partition only as jffs2 to store non volatile data
mtd3: 0009d000 00001000 "ROMfs"

So from uClinux, i try to prepare the jffs2 fs:

# eraseall /dev/mtd2
erased 1024 Kibyte @ 0 -- 100% complete.

cat /dev/mtd2 i see the flash has been cleared

then i create a folder "backup" in /var with some files and try to crete the jffs2 fs:

mkfs.jffs2 -d backup -o jffs2.img

cp /deV/mtd2 jffs2.img

Then i just mount/umount the device, but i get often the issue decribed.

Any help is really appreciated.

many thanks
angelo

#1 lore raw
Quoted 5 lines · Angelo Dureghello

So from uClinux, i try to prepare the jffs2 fs:

# eraseall /dev/mtd2
erased 1024 Kibyte @ 0 -- 100% complete.
Quoted 7 lines

cat /dev/mtd2 i see the flash has been cleared

then i create a folder "backup" in /var with some files and try to crete the jffs2 fs:

mkfs.jffs2 -d backup -o jffs2.img

cp /deV/mtd2 jffs2.img

If this is in fact what you're doing, you're overwriting your jffs2.img file with the all-ff's contents of the newly erased /dev/mtd2. Swap the two arguments instead.

/Ricard

Signature · 3 lines
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
author
#2 lore raw
Quoted 12 lines · Ricard Wanderlof
Quoted 9 lines · Angelo Dureghello

So from uClinux, i try to prepare the jffs2 fs:

# eraseall /dev/mtd2
erased 1024 Kibyte @ 0 -- 100% complete.

cat /dev/mtd2 i see the flash has been cleared

then i create a folder "backup" in /var with some files and try to crete the jffs2 fs:

Quoted 7 lines
Quoted 3 lines

mkfs.jffs2 -d backup -o jffs2.img

cp /deV/mtd2 jffs2.img

If this is in fact what you're doing, you're overwriting your jffs2.img file with the all-ff's contents of the newly erased /dev/mtd2. Swap the two arguments instead.

/Ricard

Hi Ricard,
sorry, was late and just appended a bad had-written text,

i generally do "cp jffs2.img /dev/mtd2", and after mounting mtdblock2 i see correctly the root tree.

I did some other tests:
if i mount the new created jffs2 and unmount it, nothing is lost.
If i mount it, open a file, append some text, close it and unmount, then at the next mount everything is disapperaed (checking mtd2, all is set to 0xff).

Saving modified files i notice a warning:
Writing files is also notice some MTD debug trace, maybe an error:
Node totlen on flash (0xffffffff) != totlen from node ref (0x00000074)

many thanks,
angelo

Signature · 7 lines
 .:.:.SYSAM.:.:.

  di Angelo Dureghello
    via San Nazario 149
      34151, Trieste, Italy
    ++39 340 7631990
  www.sysam.it  <http://www.sysam.it>

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 5 lines · angelo

If this is in fact what you're doing, you're overwriting your jffs2.img file with the all-ff's contents of the newly erased /dev/mtd2. Swap the two arguments instead.

sorry, was just a bad had-written text,
i generally do "cp jffs2.img /dev/mtd2", and after mounting mtdblock2 i see correctly the root tree.

Quoted 7 lines

I did some other tests:
if i mount the new created jffs2 and unmount it, nothing is lost.
If i mount it, open a file, append some text, close it and unmount, then at the next mount everything is disapperaed (checking mtd2, all is set to 0xff).

Saving modified files i notice a warning:
Writing files is also notice some MTD debug trace, maybe an error:
Node totlen on flash (0xffffffff) != totlen from node ref (0x00000074)

Out of curiosity, what exactly is the type of flash you are using?

/Ricard

Signature · 3 lines
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
author
#5 lore raw
Quoted 12 lines · Ricard Wanderlof
Quoted 9 lines · angelo

If this is in fact what you're doing, you're overwriting your jffs2.img file with the all-ff's contents of the newly erased /dev/mtd2. Swap the two arguments instead.

sorry, was just a bad had-written text,
i generally do "cp jffs2.img /dev/mtd2", and after mounting mtdblock2 i see correctly the root tree.

I did some other tests:
if i mount the new created jffs2 and unmount it, nothing is lost.
If i mount it, open a file, append some text, close it and unmount, then at the next mount everything is disapperaed (checking mtd2, all is set to 0xff).

Quoted 7 lines
Quoted 3 lines

Saving modified files i notice a warning:
Writing files is also notice some MTD debug trace, maybe an error:
Node totlen on flash (0xffffffff) != totlen from node ref (0x00000074)

Out of curiosity, what exactly is the type of flash you are using?

/Ricard

Hi Ricard,

thanks again for help

the flash chip is an SST 39VF2301B, word programmable, tot 4MB, 4KB sector size, 64K block size, it is very similar to an AMD 16bit data bus width flash.

It seems to be correctly detected from jedec probe, but through CFI queries probably

...
physmap platform flash device: 00400000 at ffc00000
physmap-flash: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x0000bf Chip ID 0x00235d number of CFI chips: 1
...

/proc # cat /proc/mtd
dev: size erasesize name
mtd0: 00010000 00001000 "Colilo (64K)"
mtd1: 002f0000 00001000 "Kernel+ROMfs (3008K)"
mtd2: 00100000 00001000 "JFFS2 (1024K)"
mtd3: 0009d000 00001000 "ROMfs"

This is a suspected sequence of MTD commands i find in dmesg:

...
MTD_ioctl
MTD_ioctl
MTD_ioctl
MTD_ioctl
MTD_ioctl
MTD_ioctl
MTD_close
MTD_open
MTD_write
MTD_close
Node totlen on flash (0xffffffff) != totlen from node ref (0x00000074) MTD_open <-- jffs2 fs disapperaed from here
MTD_read
MTD_read
...

many thanks,
angelo