Free up Windows 10 Disk Space with Compact OS

Martin Brinkmann
Jul 28, 2016
Updated • Jul 5, 2017
Windows, Windows 10
|
16

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.

Now Read: Run Disk Cleanup to free up lots of space on Windows 10

Summary
Free up Windows 10 Disk Space with Compact OS
Article Name
Free up Windows 10 Disk Space with Compact OS
Description
Find out how to save disk space on the main Microsoft Windows 10 hard drive by running the command line tool compact OS to compress files.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Jody Bruchon said on November 16, 2017 at 3:49 am
    Reply

    This can hurt performance if you have a SSD, a fast HDD, or a very slow CPU. Your typical cheapo laptop with a 32GB eMMC SSD and a Celeron CPU will often come with Windows 10 in CompactOS mode, yet the Celeron processor means the decompression is slow and the read speed of an eMMC SSD is faster than a Celeron CPU can decompress. It’s done for space savings due to the tiny size of the SSD but it’s probably not worth it on such machines. If you have a faster CPU and a slower hard drive, you may have the opposite result.

  2. Rick said on July 29, 2016 at 2:10 am
    Reply

    This seems to be enabled by default for System32 (though, oddly, not “new files” added to that directory) for some reason. The screenshot shows that as well as my Insider system. I certainly didn’t enable it before since I never knew of it.

  3. MerleOne said on July 28, 2016 at 7:45 pm
    Reply

    Sure but since it is a bit risky, I am not sure I would change from such a limited gain. Thanks anyway for the tip. BTW, did you try to reboot after re-compacting ? I once had a bad surprise on a XP system with Windows NTFS compression…

  4. Rick said on July 28, 2016 at 7:39 pm
    Reply

    compaq /q gave ma 1,4 as well, when i did always i got no change,
    When i disabled it with never and then always again i got 1,6.

    Weird enough so perhaps give that a try :).

  5. James Kelly said on July 28, 2016 at 4:52 pm
    Reply

    I keep getting access violation issues even when I run as Admin I can run compact /q and get results bur compact .CompactOS:always throws up the access violation issue.

  6. MerleOne said on July 28, 2016 at 12:55 pm
    Reply

    On my PC it says the compression ratio is 1,4/1, so I guess it was already…

  7. 420 said on July 28, 2016 at 12:29 pm
    Reply

    Yes thank you Martin for showing me new stuff, I would say if you need to do this to free up 2 gigs of room, just buy a 250 gb 7200 rpm hdd on ebay for like 11 bucks. Or go to the local big lots or wal mart and buy an 16 gb stick for 10 bucks.

    1. Shadess said on July 29, 2016 at 1:46 pm
      Reply

      Don’t buy HDD’s for system drives anymore pls :D

      This might be very helpful on tablets or if you have a small-ish SSD for system drive. Good stuff.

  8. Rowan said on July 28, 2016 at 10:30 am
    Reply

    Thanks Martin for another interesting article – I appreciate your daily postings. I check them out most days. Some are just a little too technical for my understanding but I have learned a lot from the ones that didn’t make over my head! Keep up the good work, I’m sure many people also appreciate it!

    Windows 10 Compact OS seems interesting… Reading this gave me a feeling of déjà vu… it’s just like Superstor (the on-the-fly disk compression) in DR-DOS 6.0 back in about 1991 or 1992… but then probably not many of you had been born back then :-).

  9. ask said on July 28, 2016 at 9:29 am
    Reply

    Is this the same thing as ticking ‘Compress this drive to save space’ option in My Computer?

    1. Martin Brinkmann said on July 28, 2016 at 10:28 am
      Reply

      No this is different. This method won’t affect non-OS files at all.

  10. Dresandreal Sprinklehorn said on July 28, 2016 at 8:38 am
    Reply

    I don’t keep my personal files on Drive C. This keeps Windows running as fast as possible. I have them on Drive D and back them up on a removable flash drive.

    1. Decent60 said on July 28, 2016 at 10:18 am
      Reply

      Personal files don’t cause performance issues unless you’re searching through them or have a lot of files and trying to view them.
      Performance issues generally arise if your space is low, files are fragmented (ignore if you use SSD) or programs running in the background. There are other ways to make your Windows slower, such as cluttered registry.
      Slight issue if your desktop is being used as a “My documents” folder and bunch of icons are all over the place tho :-P

      Putting your personal files on another hard drive is always a great thing tho. Less chance of losing them if an update bricks your installation (which is bound to happen with Windows’ track record).

  11. Jeff said on July 28, 2016 at 8:01 am
    Reply

    This completely kills performance of the OS though.

    1. Martin Brinkmann said on July 28, 2016 at 8:05 am
      Reply

      I did not notice any issues on my machine. What are the stats of the machine that you noticed the performance drop?

      1. Leandro Azevedo said on July 28, 2016 at 8:20 pm
        Reply

        Interesting article!

        Why it is faster:
        When reading a binary file from the disk to the memory it takes a time.
        The larger the binary file the longer it takes.
        Long story short: it is faster to read compressed data from the disk to the memory then uncompress it than read the plain (whole/uncompressed) data from the disk to the memory.

        When you taking a trip which is faster: pack in one bag all your stuff even if you get a very tight bag OR pack 3 bags with the same stuff?

        However, I didn’t notice any disk space gain from running “compact.exe /CompactOS:always”

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.