Cannot delete trash files permanently, because the trashbin won't open

Nextcloud version: 15.0.8.1 (using official docker image nextcloud:15-fpm-alpine)
Operating system and version: host runs CentOS 7.6.1810
Apache or nginx version: 1.15.12
PHP version: the one supplied with the Nextcloud image

The issue you are facing:

So I have the following problem.

I deleted about 800 GB of files via the webdav interface.
However it seems that this does not really delete the files, but rather move them to trash. Now the trashbin won’t open.

I already tried the hack from this: Can't access to the trashbin

But it seems that it did not work, the trash is still loading endlessly.

Is there any way to fix either the trash view or delete the files using the commandline?

Edit: I suspect that it is just the huge amount of data that makes the trashbin view break, because there are no obvious problems in the logs.

Yes there is a way if you have access to the NC-Instance-Commandline

  • ssh to your nextcloud server
  • $ sudo su
  • $ cd /path-to-your-nexcloud-data-location/ (this could be in /var/www/data/ for example)
    (this needs root privileges…thats why I mentioned $ sudo su before)

There you should see the users that have logged in your Instance
Now you should remember with wich user you have deleted your 800GB of files.
Then:

  • $ cd /the-users-directory/ , that you have used for deleting those files.
  • in there should be a “files_trashbin”
    -There you go:
    $ cd files_trashbin/files/
    and
    $ ls
    That should show you the files’ name and a cryptic file ending like “Filename.txt.31asd12”
    There you can delete the files you want to delete or
    $ rm *
    will delete anything in the folder.

Important:
Nextcloud doesnt know yet that you made manual changes in that directory. Now it is important to do the following

$ cd /var/www/nextcloud
(or the path you used for your NC-Instance-Webserver)
$ sudo -u www-data php occ files:scan {USERNAME}
({USERNAME} hast to be replaced by the name of the user you used to delete the files in NC)

This process will take a while…after that everything should be clean and nextcloud knows that the files are deleted and they are not listed in Web-Trashbin (this can be used to undelete files for example).

EDIT:
WARNING, if you do it like that, all files in trashbin will be deleted forever!!! If you are not sure about deleting, please consider to make a backup of those files!!!

1 Like

Hi there,

could you solve it that way @twatzl ?

Sorry for the late response. I have researched another way in the meanwhile.
According to the manual there is occ trashbin:cleanup command.

https://docs.nextcloud.com/server/15/admin_manual/configuration_server/occ_command.html#trashbin-label

It probably does something similar as you described but it one step and is easy to use.

Edit: I still wonder, because I think it should either be possible to use the UI or to display at least some meaningful message to the user.

2 Likes

No problem!
Glad to hear that your problem is solved =)

Greetings

Thanks Mdoering, this worked for me and saved me hours of frustration.

In a docker environment what’s the correct command for this:
sudo -u www-data php occ files:scan {USERNAME}

When I bash into my docker, running sudo -u www-data php occ trashbin:cleanup --all-users results in an error.