Database Usage vs. File Storage

Using the snap package on Ubuntu 18.04

Nextcloud version (eg, 20.0.5): nextcloud 21.0.1snap2 28088 latest/stable nextcloud✓
Operating system and version (eg, Ubuntu 20.04): Ubuntu 18.04

Database storage seems large vs. the actual files.

I can see the following using ncdu:

--- /var/snap/nextcloud -----------------------------------------------------------------------------------------------------------
   10.6 GiB [##########] /28088
   10.6 GiB [######### ] /27920
    8.6 GiB [########  ] /common
@   0.0   B [          ]  current    

So I have 8.6GB of files, but the MariaDB is 21GB in size? Are my files duplicated inside the MariaDB? This seems kind of excessive.

I was in process of upgrading the cloud instance I have this running on, as it reported low space. I didn’t have that much stored in there (or so I thought), but I don’t know enough about what might be causing the MariaDB space usage to know what to do about it.

I see actually the 28088 matches the snap version? Is 27920 left over from an upgrade some time maybe?

I still question a database size of 10GB for 8.6GB of files, even if this is the case though.

Thanks for any insights

Edit: apparently resolved in the snap package

github link:

https://github.com/nextcloud/nextcloud-snap/issues/1742

I can’t help with snap but there are 2 common issues where DB could consume space

  • database could grow because of stale oc_filecache entries (especially if you connect big external storage sources) as described here
  • additionally you could have many/huge transaction logs even in small installations. for detailed explanation google for “mariadb binary log” in short you can cut the logs to specific point:
#truncate logs
PURGE BINARY LOGS TO 'mariadb-bin.000063';
PURGE BINARY LOGS BEFORE '2013-04-21';

and then limit the size of transaction logs [my.cnf]:

max_binlog_size = 134217728
expire_logs_days = 3

I think you might be right about the binary logs, I do see this:

    1.0 GiB [##########]  binlog.000010
    1.0 GiB [##########]  binlog.000008
    1.0 GiB [##########]  binlog.000005
    1.0 GiB [##########]  binlog.000012
    1.0 GiB [######### ]  binlog.000006
    1.0 GiB [######### ]  binlog.000011
    1.0 GiB [######### ]  binlog.000007
    1.0 GiB [######### ]  binlog.000004
    1.0 GiB [######### ]  binlog.000009
  693.4 MiB [######    ]  binlog.000013
  633.9 MiB [######    ]  binlog.000003

Should I have to do manual config changes and database pruning when using snap package? Maybe I naively thought not, but if so , then so be it.