Windows 11 SSD Keeps Disappearing: Blame Link Power Management
Why an enterprise SATA SSD kept dropping out of Windows, and the two power settings that fixed it for good
The second SSD in one of my Windows 11 machines, a Samsung PM863a on an MSI B450M PRO-VDH MAX board, had started playing hide and seek. It would show up after boot, vanish, come back, and vanish again. Windows had also decided it was a removable drive, which is a strange thing to call a disk screwed into a drive bay.
The drive was healthy, the cable was new, and the BIOS could see it every single time. The fix turned out to be two power plan settings, plus a small script to stop Windows quietly undoing them.
The symptoms
The things that made this confusing:
- The drive appeared and disappeared in Windows after both cold boots and reboots.
- Windows showed it as removable, with an eject option in the tray.
- The BIOS always saw it, on every boot, without fail.
- Replacing the SATA data cable made no difference.
- The odd one: unplugging the drive’s power and plugging it back in while Windows was running made it behave perfectly until the next boot.
That last point is the useful clue. A hot-plug forces the drive and controller to renegotiate the link from scratch. If the drive works once it’s been through that, then the drive, the port and the cable are all fine. Something about how the link is managed after boot is the problem.
The reboot behaviour also ruled out the usual first suspect. Fast Startup is really a hibernate resume, so it can leave hardware in odd states, but a restart always does a full boot. Since reboots were affected too, Fast Startup wasn’t the cause.
Two separate problems
“Removable” and “disappearing” turned out to be different issues that happened to show up together.
The removable flag is cosmetic. Windows marks a disk as removable when the controller says the port supports hot-swap. On most desktop boards that’s a per-port Hot Plug option in the BIOS. Turn it off for that port and the flag goes away. If you don’t want to touch the BIOS, the inbox AHCI driver has a TreatAsInternalPort registry value under HKLM\SYSTEM\CurrentControlSet\Services\storahci\Parameters\Device that does the same job.
The disappearing is the real problem, and it’s link power management.
What’s actually going on
Windows enables AHCI Link Power Management (HIPM/DIPM) by default. That includes desktops with no battery, on the Balanced plan. When the drive is idle, Windows drops the SATA link into low-power “partial” and “slumber” states, then wakes it again when it needs the disk.
Consumer SSDs are built for this. The PM863a is a datacenter drive. It expects to be powered on and left at full speed in a server for years, and it doesn’t handle these link states gracefully. The link drops, and Windows loses the disk.
That explains every symptom:
- The BIOS always sees it. LPM only starts once the Windows storage driver loads.
- It flaps after boot. As soon as the drive idles, Windows tries to put the link to sleep.
- A power hot-plug fixes it until the next boot. The renegotiated link apparently doesn’t get pushed back into the same power states.
- It looks like removal rather than an error. That’s because Hot Plug is enabled on the port. A link drop on a hot-plug port gets reported as “the drive went away”. Without it, the driver treats the drop as an error and resets the port.
If you want confirmation, look in Event Viewer under System around the time of a drop. You’re looking for disk event 129 (reset to device), 153, or 157 (surprise removal), or Kernel-PnP surprise-removal events.
The fix
Two settings, both in the “Hard disk” section of the power plan:
- AHCI Link Power Management – HIPM/DIPM = Active, which means no link power saving
- Turn off hard disk after = Never
The HIPM/DIPM setting is hidden by default, so unhide it first. From an elevated command prompt:
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 0b2d69d7-a2a1-449c-9680-f91c70521c60 -ATTRIB_HIDE
After that it appears in Power Options under Advanced settings. You can also set it directly:
powercfg /setacvalueindex SCHEME_CURRENT 0012ee47-9041-4b5d-9b77-535fba8b1442 0b2d69d7-a2a1-449c-9680-f91c70521c60 0
powercfg /setacvalueindex SCHEME_CURRENT 0012ee47-9041-4b5d-9b77-535fba8b1442 6738e2c4-e8a5-4a42-b16a-e040e769756e 0
powercfg /setactive SCHEME_CURRENT
To check the result:
powercfg /q SCHEME_CURRENT 0012ee47-9041-4b5d-9b77-535fba8b1442 0b2d69d7-a2a1-449c-9680-f91c70521c60
“Current AC Power Setting Index” should read 0x00000000. The values are 0 = Active, 1 = HIPM, 2 = HIPM+DIPM, 3 = DIPM, 4 = Lowest.
On a desktop with no battery you’ll only see one value in the GUI rather than “On battery” and “Plugged in”. The setting still applies.
After a reboot with no hot-plugging, the drive stayed put. Problem solved.
Making it stick
The catch is that these settings live in the power plan, not somewhere permanent. Switching plans can bring the problem back, and so can a Windows feature update rewriting things.
Switching to High Performance or Ultimate Performance would also work, since those default HIPM/DIPM to Active. I’d rather not depend on nobody ever changing the plan, though, so I wrote a small batch file instead. It sets both values on every power plan, then reapplies the current one. It installs itself as a startup task running as SYSTEM, so every boot puts things right again.
@echo off
:: sata-lpm-off.cmd
:: Forces AHCI Link Power Management (HIPM/DIPM) to "Active" (off) and
:: disk turn-off to "Never" on every power plan. Safe to run repeatedly.
::
:: Run once as admin to install it as a startup task:
:: sata-lpm-off.cmd /install
setlocal
set SUB_DISK=0012ee47-9041-4b5d-9b77-535fba8b1442
set SET_LPM=0b2d69d7-a2a1-449c-9680-f91c70521c60
:: "Turn off hard disk after" (0 = Never)
set SET_DISKOFF=6738e2c4-e8a5-4a42-b16a-e040e769756e
:: Require admin
net session >nul 2>&1 || (echo Run this as Administrator. & exit /b 1)
if /i "%~1"=="/install" goto :install
:: Unhide the setting so it shows in Power Options
powercfg -attributes %SUB_DISK% %SET_LPM% -ATTRIB_HIDE >nul 2>&1
:: Set on every power scheme, AC and DC
for /f "tokens=4" %%G in ('powercfg /list ^| findstr /r "[0-9a-f]*-[0-9a-f]*-"') do (
powercfg /setacvalueindex %%G %SUB_DISK% %SET_LPM% 0 >nul 2>&1
powercfg /setdcvalueindex %%G %SUB_DISK% %SET_LPM% 0 >nul 2>&1
powercfg /setacvalueindex %%G %SUB_DISK% %SET_DISKOFF% 0 >nul 2>&1
powercfg /setdcvalueindex %%G %SUB_DISK% %SET_DISKOFF% 0 >nul 2>&1
)
:: Re-apply the current scheme so the change takes effect now
powercfg /setactive SCHEME_CURRENT
echo AHCI Link Power Management set to Active and disk sleep set to Never on all power plans.
exit /b 0
:install
set DEST=%ProgramData%\sata-lpm-off.cmd
copy /y "%~f0" "%DEST%" >nul
schtasks /create /tn "SATA LPM Off" /tr "\"%DEST%\"" /sc onstart /ru SYSTEM /rl HIGHEST /f
schtasks /run /tn "SATA LPM Off" >nul
echo Installed to %DEST% and scheduled to run at every startup as SYSTEM.
exit /b 0
Install it once from an elevated prompt:
sata-lpm-off.cmd /install
That copies it to %ProgramData%, creates a scheduled task called “SATA LPM Off”, and runs it once straight away. To remove it:
schtasks /delete /tn "SATA LPM Off" /f
del "%ProgramData%\sata-lpm-off.cmd"
One caveat about the for loop: it parses the English output of powercfg /list. On a non-English Windows install the GUID may land in a different token. Check that before trusting it.
Gotchas and lessons
- “The drive is healthy” and “the drive works” are different things. SMART was clean throughout. The drive wasn’t failing. It just disagreed with Windows about power saving.
- Swap the cable first anyway. A climbing
UDMA_CRC_Error_Count(SMART attribute 199) really is the most common cause of a SATA drive dropping out, so it’s worth ruling out. It just wasn’t the cause this time. - Pay attention to the hot-plug clue. If physically re-seating power while the OS is running fixes things until the next boot, the hardware is fine. Look at the driver and power management.
- Enterprise drives in desktops need a nudge. Used datacenter SSDs are cheap and excellent, but they assume they live in a server. Expect to turn off the consumer power-saving features.
- Samsung Magician doesn’t support the PM863a. If you want to check firmware,
smartctl -ifrom smartmontools for Windows gives you the version. Firmware updates come from Samsung’s enterprise SSD downloads, or from the OEM for Dell- or HP-branded units.
I didn’t bother with the removable flag in the end. It’s cosmetic, and with the link no longer dropping, Windows has nothing to “remove”.