External HDD directory

Hi

Im trying to install nextcloud an change the data directory to external HDD on ubuntu, but cannot manage to do that.

I have tried to change the owners and modified the conf file. Also i have tried to copy all the old files to the new dir without success

The Varasto is Finnish language an means storage

  • Data directory (/mnt/Varasto/Nextcloud) is invalid
    Please check that the data directory contains a file “.ocdata” in its root.
  • Cannot create “data” directory (/mnt/Varasto/Nextcloud)
    This can usually be fixed by giving the webserver write access to the root directory.

conf file

<?php $CONFIG = array ( 'instanceid' => 'ocft4awr4248', 'passwordsalt' => 'yg8V2y2SXZSRK9LKosj0dUh0Rm9/qm', 'secret' => 'Qmb+pIms5c9Ci0NC2SVXOYEnyf3wPzQ/C7uaLJ+wLlEGiy0U', 'trusted_domains' => array ( 0 => '192.168.43.202', ), 'datadirectory' => '/mnt/Varasto/Nextcloud', 'overwrite.cli.url' => '**********', 'dbtype' => 'mysql', 'version' => '11.0.1.2', 'dbname' => 'nextcloud', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'dbuser' => 'samu', 'dbpassword' => '********', 'logtimezone' => 'UTC', 'installed' => true, ); Sorry if there is a thread about this all i could find where not working or very old ones

I think it’s worth reiterating just in case: if this is a relatively new install, it would be better/easier to reinstall Nextcloud using the new storage directory as opposed to changing the existing path. Here’s some more information about how to proceed: Is there a safe and reliable way to move data directory out of web root?

Edit: Actually this is probably a better link: HowTo: Change / Move data directory after installation

I have done this successfully, but it’s technically not supported or recommend by Nextcloud.