One way would be to setup syslog server on another computer and configure your Pi to send its (kernel) logs to it.Is there any way to trace disk errors? Problem being where to write them in the disk has gone offline.
But easier way would be to connect to your Pi from another computer using SSH and leave dmesg running (something like "dmesg -T -w").
I've had NVMe drive go "offline" on Pi 5 recently and been able to capture errors this way:
Code:
[Sun Apr 6 04:40:49 2025] nvme nvme0: controller is down; will reset: CSTS=0xffffffff, PCI_STATUS=0x10[Sun Apr 6 04:40:49 2025] nvme nvme0: Does your device have a faulty power saving mode enabled?[Sun Apr 6 04:40:49 2025] nvme nvme0: Try "nvme_core.default_ps_max_latency_us=0 pcie_aspm=off pcie_port_pm=off" and report a bug[Sun Apr 6 04:40:49 2025] nvme 0001:01:00.0: enabling device (0000 -> 0002)[Sun Apr 6 04:40:50 2025] nvme nvme0: failed to set APST feature (24580)[Sun Apr 6 04:40:50 2025] nvme nvme0: 4/0/0 default/read/poll queues[Sun Apr 6 04:40:51 2025] nvme0n1: I/O Cmd(0x1) @ LBA 13993960, 16 blocks, I/O Error (sct 0x0 / sc 0x4) MORE DNR [Sun Apr 6 04:40:51 2025] I/O error, dev nvme0n1, sector 13993960 op 0x1:(WRITE) flags 0x9800 phys_seg 2 prio class 2[Sun Apr 6 04:40:51 2025] Aborting journal on device nvme0n1p2-8.Statistics: Posted by vadelma-pi — Tue Apr 08, 2025 6:07 pm