Owncloud & Missing Data

I’ve been using ownCloud for a couple of months. Mostly it works really well but there are times when it isn’t quite as slick as its commercial counterparts.

One of the most disconcerting things that has happened so far was discovering that tens of gigabytes of files had disappeared from my computer. The sync client log said that they had been deleted, which was odd because I definitely didn’t do it. I checked the web interface, hoping that it was a local error, but they were gone from there too. I fired up a terminal, ssh’d into the server and checked my data directory manually. Thankfully of my files were there – but they were in some sort of limbo, not accessible to either the web interface or my local sync client.

Frantic googling showed that I am not the only person that this has happened to. There are a couple of ways to fix it, but the simplest solutions is to force ownCloud to perform a complete scan of your data directory and make the missing files available again. The following command will do just that:

sudo -u www-data php /var/www/owncloud/console.php files:scan --all

You might need to do it a couple of times. The initial scan brought the files back into the web interface, but I had to do it again before they would sync to my laptop.