The Wild

Command to Disable Hibernation: Windows & Linux

· 6 min read · Mammals

In this article
  1. What Hibernation Actually Does
  2. Disabling Hibernation in Windows
  3. Disabling Hibernation on Linux
  4. Disabling Hibernation on macOS
  5. Why You Might Disable Hibernation
  6. Common Problems and Fixes
  7. Hibernation vs. Sleep vs. Shutdown
  8. Frequently Asked Questions

The command to disable hibernation is powercfg /hibernate off in Windows (run from an elevated Command Prompt) and sudo systemctl mask hibernate.target followed by sudo systemctl mask hybrid-sleep.target on most Linux systems using systemd. On macOS, hibernation is controlled through pmset, typically with sudo pmset -a hibernatemode 0.

What Hibernation Actually Does

Hibernation is a power state in which the operating system writes the contents of RAM to non-volatile storage (usually a file on the system drive) and then powers the machine off completely. When you resume, the OS reads that file back into memory and restores your session exactly as you left it. This differs from sleep, which keeps RAM powered and only suspends other components, and from a full shutdown, which discards the session entirely.

Hibernation is useful on laptops that may sit unused for days, because it consumes no battery while preserving open work. On desktops and servers, it is often unnecessary and can cause problems: it reserves disk space equal to a large fraction of installed RAM (the hiberfil.sys file on Windows), it can interfere with dual-boot setups, and it may prevent certain firmware updates or wake-on-LAN features from working correctly.

Disabling Hibernation in Windows

Windows exposes hibernation through the powercfg utility. The command must be run from an elevated Command Prompt or PowerShell window, because it modifies system-wide power settings.

  1. Open Start, type cmd, right-click Command Prompt, and choose Run as administrator.
  2. Type powercfg /hibernate off and press Enter.
  3. Confirm that no error is returned. The hiberfil.sys file is deleted automatically.
  4. Optionally verify the state with powercfg /a, which lists available sleep states.

To re-enable hibernation later, run powercfg /hibernate on from the same elevated prompt. Note that disabling hibernation also disables Fast Startup, a Windows feature that uses a hibernation-like file to speed up boot times. Some users notice slightly longer cold boots after running the command; this is expected and not a fault.

If the command fails with an access-denied message, the prompt was not elevated. If it fails because hibernation is not supported, the hardware or firmware may not expose the required ACPI states, which is common on some virtual machines and older systems.

Disabling Hibernation on Linux

On Linux, hibernation support depends on the distribution, the init system, and whether a swap partition or swap file large enough to hold RAM is configured. Most modern distributions use systemd, which provides targets for sleep and hibernation.

  1. Open a terminal.
  2. Run sudo systemctl mask hibernate.target to prevent hibernation.
  3. Run sudo systemctl mask hybrid-sleep.target to block hybrid sleep as well.
  4. Check the result with systemctl status hibernate.target, which should report the unit as masked.

Masking a target is stronger than disabling it: a masked unit cannot be started even by another unit that depends on it. This is the recommended approach when you want to be certain the system will not hibernate. On distributions that do not use systemd, hibernation is typically controlled through the kernel command line or a configuration file such as /etc/default/grub or /etc/systemd/sleep.conf; consult the distribution documentation for the exact mechanism.

Disabling hibernation on Linux does not remove the swap space; it only prevents the system from using it for suspend-to-disk. Swap remains available for normal memory paging.

Disabling Hibernation on macOS

macOS manages power states through the pmset command. The hibernation mode is a numeric value; setting it to 0 disables hibernation and leaves the system in a pure sleep state.

  1. Open Terminal.
  2. Run sudo pmset -a hibernatemode 0.
  3. Optionally remove the sleep image file with sudo rm /private/var/vm/sleepimage to reclaim disk space.
  4. Verify the setting with pmset -g.

On Apple silicon Macs, the available power management controls differ from Intel-based models, and some hibernation-related settings may not apply. Check pmset -g output before assuming a setting took effect.

Why You Might Disable Hibernation

  • Disk space: The hibernation file can be several gigabytes, which matters on small SSDs.
  • Dual-boot conflicts: A hibernated Windows session can lock the filesystem and prevent Linux from mounting it safely.
  • Server and desktop stability: Machines that should never sleep or hibernate benefit from having the feature removed entirely.
  • Firmware and update issues: Some updates require a full shutdown rather than a resume from hibernation.
  • Privacy and forensics: A hibernation file can contain a copy of memory contents, which some users prefer not to retain.

Common Problems and Fixes

The most frequent issue is running the command without administrator or root privileges, which produces an access-denied error. Elevate the prompt and try again. Another common problem is that hibernation reappears after a Windows feature update; re-run the command and check whether a group policy or management tool is re-enabling it.

On Linux, masking the target may not prevent hibernation if a custom script or a desktop environment invokes the kernel's suspend-to-disk interface directly. In that case, also check the desktop's power settings and any custom suspend hooks. On systems with encrypted swap, hibernation may already be unavailable, and the mask command simply makes that explicit.

If disk space does not increase after disabling hibernation on Windows, confirm that hiberfil.sys is actually gone; a reboot may be needed for the file to be fully released.

Hibernation vs. Sleep vs. Shutdown

Sleep keeps the session in RAM and resumes almost instantly but draws power. Hibernation writes the session to disk and draws no power but resumes more slowly and uses disk space. Shutdown discards the session and draws no power. Disabling hibernation does not affect sleep or shutdown; it only removes the suspend-to-disk option. On Windows, it also removes Fast Startup, which is a hybrid of shutdown and hibernation.

Frequently Asked Questions

Does disabling hibernation delete my files?

No. It removes the hibernation file and the ability to hibernate. Your documents, applications, and settings are unaffected.

Can I re-enable hibernation later?

Yes. On Windows, run powercfg /hibernate on from an elevated prompt. On Linux, unmask the targets with sudo systemctl unmask hibernate.target. On macOS, set the hibernation mode back to its previous value.

Why is the command not recognized?

On Windows, powercfg is a built-in utility; if it is not recognized, you are likely in a restricted environment or a non-Windows shell. On Linux, systemctl requires systemd; older or alternative init systems use different commands.

Does disabling hibernation improve performance?

It frees disk space and can avoid resume-related issues, but it does not directly increase CPU or memory performance. Some users perceive faster shutdowns because Fast Startup is also disabled.

Is it safe to disable hibernation on a laptop?

Yes, but you lose the ability to preserve a session without power for extended periods. Sleep remains available, though it drains the battery slowly. Save your work before closing the lid if sleep is not configured.

What is the difference between hibernation and hybrid sleep?

Hybrid sleep writes the session to disk while also keeping it in RAM, combining fast resume with a fallback if power is lost. Disabling hibernation typically disables hybrid sleep as well.