Stuck trying to Vacuum sqlite database on Docker

Hi all,

My instance of n8n on docker (unraid) has crashed. Research shows that it’s the database.sqlite file which is too large (16GB).

I have read loads of posts and this is what I have done in my docker variables to try and resolve it:

EXECUTIONS_DATA_PRUNE true
EXECUTIONS_DATA_MAX_AGE 336
DB_SQLITE_VACUUM_ON_STARTUP true

I have restarted n8n several times but I am still stuck at 16GB.

So… I then ran the below command in docker console but got ‘permission denied’.
I then stopped the docker and ran the same command as root (outside of docker):

$sqlite3 database.sqlite ‘VACUUM;’

And I still get ‘permission denied’. What am I doing wrong? Any help gladly appreciated!

The mentioned values have to be set as environment variables. Is that what you mean with “docker variables”?

Do you have still enough space on your hard drive as the space will probably increase temporary.

Thanks as always for your help. Yes I think that’s what I mean with docker variables, the relevant docker commands are:

-e ‘EXECUTIONS_DATA_PRUNE’=‘true’ -e ‘EXECUTIONS_DATA_MAX_AGE’=‘336’ -e ’ DB_SQLITE_VACUUM_ON_STARTUP’=‘true’

I have noted the following message in the logs:

There was an error initializing DB: “SQLITE_FULL: database or disk is full”

I have checked the hard drive and it has 288GB free so space is not an issue. Seems like a database issue…

Am still struggling with this, any ideas on how to solve this and shrink the database?

Alternatively is there anyway of extracting my worflows from the file?

Hi @jppanchaud

It would seem that somehow your host is not allowing docker to access your disk entirely.

The vacuum process actually creates another file and transfers only necessary data to it, so this should be ok with the disk space you have.

One option is to copy the database.sqlite file (usually it’s located in /home/node/.n8n/database.sqlite to your host machine, manually run vacuum and place it in your container again.

I will leave you some links with instructions on how you could achieve this:

I hope these steps can help you start your container once again. Let me know if this works!

Hi @krynble

Thanks for your help on this. For some reason I had no end of problems. I managed to find an old backup of my database.sqlite at “only” 7GB yet I had the same errors. Copying to Linux did not help much.

In the end, I copied to file over to windows and used sqlite3.exe. After some playing around, I managed to fix it by using the commands below:

DELETE FROM execution_entity;
VACUUM;

Thank you all for your help!