← back to the blog

Keeping slash trim in Ubuntu

on January 26th, 2019 by Chanoch

The latest build of Ubuntu (18.04) which I created, took things a bit more relaxed. Previously I would create partitions for the bootloader, /boot /var/ /opt/ /home/ and /usr/ so that / effectively became primarily about root and etc.

This time, I created a partition for /home, one for / and a couple of others.

Then I installed dotnet and docker. When I checked, the recommendatino was to set aside about 11GB for /. in this configuration. Unfortunately, docker is storing around 8GB against /var/lib/docker then I installed dotnet (1.? GB on /usr/)

Not to worry, you can move both of these to a mount with more space then simlink bank but with a couple of gotchas for docker.

Firstly make sure that docker is stopped:

sudo service docker stop

Double make sure:

ps faux | grep docker

The only result should be your grep process.

Now you can move the entire docker directory. Make sure you use sudo as this folder has root permissions and will simply copy the contents to your destination. Let's assume that you've got a workspace mount under /workspace

sudo mv /var/lib/docker /workspace

Once you have done this, simply simlink the docker folder into /var/lib

sudo ln -s /workspace/docker /var/lib/

The other gotcha is more complex. Docker requires the containers and volumes into containers to be a path down from the root. Moving the containers and volumes directories only will cause the containers to fail when the service restarted.