M.2 SATA randomly detached only on FreeBSD

From: Victor Volpe <youngsjrp_at_gmail.com>
Date: Sat, 09 Oct 2021 18:58:18 UTC
Hi folks,

This is my last resource, hope that someone can help me. I bought a
new Samsung EVO 860 M.2 SATA for my home server. Everything looked
good at the first boot on Windows, and tests with CrystalDiskInfo and
CrystalDiskMark were all fine. The problems started when I tried to do
a FreeBSD fresh install. Installation ran ok, but before the first
reboot I quickly saw the "detached" message on the white bold text.
System booted up, and I started to install the packages and make the
configs. When I ran bonnie++ the "detached" message was shown again
and the system crashed. Tried to make a new installation, but the
message keeps showing up randomly before, during or after the install.
Back to Windows with the reparted and formatted disk, it worked fine
even with file transfers, benchmarks and so.

*** NO ERRORS BEFORE ***
Oct  8 15:31:17  kernel: ada1 at ahcich1 bus 0 scbus1 target 0 lun 0
Oct  8 15:31:17  kernel: ada1: <Samsung SSD 860 EVO M.2 250GB
RVT24B6Q> s/n S413NS0R904336X detached
Oct  8 15:31:17  kernel: (ada1:ahcich1:0:0:0): Periph destroyed
Oct  8 15:31:19  kernel: ada1 at ahcich1 bus 0 scbus1 target 0 lun 0
Oct  8 15:31:19  kernel: ada1: <Samsung SSD 860 EVO M.2 250GB
RVT24B6Q> ACS-4 ATA SATA 3.x device
Oct  8 15:31:19  kernel: ada1: Serial Number S413NS0R904336X
Oct  8 15:31:19  kernel: ada1: 600.000MB/s transfers (SATA 3.x, UDMA6,
PIO 512bytes)
Oct  8 15:31:19  kernel: ada1: Command Queueing enabled
Oct  8 15:31:19  kernel: ada1: 238475MB (488397168 512 byte sectors)

I had tried everything I could: UFS/ZFS, BIOS factory settings reset,
new RAM modules, newer FreeBSD versions (13 and 14) and so on. The
problem happens only on FreeBSD! Windows and Linux work normally, with
full device throughput (550MB/s). My SSD is beginning to wear out
because of many repartitions/reformats I tried.

Windows (Booted up from an external Kingston SSD on USB3 Port):
- Full S.M.A.R.T. Test OK
- Samguns Magician Extended Surface Test OK
- Sustained Write Test (moving large files to the drive until it get full) OK

PartedMagic (Slackware Linux) (Booted up from a SanDisk Ultra Stick on
USB3 Port):
- Full S.M.A.R.T. Test OK
- DD Write Zeros OK
- Military Grade Wipe OK

Thanks.