Skip to main content

Free up Windows 10 Disk Space with Compact OS

Compact OS is a new command line tool that Microsoft introduced in the Windows 10 operating system in an effort to reduce the system's disk footprint.

Probably the biggest change to previous versions of Windows in this regard is that Windows 10 does not need recovery images anymore, as the operating system will use existing files for that instead.

Compact OS is a new compression mechanism which takes files of the operating system and puts them in a (hidden) compressed container.

There is a lot that you can do with Compact OS, especially when it comes to optimizing and deploying images.

What's probably most interesting from an end-user's perspective is that you may change from a non-compacted to a compacted OS on a running system.

Free up Windows 10 Disk Space with Compact OS

If you do that, you may free up several Gigabytes of storage on the hard drive because of it. Mileage may vary but I have yet to come upon a system where the Compact OS operation would not free up at least 2 Gigabytes of space.

2 Gigabytes may not be much depending on available hard drive space. Running the operation makes sense if Windows is installed on a partition with little hard drive space, or a Solid State Drive that is low on space.

All commands are run from an elevated command prompt.

  1. Tap on the Windows-key.
  2. Type cmd.exe
  3. Hold down Shift and CTRL.
  4. Select the Command Prompt result to open an elevated command prompt.

Determine the state of OS binaries

compact os query

Before you do any compacting, you may want to determine the current state of OS binaries to find out whether the OS is already compressed.

Run the following command to determine that:

  • compact.exe /q

The command line tool returns information about the state. This includes how many files are compressed or not compressed, the compression ratio, and how many bytes of data are stored in the compressed container.

If the compression ratio is 1,0 to 1 or close to that, then the OS is not compressed.

Compressing the OS binaries to save up disk space in Windows 10

compact os always

Compression may impact performance under certain circumstances but it should not be noticeable on most systems.

Please note that you can go back to an uncompressed state at any point in time if you notice issues after compressing the OS. Also, to be on the safe side, it is recommended to back up important data before you continue.

Run the following command to compress OS binaries:

  • compact.exe /CompactOS:always

The operation may take several minutes to complete (on some systems 20 or more minutes). The amount of space you save depends on a number of factors. A test on the latest Insider Build installation of Windows 10 saved more than 2 Gigabyte of disk space after the compression.

To revert the change later on, run the following command to uncompress the data:

  • compact.exe /CompactOS:never

The operation does not take as long as the compression usually. Windows will occupy more disk space afterwards though so keep that in mind.

 

This article was first seen on ComTek's "TekBits" Technology News

HOME