Knowledgebase

How to Clear Disk Storage on Your HostingUp VPS Print

  • 0

Maintaining sufficient disk space on your HostingUp VPS is crucial for ensuring smooth performance and avoiding issues. This guide will walk you through the process of clearing disk storage to free up space.


1. Check Disk Usage

First, you need to understand how much disk space is used and identify the directories consuming the most space.

  • View Overall Disk Usage:

    df -h
  • View Disk Usage by Directory:

    du -h --max-depth=1

2. Remove Unnecessary Files

  • Clean Up Package Cache: Remove cached packages that are no longer needed:

    sudo apt-get clean
  • Remove Old Kernels: Check and remove old kernel versions that are no longer in use:

    dpkg --list | grep linux-image sudo apt-get remove --purge linux-image-X.X.XX-XX-generic
  • Delete Temporary Files: Remove temporary files from the /tmp and /var/tmp directories:

    sudo rm -rf /tmp/* sudo rm -rf /var/tmp/*
  • Find and Remove Large Files: Identify large files that can be removed:

    find / -type f -size +100M

3. Uninstall Unused Applications

  • List Installed Packages:

    dpkg --list
  • Remove Unnecessary Packages:

    sudo apt-get remove --purge package-name

4. Clear Log Files

Log files can grow significantly over time. You can truncate or remove old log files to free up space.

  • Truncate Large Log Files:

    sudo truncate -s 0 /var/log/large-log-file.log
  • Remove Old Log Files:

    sudo rm /var/log/old-log-file.log

5. Clean Up Docker Images and Containers

If you use Docker, old images and containers can take up substantial space.

  • Remove Unused Docker Containers:

    docker container prune
  • Remove Unused Docker Images:

    docker image prune
  • Remove All Unused Docker Data:

    docker system prune

6. Check for Orphaned Packages

Remove packages that are no longer needed:

  • Remove Orphaned Packages:
    sudo apt-get autoremove

7. Use Disk Cleanup Tools

Consider using additional disk cleanup tools for more thorough maintenance:

  • Install and Run BleachBit (if available):
    sudo apt-get install bleachbit sudo bleachbit

Summary

  1. Check disk usage.
  2. Remove unnecessary files and package cache.
  3. Uninstall unused applications.
  4. Clear old log files.
  5. Clean up Docker resources if applicable.
  6. Remove orphaned packages.
  7. Use additional disk cleanup tools if available.

Regular maintenance of your VPS will help keep disk usage under control and ensure your server performs optimally.


Was this answer helpful?
Back
WhatsApp Chat Need Help? Telegram Chat Chat on Telegram