Tuesday, August 23, 2016

Disk Imaging Cleanup Steps

Run these disk-cleanup steps prior to backing up a hard disk or making a hard-disk image.  This saves time and disk space and has no risks.  Steps work for all versions of Windows but is illustrated for Windows 10.

Disk Image backups take considerable time because an average Windows hard disk has 100+Gig of data and programs. But for many machines, half of this space are temp files.  With just a few minutes, you can delete these unneeded files, freeing disk space and saving valuable time.  

Why the Clutter?

As you install new software and Microsoft Updates, Windows builds System Backup files. These occupy a boatload of space and can be safely deleted.  I run these steps each time I run a full-disk image backup.

Related articles:

Steps for Disk Cleanup

Ideally, close all programs and reboot the computer before starting - for no other reason to to close any running programs and to release temp files from possible file-in-use locks.

1.  See how much space is being used:

In File Explorer, open "This PC"  (formerly MyComputer).
"Other-mouse-click" Drive C:
Select "Properties"

Notice the used and free space.  In my case, my C: drive has 138G is used, and 777G is free

2.  From the Properties screen, [General] tab, click the "Disk Cleanup" button. 

3.  From the Disk Cleanup dialog

a.  Click all "Files to delete"
      -- Except "[  ] Hibernation File Cleaner" -- if displayed as an option

b.  Click "Clean up system files". 
     This will take several minutes to calculate.

4.  A new Disk Cleanup dialog appears.

Again, select all [X] options from the Files to delete section, you will note new options.

In particular, you may see "Previous Windows Installations" and "Temporary Windows Installation files".  These should be checked  (This will prevent you from rolling back to older versions of Windows -- for most, you should be committed and happy to stay on your version of Windows.  I recommend checking these two options.)

5.  This is the most important step: 
     In the "More Options" tab, under System Restore and Shadow Copies,
     Click "Clean up..."

     (In Windows 7, this is called "Cleanup System Files")

     At the "Are you sure you want to delete all but the most recent restore point?",
     confirm by clicking "Delete"

     Click "OK" to continue.  Confirm with "Delete files"

The delete will take considerable time - 5 to 20 minutes.  If you have a previous version of Windows installed, it will caution you again.  If you are committed to your Windows 10 installation, I recommend this part of the delete.

If you are following these steps with Windows 7, you may not see an hourglass during the delete.


Review the C: Drive Properties window.
On my machine I went from 128G used to 101G, but I have run these steps many times in the past.  When first ran, I gained approximately 40G of disk space.  This means I can store more generations on my external hard drive.

Continue with these optional steps:

Deleting the shadow copies and rollback files will gain the lion's share of disk and you could comfortably stop here.  But, if you want to gain even more space, and to have a chance to cleanup other programs and databases, continue with these steps:

A.  Empty and compact email programs.

Most people have never done this and over the years the email databases get huge.

Within your email program, begin by opening the "SENT" folder and deleting messages older, than say a year.  Do this for Mozilla's Thunderbird's Email Client or with Outlook). Then, continue below with additional cleanup steps.

With Mozilla's Thunderbird

  • Select File, "Empty Trash"
  • followed by File, "Compact Folders", in this order.
With Outlook
  • Select the Trash Folder;
  • Highlight all messages (click the first message, Shift-click the last message), then press Delete.
  • Select Edit, "Purge Deleted Messages".
  • Next, select File, "Data File Management", select your "Personal Folder", click "Settings.
  • On the General Tab, click Compact Now.
  • Click OK (twice) then Close.

B.  Clean your Browser Cache

With Mozilla's FireFox
  • Select Tools, Options, Advanced
  • Accept the defaults and generally do not erase the cookies.
  • Override Automatic Cache Management; set to 100MB (if using Office 365, choose 300MB)
  • Clear Cache Now
For Internet Explorer
     Note:  This is also cleaned up in the Temp Folder steps, below
  • Click IE's "Gear Icon" (Settings)
  • In Browsing History, click the "Delete..." button
  • Choose "Delete Temporary Internet Files".
    Optionally check other options, but leave "[x] Preserve Favorites"
  • While in the Settings screen, in the Browser History Section, select Settings and change the "Disk Space to Use" to 30 to 50MB.  The default is 250MB.
