Is this a hardware defect? The drive (PNY CS3140 1TB) is only about 5 weeks old. It seems to fix itself after a couple of reboots, but it's very annoying. Linux doesn't seem to have any issues with it yet.
I had a similar problem with an nvme and it turned out it wasn't seated properly in its slot. It was sitting very slightly at an angle even with the screw in place. I had the same problem with it sometimes being detected at boot and sometimes not.
I'd double check it's fully and correctly inserted into it's slot before writing it off as defective.
@BananaTrifleViolin Good idea. The M.2 slot was left unpopulated for years before I added this drive. It's possible that some dust got in there causing a connection issue.
I re-seated it and wiggled it around a bit to ensure any dust between the contacts got out of the way. It's being properly recognised now, but we'll see for how long.
Has nobody suggested checking disk manager for which drive letter is currently assigned to your nvme along with the DVD drive (if present)? I'm used to that error bring present when Windows tries assigning the same drive letter to the wrong drive, which would also explain the reboots fixing it.
PNY's own "SSD Toolbox" reports 100% SSD Life (whatever that means) and no available firmware updates. I can also "optimizate" my SSD here, which is funny.
(Lemmy users: Click the Fediverse icon to see screenshots) @techsupport
@fell@aliceif@techsupport I find smartctl useful for confirming driver temperatures (it made me realize CPU can survive more than spinning rust). It may be also useful to determine "how worn out correctly working drive is"... but clearly your drive is broken in unexpected way.
Could be an issue with the PCIe drivers (i.e. chipset driver). If the drive goes into gone mode, check device management to see if the drive shows up at all. If it does, open disk management to see if the partitions initialise at all.
If your drive is detected, go to device management to see which PCI subsystem it's connected to by selecting it and then go to View - devices by connection.
If it is detected, you can also check its values with something like CrystalDisk to see if something is wrong.
Lastly, if you have another NVMe drive lying about (long shot, I know), chuck it in the same port as the failing one and reboot a couple of times to see if something breaks.
To sum up: it's either the drive or the PCI interpretation layer in Windows. Eliminate to find the cause, then fix that. Since it works fine in Linux I think you can rule out hardware issue.