ServerAvatarDocs
Servers

Disk cleaner

See how full the server's disk is, clean up logs, caches and temporary files, and set up an automatic cleanup.

The disk cleaner frees space on the server's disk. It finds what can be removed, shows how much each item would free and cleans what you choose. Open Disk cleaner in the server's sidebar (under Server). Central shows and cleans the disk of the server itself.

  1. Open Disk cleaner in the server's sidebar.

    The Disk cleaner page with the disk space, the amount that can be freed, the automatic cleanup state and the list of what can be cleaned

The three tiles at the top show:

  • Disk space: how full the disk is ("12% full") and "used of total used · free free", with the time of the last cleanup.
  • Can be freed: how much space a cleanup could free and in how many items.
  • Automatic cleanup: Off, or when it runs, and when it last ran.

What can be cleaned lists the items, with the biggest first. Nothing is ticked at first. The list says when it was measured ("Measured just now") and lists what is already clean ("Already clean: …"). If nothing can be cleaned it says "Nothing to clean right now". Select Show exact folders to see the folders each item covers, or the refresh button to measure again.

What can be cleaned

ItemWhat it covers
Package cacheDownloaded update files. Installed packages keep working.
Unused packagesAutomatically installed packages and old kernels no longer needed. The running kernel is kept.
Unused Docker imagesDocker images no container uses (running or stopped) and Docker's build cache. Apps' data (volumes) is never touched. A removed image is downloaded again when an app needs it.
System journalSystem log history.
Rotated logsOld compressed and rotated log archives under /var/log. Current logs are untouched.
Service logsCurrent log files of running services. They are emptied, not deleted, and the services keep writing.
Application logsEvery hosted application's access and error logs and their rotated copies.
Temporary filesFiles in /tmp and /var/tmp.

An item marked Check first is not marked safe to remove unattended. Look at what it covers before you clean it.

Clean up now

  1. Choose How much to keep: Delete all, Keep 1 day, Keep 3 days, Keep 7 days (recommended), Keep 14 days or Keep 30 days. The choice applies to every item. Anything newer than it is kept. With Delete all nothing is kept.
  2. Tick the items to clean, or Select all cleanable. The footer says "n items selected · about size". Until you choose something it says "Choose something to clean first."
  3. Select Clean up (the button also shows the size, for example Clean up 15 KB). Central asks Clean up these items? "This cannot be undone." "Active log files are emptied, not deleted." If any item is not marked safe you are told to check it first.
  4. Select Clean up again. "Working — this can take a minute on a busy server." When it is done you see "Freed size. The disk is now percent% full."

With Delete all, Central says "Everything in items is removed, including today's. This cannot be undone." and, for application logs, "Applications lose their visitor and error history." If a choice would free nothing it says "Nothing to clean with this choice" and offers Try the shortest choice.

If the page cannot tell whether the cleanup finished it says "The clean may still be running on the server. Refresh in a minute to see it in the history." Select Refresh.

Set up automatic cleanup

  1. In the Automatic cleanup tile select Set up automatic cleanup.

    The Automatic cleanup dialog with the schedule switched on, how often, disk usage, how much to keep and what to clean

  2. Turn on Clean up automatically: "Runs the cleanup on a schedule instead of only when you press the button."

  3. Choose How often: Every hour, Every day, Every week or Every month.

  4. Choose Disk usage: Any (clean every time) or Over 50%, 60%, 70%, 80%, 85% or 90%. The cleanup then runs only when the disk is at least that full.

  5. Choose How much to keep, as above. With Delete all the dialog suggests using 85% as the disk usage: "Delete all clears every log. Consider running it only when disk usage is above 85%."

  6. Under What to clean, tick at least one item. "Only items that are safe to remove unattended can be scheduled."

  7. Select Save schedule. You see "Automatic cleanup updated."

To turn the schedule off, open the dialog, turn off Clean up automatically and select Save schedule. The tile then reads Off.

Recent cleanups

Recent cleanups lists each run with When, What was cleaned, How (By hand or Automatic), Disk after and Freed. A run that did not complete shows Failed.

Limits

  • How much to keep: Delete all, or keep the last 1, 3, 7, 14 or 30 days.
  • A cleanup or schedule must include 1 to 20 items.
  • Automatic cleanup frequency: every hour, day, week or month. Disk usage threshold: 1 to 99% in the API; the page offers 50, 60, 70, 80, 85 and 90%.
  • Temporary files: Delete all still keeps files written in the last hour, so running installs and uploads are not broken.

Who can do this

  • Seeing the page, the schedule and the recent cleanups needs View on Disk Cleaner (server.disk-cleaner). Clean up and saving the schedule need Manage. Without it the page says "Your role can view the disk cleaner but not clean."

Common errors

  • The cleanup could not be completed. Nothing was changed, or only part of it. Check Recent cleanups.
  • The schedule could not be saved. Try again.
  • Choose at least one thing to clean, or switch automatic cleanup off above.
  • Saved before this choice existed: until you save, it keeps 7 days of journal and temporary files and removes everything else. A schedule made before the keep choice existed: save it again to pick a choice.

On this page