Disk space discrepancy

Hi all,

I have a question: My files are currently around 8 GB but when I check on the server it says that I use 23 GB. Here is what tree came up with:

Filesystem Size Used Avail Use% Mounted on
udev 488M 0 488M 0% /dev
tmpfs 100M 11M 89M 11% /run
/dev/vda1 25G 23G 1.9G 93% /
tmpfs 497M 0 497M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 497M 0 497M 0% /sys/fs/cgroup
/dev/vda15 105M 3.6M 101M 4% /boot/efi
/dev/loop1 218M 218M 0 100% /snap/nextcloud/16402
/dev/loop3 90M 90M 0 100% /snap/core/7917
/dev/loop2 212M 212M 0 100% /snap/nextcloud/16739
/dev/loop4 90M 90M 0 100% /snap/core/8039
tmpfs 100M 0 100M 0% /run/user/0

So it looks like the /dev/vda1 folder is using 23 GB. Is that so? Can someone explain this for me?

Thank you

PS. Sorry if this was asked before but I couldn’t find anything

I’m petty sure that’s due to metadata, most importantly preview files which are stored inside the data dir as well. So you have many pictures beneath your actual Nextcloud data?

No. Not really. But I have another question can I just delete everything in the files_versions folder? And what is the uploads folder exactly?

The uploads folder contain the parts of uploaded files. I have seen folders where there has been a lot of junk left behind, probably mostly from unseccessful uploads. It’s safe to empty the folder - as long as the resp. client is not uploading at the moment.

Regarding the files_versions folder - this one keeps the versions of the modified documents of your data folder. Better use the NC web client to remove those. Just go to you base folder and head over to the lower left trash bin. Click on it and have it show you your deleted files - there you can also finally remove these files and gain back the occupied space.

Great. Thank you!

You can also adjust your config, so that not too many version will be saved, or automatically cleanup after X Days:

https://docs.nextcloud.com/server/16/admin_manual/configuration_server/config_sample_php_parameters.html#file-versions

Thank you. Do you mean the config.php at /var/snap/nextcloud/current/nextcloud/config? There is also an autoconfig.php. Couldn’t find the parameter “‘versions_retention_obligation’ => ‘auto’,” do I just add it to the config?

The uploads dir can be cleared safely but the versions dir not, otherwise the database would have left obsolete entries. Clear file versions from Nextcloud UI and set the versions retention option to keep only as much versions as needed.

Jep the option needs to be added to the config.php, it’s not present by default.

1 Like

Yes, for snap you have to use snap set command:
https://docs.nextcloud.com/server/17/admin_manual/configuration_files/big_file_upload_configuration.html

Yes, as e.g. 'versions_retention_obligation' => 'auto, 90',

Unfortunately I have the same problem again. I did everything above. I’m sure I don’t have 25 gb on my server but my df -h output looks like this:

Filesystem      Size  Used Avail Use% Mounted on
udev            487M     0  487M   0% /dev
tmpfs           100M   11M   89M  11% /run
/dev/vda1        25G   25G     0 100% /
tmpfs           497M     0  497M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           497M     0  497M   0% /sys/fs/cgroup
/dev/vda15      105M  3.6M  101M   4% /boot/efi
/dev/loop4      219M  219M     0 100% /snap/nextcloud/20007
/dev/loop3       94M   94M     0 100% /snap/core/8935
/dev/loop1       94M   94M     0 100% /snap/core/9066
/dev/loop5      233M  233M     0 100% /snap/nextcloud/20498
tmpfs           100M     0  100M   0% /run/user/0

So it says that /dev/vda1 and /dev/loop1 through loop5 are 100% in use.

Does anybody have any idea what is going on? I’m thinking about reinstalling the whole thing. Thank you

The coolest tool is “ncdu”. Install it
apt-get install ncdu

Command:
ncdu /

And scroll the biggest directorys.

1 Like

If you root if full you probably will not be able to install something else, just try to find out what is the biggest folder and why. This is similar to ncdu, but should be possible with existing tools:

du -a / | sort -n -r | head -n 20
535092	/usr/bin
102540	/usr/bin/dockerd
87132	/usr/bin/docker
47952	/usr/bin/containerd
...

or for a human friendly output:

du -ah / | sort -h -r | head -n 20
523M	/usr/bin
101M	/usr/bin/dockerd
86M	/usr/bin/docker
47M	/usr/bin/containerd
1 Like

Thanks guys. I was actually wrong. With ncdu I was able to find the problem. Thanks again

2 Likes