The Windows Servicing Guy

Tips and tricks from a Windows support engineer on issues related to servicing

How to reclaim space after applying Windows 7/2008 R2 Service Pack 1

How to reclaim space after applying Windows 7/2008 R2 Service Pack 1

  • Comments 86
  • Likes

An often asked question is how to reclaim space after a service pack installation.  We've talked about VSP1CLN and COMPCLN for Windows Vista and 2008.  Now that SP1 is out, it's time to talk about how to do this on Win7/R2.  It's a DISM command now:

DISM.exe /Image:C:\test\offline /Cleanup-Image /spsuperseded /hidesp

NOTE: This command is from the help file and might not be the command you need.  For example, if you're running against an online installation, the command is dism /online /cleanup-image /spsuperseded

You can also use the disk clean up wizard to remove the service pack files.

Of course, either of these will make the service pack permanent which means that you cannot uninstall it from the system once you do this.  So, use this with caution.  As in previous cleanup commands, this will remove any superceded package from the system on the next scavenging pass and reclaim your space.  Feel free to ask questions if you have them.

--Joseph

Comments
  • I have not tested this method yet so, caveat emptor -

    How To Slipstream Windows 7 SP1 Into Installation DVD ISO

    www.intowindows.com/how-to-slipstream-windows-7-sp1-into-installation-dvd-iso

  • And keep in mind, if you do the above and blow up your installation media, we will not support your install.  I hate saying it like that but its true.  I've seen way too many utilities like this that end up keeping me employed because of what they do to the servicing mechanisms in Windows.

    Caveat emptor indeed. :)

  • @ Joscon:

    I'm an end user of Windows 7 Pro x64 on a home PC.  I was prompted by Windows Update to install SP1, nad the install completed w/o errors.  Now I need to purge the fi;es supeseded by SP1 to reclaim some disk space (had 7.6GB (19% of 40GB system partition) before SP1, now only aprox 5GB free).  When I ran Windows' built-in disk cleanup utility (%SystemRoot%\system32\cleanmgr.exe), it found 0 KB to remove.

    Relative to the SP1 cleanup commands you gave, was my SP1 install via Windows Update an "Online" or an "Offline" installation?

  • You'd be doing an online installation because it was against a running OS.  Maybe I will write something more on the subject.

    I'm surprised you didnt see it in disk cleanup, if thats the case, run the DISM command you should be good to go.

  • @Joscon:

    Indeed disk cleanup shows 0 KB of Service Pack backup files to remove.

    So I've now done Start> Run "dism /online /cleanup-image /spsuperseded" command, but that didn't reclaim any disk space.  Now what?

    (FYI: my sole username does have Admin privileges - do I need to run the DISM command at some higher level?  If so, how?  BTW I am denied access to view the hidden+system "C:\System Volume Information" folder, so I can't look to see if any SP1 backup files\folders might be stored there).

  • You're running the wrong command, because you're actively in Windows you dont need the /offline switch.  So, your command is:

    dism /online /cleanup-image /spsuperseded

    --Joseph

  • @ Joscon:

    I think you mis-read my 9:30AM post, I *DID* use EXACTLY that command "dism /online /cleanup-image /spsuperseded" (as you just re-itereated) in the Run box, but reclaimed NO disk space. So I am stumped what to do next.

    Is it possible that the super-hidden folder "$Usr.Jrnl" still holds pre-SP1 backup files?  If so, then am I not able to actually reclaim disk space consumed by the pre-SP1 backups?.

  • Oh sorry...I did misread that.

    Have you rebooted the machine since doing that?  Maybe the transactions are pended and need to be flushed out.  Oddly though, it sounds like it actually ran based on the behavior, so I am trying to figure out what is missing.

  • @ Joscon:

    Yes, I did re-boot (I likewise thought the cleanup might be pended), but on reboot the space was still not recovered.

    However, I * did* finally get the pre-SP1 Backups purged and recovered aprox 3.6GB free disk space - here's how I did it:

    1) I created a desktop shortcut to open the Command Prompt (set Target= "C:\WINDOWS\system32\cmd.exe") with elevated privileges (click Advanced and check the "Run as Adminstrator" checkbox);

    2) Launched the elevated Command Prompt and chose Edit> Paste the stated command "dism /online /cleanup-image /spsuperseded";

    3) that ran the cleanup process (it took about 3+ minutes to run). Here's what was reported in the Command prompt window <quote>:

    C:\Windows\system32>dism /online /cleanup-image /spsuperseded

    Deployment Image Servicing and Management tool

    Version: 6.1.7600.16385

    Image Version: 6.1.7600.16385

    Removing backup files created during service pack installation.

    Removing package Microsoft-Windows-UltimateEdition~31bf3856ad364e35~amd64~~6.1.7600.16385

    [==========================100.0%==========================]

    Service Pack Cleanup operation completed.

    The operation completed successfully.

    C:\Windows\system32>

    <end quote>

    (Aside: I duuno why this refers to "UltimateEdition" since my Win7 x64 is Professional version)

    But I'm happy now that the pre-SP1 Backup disk space is recovered!  Hopefully this will help other people do the same.

  • Weird, you were running it in an admin cmd prompt before, correct?  Not sure why a shortcut would have changed that behavior, but regardless, glad you got it figured out.

  • In retrospect, I originally was NOT running the command in an admin command prompt. window - my apologies for MY confusion.  As I stated earlier, I literally clicked Start > Run and put "dism /online /cleanup-image /spsuperseded" in the Open text box (w/o quotation marks), which did nothing...... Moreover, doing Start> Run > cmd to open a Command Prompt window does not open the Command Prompt window with admin privileges, as evidenced by <quote>:

    C:\Users\bmaytum>dism /?

    Error: 740

    Elevated permissions are required to run DISM.

    Use an elevated command prompt to complete these tasks.

    C:\Users\bmaytum>

    <end quote>

    Hence creating the desktop shortcut to launch cmd.exe but with Advanced > Run as Adminstrator checked then correctly allowed me to run the "dism /online /cleanup-image /spsuperseded" command from within that Administrator Command Prompt window.

  • LOL, happens to me all the time.  Just glad to know its working properly.  Let me know if you need anything else.

  • I upgraded my Windows Vista to Windows 7, and SP1.

    Why is "compcln.exe" still on my system if it isn't anymore the appropriate tool?

  • Because it was a Vista binary that nothing superseded would be my guess. Have you reclaimed your SP1 space with DISM?  If not, it may go away with that but honestly, I've never really tested your scenario so I am not sure.

  • Quite frankly these commands are annoying and unintuitive.