Hibernation file

Also known as: hiberfil.sys

On this page 7

The hibernation file is the hidden system file hiberfil.sys in the root of the Windows system volume that stores a compressed image of physical memory when the computer enters hibernation, so the machine can power off completely and later resume the exact session that was running. In Windows storage and file systems, it is one of the large reserved files that the operating system manages on its own, alongside the page file, and it also underpins the Fast Startup feature.

How the hibernation file preserves a session

When hibernation starts, Windows writes the contents of RAM to hiberfil.sys and then cuts power, a state defined by ACPI as S4. The kernel first pauses drivers and services, then the hibernation engine compresses the in-use memory pages and writes them sequentially to disk. Free and easily reconstructed pages are skipped, which keeps the saved image much smaller than total installed memory.

On the next power-on, the Windows Boot Manager detects a valid hibernation image and launches the resume loader, winresume.efi on UEFI systems, instead of a normal boot. The loader reads the image back into memory, restores processor state and returns control to the kernel, which reinitializes devices and reopens the user session with applications and documents where they were left.

Because the image describes a running kernel, the file is only valid for the exact boot configuration that produced it. If the disk is modified from another operating system in the meantime, resuming could corrupt data, which is why Windows marks hibernated NTFS volumes as in use and unsafe to mount read-write elsewhere.

The table below summarizes the main stages of a hibernation cycle and the component responsible for each.

StageComponentWhat happens
PreparePower manager and driversDevices receive a power IRP and save their state
Write imageHibernation engineCompressed memory pages are written to hiberfil.sys
Power offACPI firmwareSystem enters S4 and draws almost no power
ResumeBoot manager and winresumeImage is read back and processor state restored
InvalidateKernelImage header is cleared so it cannot be reused
Stages of a hibernation and resume cycle

Size, types and configuration of hiberfil.sys

Windows sizes the hibernation file as a percentage of installed RAM, not as a fixed amount. Since Windows 10 there are two file types: a full file that supports both hibernation and Fast Startup, and a reduced file that supports only Fast Startup. The default full size is about 40 percent of physical memory, which relies on compression to fit typical workloads.

Administrators control the file with the `powercfg` command from an elevated prompt. The following table lists the most useful settings and their effect on the file.

CommandEffectTypical use
powercfg /hibernate offDeletes hiberfil.sys and disables hibernation and Fast StartupReclaiming space on small SSDs
powercfg /hibernate onRecreates the file and enables hibernationRestoring default behavior
powercfg /h /type reducedShrinks the file to about 20 percent of RAMKeeping Fast Startup without full hibernation
powercfg /h /type fullSets the full file typeLaptops that need real hibernation
powercfg /h /size 50Sets the full file to 50 percent of RAMMemory-heavy sessions that fail to hibernate
Common powercfg options for the hibernation file

The size setting accepts values from 40 to 100 percent. Raising it helps when hibernation fails because the compressed image does not fit, a symptom that appears with large virtual machines or databases held in memory. Lowering the type to reduced is the safest space saver on desktops that never hibernate.

The file lives only on the system drive, usually C:, and cannot be moved to another volume. It is protected as a hidden system file and is excluded from Volume Shadow Copy snapshots and from most backup sets, because restoring an old memory image would be meaningless.

The hibernation file is often confused with the page file and the swap file, since all three are large hidden files in the root of the system drive. Their purposes differ: the page file extends virtual memory while Windows runs, whereas hiberfil.sys is written only at shutdown or hibernation and read once at the next start.

FilePurposeActive whenCan be relocated
hiberfil.sysStores memory image for hibernation and Fast StartupShutdown, hibernation and resumeNo
pagefile.sysBacks virtual memory and holds crash dumpsContinuously while runningYes
swapfile.sysSwaps suspended packaged appsWhile runningFollows the page file
MEMORY.DMPRecords memory after a system crashAfter a bug checkYes, through dump settings
Large system files in the root of the Windows volume

Sleep, hibernation and hybrid sleep also differ in how they use the file. Plain sleep keeps memory powered and does not touch hiberfil.sys, while hybrid sleep writes the image as a safety copy but keeps RAM powered, so a power loss still lets the session resume from disk.

Power stateMemory poweredUses hiberfil.sysResume time
Sleep (S3 or Modern Standby)YesNoAbout 1 to 3 seconds
Hibernate (S4)NoFull imageTypically 5 to 20 seconds
Hybrid sleepYesFull image as backupLike sleep unless power fails
Fast Startup shutdownNoKernel session onlyFaster than a cold boot
Power states and their use of the hibernation file

Fast Startup and its dependence on hibernation

Fast Startup is a hybrid shutdown that logs off users and then hibernates only the kernel session, the memory of session 0 with drivers and system services. Because the saved image is small, the next boot skips much of the device enumeration and service start, which shortens startup time on systems with slower storage.

The trade-off is that a Fast Startup shutdown is not a true cold boot. Driver state persists, the system volume stays in a hibernated state, and some updates or hardware changes take effect only after a Restart, which always performs a full boot. Turning off hibernation entirely also disables Fast Startup as a side effect.

Risks, limitations and troubleshooting

The most important limitation is disk space: on a machine with 32 GB of RAM, a full file can occupy around 13 GB of the system drive. A second concern is data confidentiality, because the image contains whatever was in memory, including keys and documents. With BitLocker enabled the file is encrypted along with the rest of the volume, so the risk applies mainly to unencrypted drives.

Typical symptoms and their causes are summarized below.

SymptomLikely causeFix
Hibernate option missingFile disabled or reduced typeRun powercfg with hibernate on and full type
Hibernation fails with memory in useCompressed image too largeIncrease size with the powercfg size option
Linux mounts NTFS read-onlyVolume left hibernated by Fast StartupShut down with Fast Startup off
Updates seem not to applyShutdown preserved kernel stateUse Restart instead of Shut down
Large unexplained space on C:Full hiberfil.sys presentSwitch to reduced type or disable
Common hibernation file problems

A common mistake is deleting hiberfil.sys manually in Explorer or with Disk Cleanup expectations. The file is locked while Windows runs, and the only supported removal path is `powercfg /hibernate off`, which also updates the boot configuration consistently.

Put simply

The hibernation file is a snapshot of everything your PC is doing, saved to the disk. The computer can then switch off completely. When you turn it back on, Windows loads that snapshot. Your open programs and documents are exactly where you left them.

Think of it as putting a bookmark in a book and closing it. The catch is that the bookmark takes up room. The file can use several gigabytes of drive space. You can shrink or remove it if you never use hibernation.

In practice

A field engineer uses a Windows laptop with 16 GB of RAM and a 256 GB SSD. During a two-day site visit she keeps a virtual machine, a diagnostic tool and several reports open, and she cannot charge the laptop overnight. Sleep would drain the battery, so she chooses Hibernate, and Windows writes roughly 6 GB of compressed memory to hiberfil.sys before powering off.

The next morning the laptop resumes in about 12 seconds with every window intact. Later, when the SSD runs short of space, the IT team considers disabling hibernation but instead keeps the full file type, because reliable multi-day hibernation matters more to her work than 6 GB of storage. On office desktops that never hibernate, the same team applies `powercfg /h /type reduced`, keeping Fast Startup while recovering several gigabytes per machine.