N8n eating up my hard drive space / disk usage

It looks like n8n is starting to eat up my server disk space.
I feel like when I update my server and restart then some of my space gets freed up but as you can see n8n is still slowly using up my 50 GB server.

This is not an issue yet, just wanted to see what it might be and how I can fix it.

Did you enable data pruning?

1 Like

Oh, I will give that a try :slight_smile: Thanks.

You are welcome. You probably also want to checkout out DB_SQLITE_VACUUM_ON_STARTUP in case you are using SQLite.

Have fun!

1 Like

Do I need to update this in the .env file?
If so, I am not sure how to update the file, and my server is now holding at over 90% full :slight_smile:
Got to figure this our soon lol

That would be the place to set these settings yes. :slight_smile:

1 Like

And do not forget to restart afterwards.

1 Like

This might sound like a very very simple question…
How do I edit the .env file via PuTTY?

You have 2 options… You could use SFTP to download the file, edit it and upload it or you could use nano or vim to edit the file… I would recommend nano if it is available it is a bit more user friendly and a lot easier to exit (How to Exit Vim Editor - Stack Overflow Blog)

To start editing go where the file is and run nano .env or vi .env and it will open the editor and you can start working away on it.


The command: nano .env worked like a charm : )

I updated the file, but still, it looks like my HD spice is getting filled more by the day.
Did I miss something in the file?

How do you run in? Via docker? In this case you also have to add entries for the variables in the docker-compose file (under the environment section) and restart n8n that it gets used.

Yes, I am running Docker.
So what do I need to add entries for the variables in the docker-compose file.
How can I do that?
Any insight would be extremely helpful.

It is a text file like the .env file. So you can edit it the same way. You can also see how the other environment variables are defined in it already. So you can add the new ones the same way.

To my understanding there are many environment variables I can add to this file.
Are you suggesting I added them all?

Add the vacuum, prune and max age env options to the docker compose file. I would probably remove them from the .env as well as you only need it in the compose file.

No, do not add all of them, add only the ones you did also add to the .env file so that they actually get picked up and used.

And removing them from the .env could break things. Depends on how you set them.

        # If it is only a key is set it means it will read the value from 
        # the .env file and injects it. So if you remove it from the .env
        # file it will break.
        # Is defined with a value. So there is no need to have it in the
        # .env file as it does not get used as the value is hardcoded.
      - N8N_BASIC_AUTH_USER=jim

I have same issue. I am running n8n using docker compose. I have added both data execution prune and vacuum commands to compose and environment file, still n8n size has increased and using full 25GB of my VPS. Given below is data from my VPS.

df -h

Filesystem Size Used Avail Use% Mounted on
udev 445M 0 445M 0% /dev
tmpfs 98M 1.4M 97M 2% /run
/dev/vda1 24G 23G 0 100% /
tmpfs 489M 0 489M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 489M 0 489M 0% /sys/fs/cgroup
/dev/loop0 56M 56M 0 100% /snap/core18/2632
/dev/loop1 56M 56M 0 100% /snap/core18/2620
/dev/loop2 64M 64M 0 100% /snap/core20/1695
/dev/loop4 92M 92M 0 100% /snap/lxd/23991
/dev/loop5 50M 50M 0 100% /snap/snapd/17883
/dev/loop3 64M 64M 0 100% /snap/core20/1738
/dev/loop6 92M 92M 0 100% /snap/lxd/24061
overlay 24G 23G 0 100% /var/lib/docker/overlay2/917feb96adc01bb14183f3751062efe1231f91efb8c576840fd44a4818b7b5e2/merged
tmpfs 98M 0 98M 0% /run/user/0
overlay 24G 23G 0 100% /var/lib/docker/overlay2/5a70d3399138a10b80b0aabe3f0b38dac39676cad3b499cad2796868943337af/merged

.env file

added the following lines

Activate automatic data pruning


Number of hours after execution data will be deleted




Compose File with data pruning added

- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production

Still my disk usage is high, can somebody help.


Hi @Ashish_Ahuja, welcome to the community!

Can you check the actual size of your database file to verify whether this is what’s causing the problem for you?

If it’s indeed the database eating up that much space here it’d be worth checking if there are any problems around data pruning. In a first step I’d check the server logs after re-starting n8n for any errors around this. If you encounter any such errors you might want to open a new topic with all relevant details seeing this is a rather old thread that’s easy to overlook.

Just an update - Since I opened this topic on Feb,22 I can confirm that I never really solved the issue.
Since then my server disk usage went up to about 95% and just held there, then I installed n8n on my own server setup outside DigitalOcean and have not yet run into this issue once more.
In the back of my mind I simply figured that if this was a bigger issue more people would have run into this bug… I feel like it is just something I may have overlooked that caused such a big issue, that is why I started from scratch. :slight_smile:

@David_Go I had the issue when I first setup n8n and for me it was the vacuum option that I was missing, It turns out that while SQLite does delete the data it doesn’t actually give back the space until the vacuum runs (VACUUM).

I think it only runs on a service start as well which is why sometimes it can take a while to start up after an upgrade if it hasn’t been done for a while or if there is a lot of data being logged. I also found only logging failed executions helps but since then I have moved to Postgres and all has been good.

1 Like