How to limit the size of my nextcloud

I want to limit the size of my nextcloud to be sure there is some webspace left for other activities. Is it possible to set a maximum storage size for the whole cloud on my server?

the easiest way is to create a containerfile with a specific size and mount that with -o loop and put the nextcoud (or data directory) in that.

Ok, thanks! I’ve no idea how to do that but i try to google it :slight_smile:

1 Like

using the linux quota system would be better but I read that you want to use more websites and the apache does only use one username?

Besides using a container with a fixed size and the linux quota system you could also do one of the following:

  1. Limit storage usage for your users inside nextcloud - each user can get an individual quota in the user administration. Also this has the benefit that you can configure Nextcloud to send E-Mails once the quota will be reached.
  2. If you want ro limit the size that nextcloud uses in your webhoster environment, you could “attach” external storage to nextcloud - that might be dropbox, google drive, amazon S3, any webdav accessible “online storage” …
    Take a look at: https://docs.nextcloud.com/server/9/admin_manual/configuration_files/external_storage_configuration_gui.html#enabling-external-storage-support
    After configuring which storage you want to use you can also configure for which users and groups the external storage will be used for.

@GuZ
your first solution will not work since NC doesn`t count the deleted files in Trashbin nor Version files. Your second Solution undermines the very idea of nextcloud (at least if you dont do encryption).

@simonwahlers:
Using an separate Disk which you mount as /data would do the trick. When the space there is up, its up. But i dont know if that’s applicable in your scenario. Please tell us a little bit more about your setup.

Thank you all for your help so far. I haven’t solved the problem jet because I am not really into the very technical things. So I hoped there is a simple solution.

Some more info, as @Ascendancer asked: I have a 250GB webspace at all-inkl.com and am hosting some websites and email accounts there. I think for that 50GB would be enough, so I would like to limit my nextcloud to 200GB. The problem I have is, that my provider contacted me and told me my space is full. Now I found out that it is because of all the version files, nextcloud is saving. I am wondering how to limit that.

One solution I am thinking about is to add another FTP-Account to my Account and limit that to 200GB. But then I have to move the whole nextcloud and I am not sure if this works. Any recommendations?

You could set a limit of how long to version files in config.php:

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

Hi again. Stupid Question:
Do you have shell access to your server, and if so are you root or sudo capable? In this case i can tell you what exactly you have to edit. If not, we have sadly very little room for maneuvering here.

Hello experts,
3 years later: I have the same problem.
I have 50 GB storage at netcup, a simple webhosting solution.
I have shell access via OCCWEB-App, no root or sudo access.

Exceeding my webhosting is a real problem as all the services including the mail server gets disabled.

I set time limits for versions and deleted files, but this solves the problem not in a reliable way.
I’m running Nextcloud 18.0.7.

Is there any solution?

Best
Simon

Hi everyone,

@Ascendancer may I ask what would be your solution with root privileges (preferably in docker environment with named volumes).

Best regards,
Lukas