There are 2 SATA ports on my motherboard (ASRock B450 Fatality K4) where HDDs are sometimes detected and sometimes not.
I've read the manual and it says that if one M.2 slot is occupied then SATA3-4 ports won't work. Ok, but I have no M.2 cards and SATA ports that don't work are A1 and A2:
Here is one lucky boot with A1 detected:
But I can reboot and it will disappear; or not. But in most cases it will.
PS. If I shutdown
the PC there is a high probability that all HDDs will be detected on boot. The problem often happens exactly after rebooting.
In the picture - there is an SSD in A1 slot, but all of this happened with HDDs. I just want to test every case.