Easy steps to enable Disk Cleanup on Windows Server

Joseph Molloy
Solutions

When you start running out of disk space, you will notice a swift downturn in server performance, and some automated tasks, such as backups, will start failing.

This guide offers practical, step-by-step solutions to reclaim valuable disk space on your Windows Server. You’ll learn how to:

  1. Utilize built-in Windows tools for efficient cleanup
  2. Optimize system settings for better space management
  3. Identify and remove unnecessary files and applications
  4. Implement automated solutions for ongoing space management
  5. Compress files and folders without compromising functionality
  6. Expand your server’s storage capacity when necessary

Let’s take a closer look at what’s eating up space on your server’s drive and how you can free it up.

Key points

  • Disk Cleanup is a powerful built-in tool for removing unnecessary files, with GUI and command-line methods for flexible use.
  • Turning off hibernation frees up significant space, especially for servers that do not rely on this feature.
  • Regularly delete unnecessary files like temporary files, outdated backups, and unused applications to maintain server performance.
  • Enable Storage Sense to automate file cleanup and keep your server disk space optimized.
  • Compressing files and folders reduces disk space usage without deleting important data, ideal for rarely accessed files.
  • If storage needs surpass optimization, consider adding more server disk space through physical upgrades, VPS resizing, or cloud scaling options.

Run Disk Cleanup

One of the most effective ways to free up disk space on your Windows Server is by using the built-in Disk Cleanup utility. This tool helps you remove unnecessary files, temporary internet files, and other items that consume valuable disk space. There are two ways to run Disk Cleanup on your Windows Server:

Method 1: Using the GUI

Here are the steps below to run a disk cleanup using GUI:

  1. 1Open File Explorer and right-click on the drive you want to clean (usually C:).
  2. Select “Properties” from the context menu.
  3. In the Properties window, click on the “Disk Cleanup” button under the “General” tab.
  4. If prompted, select “Clean up system files” to include system files in the cleanup process.
  5. Wait for Disk Cleanup to calculate how much space you can save.
  6. Check the boxes next to the file types you want to remove.
  7. Click “OK” and then “Delete Files” to confirm and start the cleanup process.

Method 2: Using Command Prompt (CMD)

For those who prefer using command-line tools or need to automate the process, you can run Disk Cleanup using Command Prompt:

  1. Open Command Prompt as an administrator.
  2. To clean up the C: drive, including system files, use the following command:
cleanmgr /sagerun:1
  1. If you want to clean up a different drive, replace “C:” with the appropriate drive letter:
cleanmgr /d X: /sagerun:1

Replace “X:” with the drive letter you want to clean.

  1. The cleanup process will run silently in the background. You can check the progress by opening Task Manager and looking for the “Disk Cleanup” process.

Other ways to clean up disk space on Windows Servers

Running a Disk Cleanup task is the most common and one of the easiest solutions to your disk space issues. However, there are other things you can try to clean up your Windows Server. Here’s a comprehensive list of what you can do, and how:

1. Turn off hibernation

Hibernation is a power-saving feature that writes the contents of your server’s RAM to the hard drive before shutting down. While useful for some systems, it’s often unnecessary for servers and can consume a significant amount of disk space. Turning off hibernation can free up several gigabytes of space in your Windows disk space, depending on your server’s RAM size.

Servers typically run continuously and don’t need hibernation. The hiberfil.sys file, which stores the RAM contents, can be quite large, and disabling hibernation can improve overall system performance.

To turn off hibernation, you can use either the Command Prompt or PowerShell. Both methods require administrator privileges:

Method 1 – Using Command Prompt

  1. Open Command Prompt as an administrator.
  2. Type the following command and press Enter:
powercfg /h off
  1. Close the Command Prompt window.

Method 2 – Using PowerShell

  1. Open PowerShell as an administrator.
  2. Type the following command and press Enter:
powercfg -h off
  1. Close the PowerShell window.

After running either command, you can verify that hibernation is turned off by checking for the hiberfil.sys file. Open File Explorer and navigate to the root of your C: drive (or whichever drive your Windows is installed on). If hibernation is successfully turned off, you should not see a file named hiberfil.sys.

Note of Caution: Before turning off hibernation, ensure that your server doesn’t rely on this feature for any critical operations. In most cases, servers don’t need hibernation, but it’s always good to double-check your specific setup and requirements.

2. Delete unnecessary files

One of the most effective ways to clean up disk on your Windows Server is by removing unnecessary files. These can include temporary files, useless applications, internet temporary files, outdated backups, and items in the recycle bin. 

Let’s go through each category:

Temporary files

Windows creates numerous temporary files during normal operation. To remove these:

  1. Open File Explorer and navigate to C:\Windows\Temp
  2. Select all files and folders (Ctrl+A), then delete them
  3. Some files may be in use and can’t be deleted – that’s normal

Useless applications

Uninstalling unnecessary third-party software can free up significant space:

  1. Use the Win+X shortcut to open the Control Panel
  2. Click on “Uninstall a Program”
  3. Review the list carefully and click “Uninstall” on anything you no longer need

Remember, some tools you initially thought were necessary may no longer apply to your current circumstances.

Internet temporary files

For servers running web browsers, clear internet temporary files:

  1. Open Internet Explorer (if installed)
  2. Click on Tools > Internet Options
  3. Under Browsing History, click “Delete”
  4. Check “Temporary Internet Files” and click “Delete”

Outdated backups

Server and website backups consume a lot of storage space in Windows and will eventually exhaust your capacity if not properly maintained:

  1. Check your Windows Server backup directory for all generated backups
  2. Delete the ones you no longer need based on your retention strategy
  3. For SQL Server backups, either delete old ones or compress them to save space

