Open Hexasoft opened 4 years ago
Could you please paste the exact code you have in your “Local.php”? I’m having this same problem and would like to use this workaround.
From lib/private/Files/Storage/Local.php
in the method public function free_space($path)
I added the lines:
if (!$this->isUpdatable($sourcePath)) { $space = 999999999999; }
just after $space = @disk_free_space($sourcePath);
It is not very clean. It pretends that space is "enough" in case storage is not updatable. It should be more precise: in case of read-only "read-only storage" should be shown as message. In case of non-writable directory a "non-writable storage" should be shown.
But, in my case, this basic patch prevents users to complain.
This is exactly what I needed. Tried it and it's working great. Thank you so much!
I needed this because I wanted to add an extra layer of security by making my external shares read-only in FreeNAS Jail's mount point and not just in Nextcloud settings.
You're welcome. But beware that it is just a hack to prevent the message (and mind to re-apply after upgrades).
Yes of course. But the nagging message was the only problem here so, as far as I'm concerned, it's solved. It would be better if the message could be turned off in the GUI but for now this is perfect.
Is this Issue still valid in NC21.0.2? If not, please close this issue. Thanks! :)
@szaimen I confirm that this is still present in 21.0.3, I applied the patch proposed by @Hexasoft for now.
cc @icewind1991
With a very large disk using even 999999999999 will still cause warnings. I use the following work around instead;
if (!$this->isUpdatable($sourcePath)) { $space = @disk_total_space($sourcePath);
I have encountered this issue in Nextcloud 24.0.0.
my workaround was to change the line in lib/private/Files/Storage/Local.php in function free_space($path):
$space = function_exists('disk_free_space') ? disk_free_space($sourcePath) : false;
to:
$space = (function_exists('disk_free_space') && ($this->isUpdatable($sourcePath)) ) ? disk_free_space($sourcePath) : false;
Is your feature request related to a problem? Please describe.
When creating an external storage that points to an area with no free space, users get the "Your storage is full , files can not be updated or synced anymore !" message. The problem is that this message makes no sense when the target area is read-only (user can't add/modify files, even with free space). The same problem applies when "read-only" is selected in external storage configuration.
Describe the solution you'd like
Describe alternatives you've considered
At this time I patched
lib/private/Files/Storage/Local.php
so thatfree_space()
returns not empty for not writable path, in order to prevent disturbing messages to users.Additional context
The problem arise with a backup external storage: an incremental backup system is used on files, and it allows to navigate back in time via a FUSE mountpoint. This mountpoint is readonly, with 0 free space. The external storage is configured with "read-only" checked and "allow sharing" unchecked. Each time a user go inside this storage ("/…/backups/$user" → "Backup") the "full" message appears. Note: target directory is automounted.
Regards.
PS: my initial post on help.nextcloud.com → https://help.nextcloud.com/t/prevent-storage-full-on-external-storage/66578 (and suggestion to open an issue here)