Mickael, On Mon, Jul 29, 2019 at 3:28 PM Mickael Chazaux <mickael.chazaux@xxxxxxxxxxxxxxx> wrote: > > Hello, > > I have been using UBIFS on embedded devices for several years now. > We never had a corrupted filesystem. Recently, I used it on a > board design based on the previous ones. On this new board I > had several filesystem corruptions like the one below. > > I checked the CRC of the corrupted UBIFS node, and it is incorrect. > However, the CRC of the UBI LEB and the ECC of the NAND page _are_ > correct. > > This node is on a PEB that was copied (copy_flag = 1 in the header) Side note, you are only allowed to check the CRC of a LEB iff copy_flag is set and there is a second LEB with the same volume id and LEB number present. Then you can use the CRC of the LEB with the higher sqnum Otherwise the CRC can be outdated. > I have been working on this a lot now, and I would like to hear the > advice of the experts on how to find the cause of this corruption. > > A bit of background : > The volume "userdata" is used for logging. > Approx. 1 message per second is logged. > It is mounted with option sync. > Its size is 10MiB, the ubi0 device itself is 491MiB. > There are other volumes on ubi0, that are not > corrupted (rootfs, etc.) . They are less busy. > > I imaged the NAND and can reproduce the error like this : > > flash_eraseall /dev/mtd8 > nandwrite -no /dev/mtd8 nand-image.img > ubiattach /dev/ubi_ctrl -m 8 > mount -t ubifs ubi0:userdata /mnt/ > echo "azer" > /mnt/azer That easy? Hmm, sounds a bit like a bug in your NAND driver. Did you test it? Please also disable compression in UBIFS, then the read back data maybe gives you a hint what went wrong. Thanks, //richard ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/