Rootfs_data coruption?

Dear all,

I'm using an openWRT 18.06.8 imageBuilder based image on a Linkit 7688 device.The device also used an SD card which is used for some data logging purposes.

The image works well, but sometimes (for an unexplained reason - usually after few days), it seems the rootfs becomes corrupted and can't be mounted anymore at boot.

see the boot trace below (when having an UART connected to the LinkIt device:

[04020C0D][04020D09]
DDR Calibration DQS reg = 00008987


U-Boot 1.1.3 (Sep 10 2015 - 05:56:31)

Board: Ralink APSoC DRAM:  128 MB
relocate_code Pointer at: 87f68000
flash manufacture id: c2, device id 20 19
find flash: MX25L25635E
*** Warning - bad CRC, using default environment

============================================
Ralink UBoot Version: 4.3.0.0
--------------------------------------------
ASIC 7628_MP (Port5<->None)
DRAM component: 1024 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: SPI Flash
Date:Sep 10 2015  Time:05:56:31
============================================
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768

 ##### The CPU freq = 580 MHZ ####
 estimate memory size =128 Mbytes
RESET MT7628 PHY!!!!!!
GPIOMODE --> 50054404

GPIOMODE2 --> 5540551

Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.
 0

3: System Boot system code via Flash.
## Booting image at bc050000 ...
   Image Name:   MIPS OpenWrt Linux-4.14.171
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1443514 Bytes =  1.4 MB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

[    0.000000] Linux version 4.14.171 (buildbot@7b7184621d09) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7989-82fbd85747)) #0 Thu Feb 27 21:25:59 2020
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7688 ver:1 eco:2
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
[    0.000000] MIPS: machine is MediaTek LinkIt Smart 7688
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] random: get_random_bytes called from 0x80428730 with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS2,57600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=0003fe0c
[    0.000000] Readback ErrCtl register=0003fe0c
[    0.000000] Memory: 125204K/131072K available (3606K kernel code, 178K rwdata, 464K rodata, 160K init, 207K bss, 5868K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] intc: using register map from devicetree
[    0.000000] CPU Clock: 580MHz
[    0.000000] timer_probe: no matching timers found
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000012] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.015376] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.087584] pid_max: default: 32768 minimum: 301
[    0.096954] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.109910] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.129653] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.149029] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.161129] pinctrl core: initialized pinctrl subsystem
[    0.172690] NET: Registered protocol family 16
[    0.205382] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.216604] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.227735] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.243615] clocksource: Switched to clocksource MIPS
[    0.254803] NET: Registered protocol family 2
[    0.264351] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.278059] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.290569] TCP: Hash tables configured (established 1024 bind 1024)
[    0.303258] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.314714] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.327322] NET: Registered protocol family 1
[    0.339344] Crashlog allocated RAM at address 0x3f00000
[    0.351240] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.369977] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.381417] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.411759] io scheduler noop registered
[    0.419431] io scheduler deadline registered (default)
[    0.430522] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.446013] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
[    0.464466] 10000d00.uart1: ttyS1 at MMIO 0x10000d00 (irq = 29, base_baud = 2500000) is a 16550A
[    0.482422] 10000e00.uart2: ttyS2 at MMIO 0x10000e00 (irq = 30, base_baud = 2500000) is a 16550A
[    0.499761] console [ttyS2] enabled
[    0.499761] console [ttyS2] enabled
[    0.513437] bootconsole [early0] disabled
[    0.513437] bootconsole [early0] disabled
[    0.530827] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    0.549966] m25p80 spi0.0: mx25l25635e (32768 Kbytes)
[    0.560074] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.572653] Creating 4 MTD partitions on "spi0.0":
[    0.582155] 0x000000000000-0x000000030000 : "u-boot"
[    0.592934] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.604398] 0x000000040000-0x000000050000 : "factory"
[    0.615312] 0x000000050000-0x000002000000 : "firmware"
[    0.696010] 2 uimage-fw partitions found on MTD device firmware
[    0.707775] 0x000000050000-0x0000001b06fa : "kernel"
[    0.718517] 0x0000001b06fa-0x000002000000 : "rootfs"
[    0.729184] mtd: device 5 (rootfs) set to be root filesystem
[    0.741982] 1 squashfs-split partitions found on MTD device rootfs
[    0.754298] 0x0000008a0000-0x000002000000 : "rootfs_data"
[    0.766871] libphy: Fixed MDIO Bus: probed
[    0.786208] rt3050-esw 10110000.esw: link changed 0x00
[    0.798045] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.816342] NET: Registered protocol family 10
[    0.829632] Segment Routing with IPv6
[    0.837066] NET: Registered protocol family 17
[    0.845927] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    0.871592] 8021q: 802.1Q VLAN Support v1.8
[    0.881958] mtk-linkit bootstrap: Version  : LINKITS7688
[    0.892543] mtk-linkit bootstrap: Revision : REV3
[    0.901856] mtk-linkit bootstrap: setting up bootstrap latch
[    0.919517] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    0.934430] Freeing unused kernel memory: 160K
[    0.943217] This architecture does not have kernel memory protection.
[    1.881120] init: Console is alive
[    1.888184] init: - watchdog -
[    2.453624] random: fast init done
[    3.646720] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.834959] usbcore: registered new interface driver usbfs
[    3.845965] usbcore: registered new interface driver hub
[    3.856623] usbcore: registered new device driver usb
[    3.898462] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    3.919850] SCSI subsystem initialized
[    3.932539] ehci-platform: EHCI generic platform driver
[    3.953264] phy phy-10120000.usbphy.0: remote usb device wakeup disabled
[    3.966559] phy phy-10120000.usbphy.0: UTMI 16bit 30MHz
[    3.976933] ehci-platform 101c0000.ehci: EHCI Host Controller
[    3.988352] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[    4.004149] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[    4.043655] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[    4.057115] hub 1-0:1.0: USB hub found
[    4.065000] hub 1-0:1.0: 1 port detected
[    4.076221] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    4.090202] ohci-platform: OHCI generic platform driver
[    4.100903] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[    4.114433] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[    4.130232] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[    4.208623] hub 2-0:1.0: USB hub found
[    4.216576] hub 2-0:1.0: 1 port detected
[    4.237088] MTK MSDC device init.
[    4.303845] mtk-sd: MediaTek MT6575 MSDC Driver
[    4.317042] sdhci: Secure Digital Host Controller Interface driver
[    4.329350] sdhci: Copyright(c) Pierre Ossman
[    4.339277] sdhci-pltfm: SDHCI platform and OF driver helper
[    4.354781] usbcore: registered new interface driver usb-storage
[    4.370367] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.395247] init: - preinit -
[    4.961982] usb 2-1: new full-speed USB device number 2 using ohci-platform
[    5.367587] random: procd: uninitialized urandom read (4 bytes read)
[    5.566143] rt3050-esw 10110000.esw: link changed 0x00
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    8.938266] mount_root: loading kmods from internal overlay
[    8.990866] kmodloader: loading kernel modules from //etc/modules-boot.d/*
[    9.006354] kmodloader: done loading kernel modules from //etc/modules-boot.d/*
[   10.408412] jffs2: notice: (434) jffs2_build_xattr_subsystem: complete building xattr subsystem, 8 of xdatum (0 unchecked, 6 orphan) and 15 of xref (6 dead, 0 orphan) found.
[   10.439741] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   10.775396] block: extroot: not configured
[   11.272113] jffs2: notice: (432) jffs2_build_xattr_subsystem: complete building xattr subsystem, 8 of xdatum (0 unchecked, 6 orphan) and 15 of xref (6 dead, 0 orphan) found.
[   12.156250] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   12.173056] block: extroot: not configured
[   12.182430] mount_root: switching to jffs2 overlay
[   12.234046] overlayfs: upper fs does not support tmpfile.
[   12.253162] urandom-seed: Seeding with /etc/urandom.seed
[   12.604491] procd: - early -
[   12.610301] procd: - watchdog -
[   13.364071] procd: - watchdog -
[   13.370578] procd: - ubus -
[   13.723952] random: ubusd: uninitialized urandom read (4 bytes read)
[   13.750592] random: ubusd: uninitialized urandom read (4 bytes read)
[   13.775374] random: ubusd: uninitialized urandom read (4 bytes read)
[   13.805295] procd: - init -
Please press Enter to activate this console.
root@(none):/# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "factory"
mtd3: 01fb0000 00010000 "firmware"
mtd4: 001606fa 00010000 "kernel"
mtd5: 01e4f906 00010000 "rootfs"
mtd6: 01760000 00010000 "rootfs_data"

After boot, it is not possible to activate the console at all and there is no network as well (basically device is "bricked")

Booting in failsafe, I can get to the console, and manually mount the mtd6 (rootfs_data) partition. When browsing though it I can see upper and work folders but when in upper, everything seems "corrupted" when doing an ls.

Doing a first_boot will put back the device into working conditions, but I would like to understand what is the root cause of such issue, and I must say, I have no idea where to look for...

Any help is welcome!
Thanks a lot.