Hello,
I am trying to diagnose repeated EXT4 filesystem corruption on a Raspberry Pi 5 using a Penta SATA HAT with the JMicron JMB585 controller.
I have spent about 1.5 days testing this and I would really appreciate input from people familiar with the Raspberry Pi 5 PCIe stack, JMB585, Linux MD RAID, or EXT4.
## Hardware
- Raspberry Pi 5, 8 GB RAM
- Penta SATA HAT
- SATA controller: JMicron JMB58x / JMB585
- PCI ID: `197b:0585`
- Driver: `ahci`
- 2x Kingston SEDC500R960G 960 GB SSD
- The two Kingston SSDs form a Linux software RAID1:
- `/dev/sdb1`
- `/dev/sdc1`
- `/dev/md0`
- EXT4 filesystem on `/dev/md0`
- `/dev/md0` is used as the root filesystem `/`
- Separate Samsung 850 EVO 250 GB SSD is also connected to the HAT
- An external eSATA RAID enclosure was previously connected as well, but it has now been completely disconnected for testing.
The RAID itself always remains healthy:
`[UU]`
## Software
Current kernel:
`6.12.75+rpt-rpi-2712`
The Raspberry Pi 5 32-bit PCIe DMA overlay is enabled:
`dtoverlay=pcie-32bit-dma-pi5`
I also verified the JMB585 DMA masks at runtime:
```text
/sys/bus/pci/devices/0001:01:00.0/dma_mask_bits
31
/sys/bus/pci/devices/0001:01:00.0/consistent_dma_mask_bits
31
So the controller does appear to be operating with restricted DMA addressing.
The problem
EXT4 repeatedly reports metadata checksum errors.
Earlier examples included:
EXT4-fs error (device md0):
htree_dirblock_to_tree:1083:
inode #141793:
comm find:
Directory block failed checksum
Other affected inodes included:
140515
58443782
Earlier in the investigation there were also different inode numbers, so the problem is not limited to one directory or one inode.
After repairing the filesystem offline with e2fsck, the filesystem can be completely clean again.
For example, after an offline repair I ran e2fsck -f -v /dev/md0 a second time and it completed without errors.
After rebooting:
errors_count = 0
The previously failing directory could then be read successfully, and a full directory scan also completed without errors.
The system then ran for several hours with Docker containers active and errors_count remained at 0.
Later, however, a more serious EXT4 error appeared:
bad block bitmap checksum
Delayed block allocation failed
This should not happen!! Data will be lost
This involved a different inode (13404678), and another inode (542063) was also involved afterwards.
So the corruption is not always the same EXT4 structure:
-
sometimes directory metadata/checksums
-
later block bitmap / allocation metadata
Offline filesystem checks
I use a separate SD-card installation as a rescue root so that /dev/md0 can be checked completely offline.
After the latest failure:
/ = /dev/mmcblk0p2
md0 = active (auto-read-only)
RAID1 = [UU]
md0 was not mounted.
The first e2fsck found:
Inode 1051162 extent tree (at level 1) could be shorter.
Inode 1051189 extent tree (at level 1) could be shorter.
Inode 1051243 extent tree (at level 1) could be shorter.
Free blocks count wrong (196949284, counted=196950308).
The free block count was repaired.
After that, a second full:
e2fsck -f -v /dev/md0
completed completely clean.
It also reports:
0 bad blocks
SSD health
Both Kingston SSDs report:
SMART overall-health: PASSED
SSD Life Left: 99%
Relevant SMART values are all clean:
Raw_Read_Error_Rate = 0
SATA_Phy_Error_Count = 0
Bad_Block_Rate = 0
Program_Fail_Count = 0
Reported_Uncorrect = 0
Reallocated_Event_Count = 0
SATA_CRC_Error_Count = 0
CRC_Error_Count = 0
Read_Fail_Count = 0
Both SMART error logs say:
No Errors Logged
There are no obvious media errors or SATA CRC errors.
RAID1 comparison
I also investigated one specific directory checksum error in more detail.
For inode 141793:
Type: directory
Size: 4096
EXTENTS:
(0):136927624
Both RAID members use:
Data Offset : 264192 sectors
Super Offset : 8 sectors
I read that exact 4 KiB filesystem block directly from both physical RAID members and calculated SHA256 hashes.
Both SSDs returned exactly the same hash:
968a6654dbdb45561f71740f5a852470b67c768b4a0259bef2175612032ff3df
So at least for this known failing EXT4 block, the data stored on both RAID1 members was bit-for-bit identical.
mismatch_cnt was also:
0
before any full RAID consistency scan.
External eSATA enclosure
The external eSATA enclosure previously showed some suspicious link behaviour during boot:
ata5: link is slow to respond, please be patient
ata5.00: hard resetting link
ata5.01: hard resetting link
...
Because of that, I completely unmounted it, powered it down and physically removed the eSATA cable.
The EXT4 corruption still returned later while the external enclosure was physically disconnected.
So it may have been an additional problem, but it cannot be the only cause of the EXT4 corruption.
Important observation
Before using this SATA HAT, this Raspberry Pi ran from a microSD card without these filesystem problems.
The strange part is that the corruption often becomes visible during periods of heavier filesystem activity: scanning directories, reading many files, or other active work.
The machine can also run for hours with Docker containers running without an immediately visible error.
This makes me suspect that heavier I/O may be triggering an underlying problem rather than EXT4 itself simply being damaged once.
What I am currently testing
A RAM test is currently running with memtester.
I have not yet tested the two Kingston SSDs without Linux MD RAID1.
That is one of the next tests I am considering:
-
One Kingston SSD
-
EXT4 directly on the SSD
-
Same Penta SATA HAT / JMB585
-
No
mdadm -
Same workload and monitoring
If corruption still occurs, that would make MD RAID1 much less likely to be involved.
A further comparison could be the exact same SSD through USB-SATA, but I would prefer to understand and fix the Penta SATA HAT / PCIe path rather than use USB as a permanent workaround.
Questions
I would especially appreciate help with these questions:
-
Has anyone seen repeated EXT4 metadata checksum corruption with the JMB585 / Penta SATA HAT on Raspberry Pi 5?
-
Are there any known JMB585, AHCI, PCIe, DMA or Raspberry Pi 5 kernel issues that could cause silent data corruption without SATA CRC or SMART errors?
-
Is kernel
6.12.75+rpt-rpi-2712known to be problematic with this controller? -
Is there a specific Raspberry Pi kernel version currently recommended for the JMB585?
-
Is
dtoverlay=pcie-32bit-dma-pi5sufficient, or are additional PCIe/DMA settings recommended? -
Is there firmware available for the JMB585 controller on these Penta SATA HAT boards?
-
Could Linux MD RAID1 combined with this controller expose a timing/DMA issue that would not appear with a single SSD?
-
Are there useful kernel debug options, tracing tools or tests I can enable to catch corruption closer to where it actually happens?
-
Is there a good way to distinguish between:
-
faulty Penta SATA HAT hardware
-
JMB585/controller problem
-
PCIe/DMA problem
-
RAM corruption
-
Linux MD RAID issue
-
EXT4/kernel issue
-
I am happy to provide full dmesg, SMART data, lspci -vv, mdadm --detail, EXT4 logs or other diagnostics if useful.
My main goal is not simply to work around the issue, but to identify the actual cause and make this storage setup reliable.
Thank you.