With Chrome
  • Click the Hamburger menu (far-right - e.g. Settings)
  • Click "Show advanced Settings"
  • In the Privacy section (half-way down the page), click "Clear Browsing Data..."
  • Accept the defaults and Choose "Obliterate from the past hour"
  • Close the Settings Browser Tab

C.  Optional:  Delete "Temp Folder" contents

This verges on geeky, but is somewhat fun to do.

There are numerous TEMP folders to clean (leaving the folders, but deleting their contents). You may or may not have folders in these locations and there may not be files -- but on some systems, there might be thousands of files:

Microsoft hides these folders from most users and you will need to expose them before you can manipulate their contents. Do the following:

Expose Temp Folders (one-time step):

For Windows 10
a.  Click the View tab along the Ribbon bar.
b.  Choose the "Options" button, "Change folder and search options"
c.  Click the new View tab
d.  Check "(*) Show hidden files, folders and drives"
e.  Uncheck "[  ] Hide extensions for known file types*
f.  Uncheck "[  ] Hide protected operating system files"
g.  In this order, Click Apply
h.  Click Apply to Folders
i.  Click OK.  Close File Explorer

* Curse Microsoft for still hiding file extensions such as .exe, .xlsx, .png, etc..  What a security risk!

For Windows 7:

a. Open File Explorer. Select top-menu Tools, Folder Options, View.
b. Check "Show hidden files and folders"
c. Uncheck "Hide extensions for known file-types..."
d. Uncheck "Hide protected operating system files..."
e. Click "Apply to all folders", then OK

Delete Files in Temp Folders
Here are likely places where temp-folders can be found.  Be sure you have rebooted before doing this step.
  • C:\Users\(your userid)\AppData\Local\Temp (Windows 7, 8 and 10)
  • C:\TEMP (you may not have this folder)
  • C:\Windows\Temp

For each path, open use Windows Explorer to open each folder.
a. While highlighting the folder, Select the top-menu, View, by "Details."

b. Click on the "Date" column header, to sort by Date.  Work on folders first, then files.

c. Highlight all folders/files older than today (or to be safe, older than a few days ago).  Do this by clicking the first, and shift-clicking the last in the list.  .

d. Press Delete to delete the highlighted files. Or Shift-Delete to erase without using the recycle bin.

Don't worry if some of the files can't be deleted because they are in-use.
The deleted files go to the recycle bin, which should be emptied when done.

D.  Delete and Restrict Java Cache

By default, Java can occupy as much as 32G of disk space for its own cache.  This is obscene.
Click this keyliner link for instructions on how to recover and tame this monster.

New-tab Link:  Java Cache Sizes are Piggy

E.  Uninstall Unneeded Programs

In the Control Panel, click "Programs and Features" (for Windows XP, use the Control Panel's "Add-Remove Programs").

Un-install unneeded programs, such as old photo editors and old games.

F.  Browse and Cleanup your Downloads folder

From File Explorer, open "Downloads"  (C:\users\(your name)\Downloads)

Consider deleting old and obsolete files.  Often, these are setup programs.  Once a program is installed, the original setup program should be deleted because there is undoubtedly a newer version somewhere.

G.  Windows XP and Vista only:  Delete old Uninstall Files

Skip this step with Windows 7, 8, and 10.

With Windows XP and Vista: Use Explorer, open the main C:\Windows folder. You may find a large list of folders with names such as "$NtUninstallKB9x".... and usually the filenames are blue. From Windows Explorer's detail side, delete all of these types of folders; there may be dozens of them. These are rollback files and are safe to delete. Neither you nor your computer will miss them.

Steps: Click the first blue folder; then shift-click the last blue folder. Press Delete. You may be bugged about deleting an executable -- allow it to happen.

Now, compare your disk-space used to see the results.  You should be pleasantly surprised.

Your comments on this article are welcome.

Related Articles:
USB Drive Backup Speed Slow
Optimizing the Windows Swap File
Java Cache Sizes are piggy