Procedure
- Uninstall unnecessary applications and optional Windows components.
- Run Disk Cleanup to free up space on the hard disk.The utility searches for files and data that you can safely delete, including:
-
Temporary Windows and Internet files
-
ActiveX controls, Java applets, and other downloaded program files
-
Files in the Recycle Bin
For details, see the Microsoft Help: http://windows.microsoft.com/en-us/windows/delete-files-using-disk-cleanup#delete-files-using-disk-cleanup=windows-7. -
- Use Deployment Image Servicing and Management (DISM) to free up space on the hard disk.DISM is a command-line utility that can be used to free up disk space by managing the Windows Component Store (WinSxS directory).For details, see the Microsoft Developer resource website: https://msdn.microsoft.com/en-us/windows/hardware/commercialize/manufacture/desktop/clean-up-the-winsxs-folder
- Open a Command Prompt window.
Note
Depending on the Windows version, not all of the following commands may be supported. - Type
dism /Online /Cleanup-Image /SPSuperseded
. - Type
dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase
.
- Open a Command Prompt window.
- Download SDelete and then zero out the free space on the hard disk.SDelete is a free command-line utility that securely deletes existing files and permanently erases file data in unallocated clusters of a disk. The utility can also ensures that even encrypted files cannot be recovered by overwriting all addressable locations with new and random characters.
- Download
sdelete.zip
from the Windows Sysinternals website: https://technet.microsoft.com/en-us/sysinternals/sdelete.aspx - Extract
sdelete.exe
. - Open a Command Prompt window.
- Go to the folder that contains
sdelete.exe
. - Type
sdelete -z [drive letter]
.SDelete zeroes the free space on the hard disk.
- Download
- Shut down the virtual machine.
- Open a Command Prompt window on the host system.
- Type
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd [path\[vm_name.vdi] --compact
.The virtual hard disk drive size is reduced.