# McClean: LowDiskSpace

## Overview

The computer for Scope #1 has recently been showing a warning (or error) saying:

Low Disk Space

You are running very low on disk space on Local Disk (C:).

Click here to see if you can free space on this drive.

If you see this error, here are some things to try to fix it.

## Materials

• Yourself
• A computer
• An overenthusiastic operating system (Windows)

## Protocol

### 0. Finding the problem

There are a few things to check:

• The Disk Cleanup utility
• The hibernation file
• The pagefile
• The windows log

The easiest way to figure out what's eating your disk space is to use TreeSize (already installed on the Scope #1 computer).

1. Click Start
2. Type treesize
4. Make sure the C: drive is selected and press the green play button
5. TreeSize will scan the C: drive and list the directories in order of size.
• If the Windows file is huge (hundreds of GB), try the disk cleanup utility. If that doesn't work, try "fixing" the Windows log
• If [n files] entry (selected above) is huge, click on that entry
• If you see a file named hiberfil.sys and it's large, disable hibernation
• If the file pagefile.sys is large (more than a few GB) move it to the other hard drive

If you don't have a large pagefile, hibernation file, or a logging problem then this guide will not help you. TreeSize should at least show you what's eating the space on your disk though.

### 1. The Disk Cleanup utility

Sometimes temporary files build up and cause problems. The Disk Cleanup utility can help you safely remove these.

1. Click on the error message. This will bring up the Disk Cleanup utility
2. Scroll through the list to see if anything "big" (i.e., tens of gigabytes) can be deleted
3. If so, check that item and click OK

The Disk Cleanup utility will remove unused files. In my experience, this does not actually free up very much space.

### 2. Enable/Disable Hibernation

In order to support hibernation, Windows creates a large file named hiberfil.sys where it dumps the RAM before hibernation. Then, when waking up from hibernation, Windows restores hiberfil.sys into the RAM.

On the Scope #1 computer, hiberfil.sys was about 50 GB in size (2/3 of the physical RAM size)

We should not need to hibernate these computers so I have turned off hibernation. This removed the hiberfil.sys file.

###### To re-enable hibernation (and restore hiberfil.sys):
1. Click Start
2. Type cmd
3. Right click on 'Command Prompt' and click 'Run as Administrator'
4. Type
powercfg.exe /hibernate on
5. Press Enter
6. Restart the computer
###### To disable hibernation (and delete hiberfil.sys):
1. Click Start
2. Type cmd
3. Right click on 'Command Prompt' and click 'Run as Administrator'
4. Type
powercfg.exe /hibernate off
5. Press Enter
6. Restart the computer

### 3. Moving the pagefile

Windows uses a pagefile for memory management. If there is a lot of physical RAM (e.g., the 64 GB on Scope #1's computer) the pagefile can be quite large and take up a lot of room on the C: drive. Fortunately, the pagefile can be moved to another drive.

IT IS RECOMMENDED TO KEEP A SMALLER PAGEFILE (AT LEAST 800 MB) ON THE C: DRIVE.

To move the pagefile:

1. Click Start
2. Right click 'Computer' and click 'Properties'
4. Click the 'Advanced' tab, then under performance click 'Settings'
5. Under the 'Advanced' tab, click 'Change'
• You are now at the virtual memory management settings panel
6. If 'Automatically manage paging file size for all drives' is checked, uncheck it
7. Click C:
8. Click custom size
9. Enter '800' in the Initial size box
10. Enter '1000' (or another size) in the Maximum size box
11. Click 'Set'. YOU MUST CLICK SET
12. Click your other drive (E: in our case)
13. Click 'System Managed Size'
14. Click 'Set'. YOU MUST CLICK SET
15. Click 'OK' on all windows
16. Restart the computer

Now when you run TreeSize, you should see a much smaller pagefile.sys file on the C: drive and a large pagefile.sys file on your other drive

### 4. The Windows logging bug

Unfortunately, a bug in Windows 7 causes problems if certain log files are larger than 2 GB in size. When this happens, the compressing program (makecab.exe) repeatedly creates ~100 MB cab files in the Temp folder. It will do this until the hard disk is full. The only 'solution' is to delete the large log file, delete the temporary files, and restart the computer. It's not enough to delete the cab files because makecab.exe will continue to produce them until the hard drive is full. Similarly, it's not enough to delete the large log file because the cab files will persist.

First, make sure this is an issue.

1. Load TreeSize and scan the C: drive as above
2. Click Windows > Temp > [n files]

If you see a lot of ~100 MB files that begin with cab, then this is your problem. In our case we had over 100 GB of cab files in the Windows\Temp folder.

To fix:

1. Navigate to C:\Windows\Logs\CBS
2. Copy all of these files to a new folder as a backup
• In practice, we probably don't need to save these. But it doesn't hurt.
3. Delete everything in C:\Windows\Logs\CBS
• You may get an error saying the file 'CBS' is in use. That's fine, its safe to keep this file.
4. Navigate to C:\Windows\Temp
5. Delete every file that starts with cab. There are probably hundreds to thousands of them.
6. Restart the computer

Now when you check TreeSize you should see that the Windows folder is MUCH smaller and that there are no cab files in the Windows\Temp folder.

## Notes

Please feel free to post comments, questions, or improvements to this protocol. Happy to have your input!

1. List troubleshooting tips here.
2. You can also link to FAQs/tips provided by other sources such as the manufacturer or other websites.
3. Anecdotal observations that might be of use to others can also be posted here.