How to free up space in VPS when disk is full

Describe the issue/error/question

Hi all, is there a way to delete execution logs in VPS when the disk is full?

Kindly help with the commands for Ubuntu to free up space. (In my case I need to delete the previous executions)

Thanks

What is the error message (if any)?

I can’t seem to access my site currently because the storage is full

Information on your n8n setup

  • n8n version: Previous version I think for March 2022
  • Database you’re using (default: SQLite): Default
  • Running n8n with the execution process [own(default), main]: default
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Running on Ubuntu

When posting a question please fill the template and do not just delete it! We put in in there for a reason. It avoids spending time on unnecessary follow up questions (and so have more time for other helpful things like improving our product) and to be able to help members faster.
Especially the part under “Information on your n8n setup” is important.
Thanks!

2 Likes

Thanks, @jan , it’s now updated. Will also make sure to follow the steps in future.

Perfect, thank you very much!

In this case, you want to check out the following topic:

To make it simple here are the important parts. You have to set the following environment variables:

# To make sure that old execution data does get deleted automatically
EXECUTIONS_DATA_PRUNE=true

# Define how long old executions should be stored in hours
# (in this case 1 week)
EXECUTIONS_DATA_MAX_AGE=168

# To make sure that SQLite actually frees up the memory.
# Without it the data will be deleted but the memory will not become available
DB_SQLITE_VACUUM_ON_STARTUP=true

After you did set the above, make sure to restart n8n. Is potentially even necessary to restart twice (else the vacuum will maybe not run).

Hope that is helpful!

2 Likes

Thanks @jan , I was trying this out but I didn’t seem to be able to save the docker compose file

Here is a screenshot of the error
upFj9J

Guess you started with it a little bit too late. Your whole hard drive is 100% full. So you have to see if you can free up some space somehow. For example delete some system log files, old docker images, …

Any tips on this, kindly? (commands to use)

General cleanup is probably best to simply Google:
https://www.google.com/search?q=clean+up+ubuntu+disk+space&oq=clean+up+ubu&aqs=chrome.1.0i512l2j69i57j0i512l7.3360j0j4&sourceid=chrome&ie=UTF-8

Removing Docker images:

# Display all available images
docker images

# Remove an image
docker rmi <IMAGE-NAME>
# for example
docker rmi n8nio/n8n:0.197.0
1 Like

Thanks, @jan, I was able to free up the space. I now tried it but it says “bad gateway” on the site.

Here is the screenshot of the docker-compose
yuleX1

I also restarted using these commands:
sudo docker-compose stop

sudo docker-compose up -d

Hey @zocket,

Bad Gateway might mean it is has not all started up yet. Have you checked the docker logs?

Getting this @Jon

lxiCOa

Hey @zocket,

Is it just looping those lines? It looks like the disk is still full, From what I remember the Vacuum option can take a bit of time but it does need a bit of space to run.

Yes @Jon yeah, it’s just looping with those lines.

How much space is available?

O0pDO0

Approximately 2.9 GB

I wonder if it just needs a bit more to finish the vacuum, Did you do a docker system prune?

No, I didn’t do that. I just cleared previous inactive images and system logs

Hey @zocket,

It could be trying a prune as it can sometimes free up a bit more space. Did you back up your workflows at all?

nope I didn’t backup

That is going to make it a bit more painful if you can’t free up more space, The quickest way to get back up and running would have been to move the old database to a temporary path then n8n would create a new one and all would be good.

You could try to manually delete execution data if you have a sqlite client installed.

Do you have an option with your VPS to add more disk space?