Reserve critical free disk space to avoid server crash
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
How to use GitHub
- Please use the 👍 reaction to show that you are interested into the same feature.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Is your feature request related to a problem? Please describe.
When users of a multi-user nextcloud instance upload more files than there is space for on the server, the server ends up with 0 bytes free. This causes mysql to die as it runs out of space, and the server to crash with "Internal server error". This is hard to recover from, because clients auto-upload and retry, so even if I free up some free space on the server, it will get used up immediately and the server will crash again. What is really needed is for nextcloud to reserve some critial free space so that the server doesn't crash.
Describe the solution you'd like
A simple feature to add would be to have a default amount of reserved free space that the nextcloud server will not use, similar to the OWNCLOUD_CRITICAL_FREE_SPACE_BYTES env variable for the client. A good default might be 250Mb, which could be configurable in config.php.
Describe alternatives you've considered
Adding a user quota might help for a single-user system but is not practical for multiple users where different users have different space requirements. I previously used instance_quota app and manually set some limit, but this app is no longer available. The only solution left to me is file system level quota like ZFS datasets, but this is painful and shouldn't be needed if this simple feature was available.
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file, test, or entry point is named. Start by tracing how Nextcloud handles available storage during uploads and how server configuration is defined, then check related database failure behavior. Done should include a configurable default reserved-space limit, enforcement during uploads, and tests for low-disk conditions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, php
- Domain
- backend, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100