What is a locked file?
Occasionally you might have a file that doesn't sync properly, and subsequently can't be deleted or renamed. The file might give an error saying that it is 'locked'. This article describes the procedure for unlocking files.
Checking the log
You might start by looking at the log, to see if any locked files are reported.
- Log into your Nextcloud instance with an admin account.
- Go to the Cog > Admin.
- Select Logging in the left pane.
You will see Fatal logs reporting any files that are locked.
Deleting locks from the database
Start by putting your Nextcloud instance into Maintenance mode.
- Access your database using phpMyAdmin.
- Truncate or empty the oc_file_locks.
- Alternatively run the following SQL code
DELETE FROM oc_file_locks WHERE 1
Now you can disable Maintenance mode, and all being well you will be able to delete and/or edit the locked file.
If you find that files are being regularly locked, you might want to stop file locking altogether. This is not recommended, and is only added here for information.
- Open the /config/config.php file for editing.
- Add the following line and Save the file.
'filelocking.enabled' => false,
Thanks for visiting.