Cant change data direcotry

Hey Guys,

i wanted to change my data directory.
So i created a new Folder on the Drive and copied everything into it.
Then i changed the config to the new Directory and et voilà: Error.

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

And thats what the log says:


  1. /var/www/html/lib/private/Files/Node/Node.php - line 216:OC\Files\Node\Node->getFileInfo()
  2. /var/www/html/lib/private/Files/Node/Node.php - line 117:OC\Files\Node\Node->getPermissions()
  3. /var/www/html/lib/private/Files/Node/Folder.php - line 155:OC\Files\Node\Node->checkPermissions(4)
  4. /var/www/html/lib/private/Files/AppData/AppData.php - line 94:OC\Files\Node\Folder->newFolder(“js”)
  5. /var/www/html/lib/private/Files/AppData/AppData.php - line 114:OC\Files\AppData\AppData->getAppDataFolder()
  6. /var/www/html/lib/private/Template/JSCombiner.php - line 97:OC\Files\AppData\AppData->newFolder(“core”)
  7. /var/www/html/lib/private/Template/JSResourceLocator.php - line 113:OC\Template\JSCombiner->process("/var/www/html", “core/js/mer … n”, “core”)
  8. /var/www/html/lib/private/Template/JSResourceLocator.php - line 69:OC\Template\JSResourceLocator->cacheAndAppendCombineJsonIfExist("/var/www/html", “core/js/mer … n”)
  9. /var/www/html/lib/private/Template/ResourceLocator.php - line 78:OC\Template\JSResourceLocator->doFind(“js/merged-template-prepend”)
  10. /var/www/html/lib/private/TemplateLayout.php - line 321:OC\Template\ResourceLocator->find([ "vendor/co … "])
  11. /var/www/html/lib/private/TemplateLayout.php - line 160:OC\TemplateLayout::findJavascriptFiles([ "vendor/co … "])
  12. /var/www/html/lib/private/legacy/template.php - line 210:OC\TemplateLayout->__construct(“guest”, “”)
  13. /var/www/html/lib/private/Template/Base.php - line 132:OC_Template->fetchPage()
  14. /var/www/html/lib/private/legacy/template.php - line 300:OC\Template\Base->printPage()
  15. /var/www/html/lib/base.php - line 690:OC_Template::printGuestPage("", “error”, { errors: [ … ]})
  16. /var/www/html/lib/base.php - line 1068:OC::init()
  17. /var/www/html/index.php - line 40:require_once("/var/www/html/lib/base.php")

I really dont know how to fix this.

Please help.

You need

cd /path/to/NC/root
sudo -u www-data php occ files:scan --all

better search and read documentation about it first.

Thanks for the answer.
But if i do this, i get the following error:

An unhandled exception has been thrown: OCP\Files\NotFoundException in /var/www/html/lib/private/Files/Node/Node.php:97 Stack trace: #0 /var/www/html/lib/private/Files/Node/Node.php(216): OC\Files\Node\Node->getFileInfo() #1 /var/www/html/lib/private/Files/Node/Node.php(117): OC\Files\Node\Node->getPermissions() #2 /var/www/html/lib/private/Files/Node/Folder.php(155): OC\Files\Node\Node->checkPermissions(4) #3 /var/www/html/lib/private/Files/AppData/AppData.php(94): OC\Files\Node\Folder->newFolder('css') #4 /var/www/html/lib/private/Files/AppData/AppData.php(114): OC\Files\AppData\AppData->getAppDataFolder() #5 /var/www/html/lib/private/Template/IconsCacher.php(70): OC\Files\AppData\AppData->newFolder('icons') #6 [internal function]: OC\Template\IconsCacher->__construct(Object(OC\Log), Object(OC\Files\AppData\Factory), Object(OC\URLGenerator)) #7 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(87): ReflectionClass->newInstanceArgs(Array) #8 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(104): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass)) #9 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(125): OC\AppFramework\Utility\SimpleContainer->resolve('OC\\Template\\Ico...') #10 /var/www/html/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Template\\Ico...') #11 /var/www/html/lib/private/Server.php(968): OC\ServerContainer->query('OC\\Template\\Ico...') #12 /var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server)) #13 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(123): Pimple\Container->offsetGet('OC\\Template\\SCS...') #14 /var/www/html/lib/private/ServerContainer.php(132): OC\AppFramework\Utility\SimpleContainer->query('OC\\Template\\SCS...') #15 /var/www/html/lib/private/Repair.php(138): OC\ServerContainer->query('OC\\Template\\SCS...') #16 /var/www/html/core/register_command.php(143): OC\Repair::getRepairSteps() #17 /var/www/html/lib/private/Console/Application.php(118): require_once('/var/www/html/c...') #18 /var/www/html/console.php(95): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #19 /var/www/html/occ(11): require_once('/var/www/html/c...')

I searched for hours about this topic but nothing helped.

What is the user name of your webserver? I ask because I see the word “Permission” in error message and you mentioned nothing about your server. It is not necessary be www-data.

Please also compare the steps you did with the how-to: HowTo: Change / Move data directory after installation (Solution 1)

Jep since the error message contains failure about getting/checking permissions, does the new data filesystem actually support posix permissions? E.g. FAT does not and NTFS just with special mount argument. Otherwise the drive would need to be mounted with webserver user, AFAIK.

The Username of the Webserver is www-data. Im using apache2 on Debian with a MySQL Database.

The User 181185 is the owner of the Files.

The Permissions work. I copied it 1:1 to the other drive.
If i use the old one, everything is fine.
If i change it… broken.

I also tried this solution but it didn´t work.

The Filesystem is EXT4.

Data of Nextcloud is managed by your webserver, not by you-the-user. File owned by you-the-user means apache can do nothing on it.

To copy data from “the old one” to your new directory, you have to use the command rsync with option -a which preserve everything needed to be preserved for nextcloud.

Read official documentation is always more time saving than brave guess imho.

I checked it about 8 times. The permissions are equal to the old folder.
The Web root can read, write and execute.

But i will try again.

who owns the uid 181185? apache or you?


for both folders: document root of nextcloud & data folder of nextcloud, run

sudo chown -R www-data:www-date /path/to/above/folders

apache must own 181185.

I also tried already to make www-data owner of the files and folders but it also doesn´t effect everything

Also tried the rsync…
nothing happens.