Reclaim disk space on Ubuntu server

Your server disk space can clog up very quickly with a lot of unneeded files. Let's find out how to reclaim your precious disk space back.

Mark van Eijk 1 minute read Hosting
  1. Shrink log files

There are a few ways that make it possible to reclaim diskspace right away on a server. This is very handy when your server is low on diskspace. Let's dive in!

Shrink log files

Using this command, we can shrink logfiles within a specific size. In this example we shrink all system log files to have a maximum size of 500 MB:

sudo journalctl --vacuum-size=500M

This article will be updated with more examples in the future

If the disk is already full, start with no space left on device. On Docker hosts, prune unused Docker data to claw back space.