To prevent this issue from recurring, clearly define a backup retention strategy. Ask yourself if you need to keep backups for weeks, months, or years.

IIS log files

Internet Information Services (IIS) log files can also consume significant space:

  1. Navigate to C:\inetpub\logs\LogFiles
  2. Delete or archive old log files you no longer need
  3. Consider writing a script to automatically delete old IIS log files and schedule it in Task Scheduler

Recycle Bin

Don’t forget to empty the Recycle Bin after deleting files. If it’s not visible:

  1. Open Windows Explorer and click on the “View” tab
  2. Click “Options” > “Change folder and search options”
  3. Click on “Show hidden files, folders, and drives”
  4. Uncheck “Hide protected operating system files”
  5. Click “Apply” to save the changes

After completing these steps, right-click on the Recycle Bin icon and select “Empty Recycle Bin” to permanently remove deleted files.

3. Turn on Storage Sense

Storage Sense is a built-in Windows feature that automatically cleans up servers in Windows by deleting unnecessary files. While it’s more commonly associated with Windows 10 and 11, it’s also available on Windows Server 2019 and later versions. Enabling Storage Sense can help maintain free disk space with minimal manual intervention.

Follow these steps to easily turn on Storage Sense:

  1. Open the Settings app (you can use Windows key + I as a shortcut)
  2. Navigate to System > Storage
  3. Toggle the switch under “Storage Sense” to turn it on

Once enabled, you can configure Storage Sense to your preferences. Here’s how you can do it:

  1. Click on “Configure Storage Sense or run it now” under the Storage Sense toggle
  2. Choose how often you want Storage Sense to run (Every day, Every week, Every month, or During low free disk space)
  3. Set how long to keep files in the Recycle Bin before deletion
  4. Determine how long to keep files in the Downloads folder
  5. For servers with OneDrive, you can also set options for cloud-connected content

Remember, while Storage Sense is a useful tool for maintaining free space, it’s still important to regularly review your server’s disk usage. Some critical files or logs might fall under Storage Sense’s purview, so ensure your configuration aligns with your server’s specific needs.

For servers that require more control or have specific retention policies, you may need to supplement Storage Sense with custom scripts or third-party tools. However, for many Windows Servers, Storage Sense provides a solid foundation for automated disk space management.

4. Compress system files and folders

Compressing files and folders on your Windows Server can significantly reduce disk space usage without deleting data. Windows offers built-in compression tools that are particularly useful for infrequently accessed files.

To compress files and folders:

  1. Open File Explorer and navigate to the folder you want to compress
  2. Right-click on the folder and select “Properties”
  3. On the General tab, click the “Advanced” button
  4. Check the box next to “Compress contents to save disk space”
  5. Click “OK”, then “Apply”
  6. Choose whether to apply changes to this folder only, or to this folder, subfolders, and files
  7. Click “OK” to start the compression process

For system files and folders, be cautious about what you compress. It’s generally safe to compress the Windows “Temp” folder and the “Program Files” folder, but avoid compressing frequently accessed or system-critical folders like C:\Windows\System32.

While compression saves space, it can slightly increase CPU usage when accessing compressed files. For most modern servers, this performance impact is negligible, but consider this for high-load systems.

Remember, compression ratios vary depending on the file type. Text-based files like logs and documents compress well, while already-compressed files like JPEGs or ZIPs won’t benefit much from additional compression.

5. Add more server disk space

While optimizing and cleaning your server’s hard disk can free up significant space, there may come a time when the amount of storage you have becomes insufficient as your websites and applications grow. In such cases, adding more server disk space is necessary.

Adding more disk space to your server can be done in several ways, depending on your server setup and hosting environment:

  • Physical Servers: Add new hard drives or replace existing ones with larger-capacity drives.
  • Virtual Private Servers (VPS): Resize your virtual disk through your VPS hosting provider’s control panel.
  • Cloud Servers: Scale storage resources through the cloud provider’s management console or API.

If you’re using a managed hosting service, like Liquid Web, expanding your server’s disk space can be done easily with their help. Their team can assist you in determining the best approach for your specific setup and implement the change with minimal disruption to your services.

When considering adding more disk space, keep these points in mind:

  1. Evaluate your current and projected storage needs to determine how much additional space you require.
  2. Consider the type of storage you’re adding (SSD/HDD) as it can impact performance.
  3. Ensure your backup solution can accommodate the increased storage capacity.
  4. Check if adding more storage will affect your hosting plan or incur additional costs.

Remember, while adding more disk space solves immediate storage issues, it’s still important to maintain good disk space management practices. Continue to monitor your disk usage, clean up unnecessary files regularly, and optimize your storage usage to ensure efficient use of your server resources.

Power up server performance with Liquid Web

Now you know how to save disk space on your Windows Server. By following this five-step guide, you can improve your server’s stability and security. Remember, effective disk space management is an ongoing process crucial for maintaining optimal performance.

If you want a worry-free backup experience, consider our Acronis Cyber Backups service and disaster recovery solutions. It ensures your data is protected, secure, and recoverable, all while keeping your server storage free from housing backups.

For those looking to further optimize their Windows hosting, Liquid Web offers the next level of service. Our Windows hosting solutions are designed to adapt to your growing needs from a server. Discover Liquid Web’s Managed Windows Hosting plans today and invest in a stable, efficient, and scalable infrastructure that’s ready to meet future challenges!

Never compromise on storage options or support services again!

Related articles

Wait! Get exclusive hosting insights

Subscribe to our newsletter and stay ahead of the competition with expert advice from our hosting pros.

Loading form…