Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
moving_nextcloud_data [2022/03/01 18:42]
warmachine
moving_nextcloud_data [2022/03/01 19:09] (current)
warmachine
Line 18: Line 18:
  
 <code>nano /path/to/nextcloud/config/config.php <code>nano /path/to/nextcloud/config/config.php
-       'datadirectory' => '/new/path/to/data',</code>+'datadirectory' => '/new/path/to/data',</code>
                
 change the location in the database: change the location in the database:
Line 25: Line 25:
  
 <code>dbuser=$(awk -F\' "/'dbuser'/{print \$4;exit}" /path/to/nextcloud/config/config.php) <code>dbuser=$(awk -F\' "/'dbuser'/{print \$4;exit}" /path/to/nextcloud/config/config.php)
-      dbpassword=$(awk -F\' "/'dbpassword'/{print \$4;exit}" /var/www/nextcloud/config/config.php) +dbpassword=$(awk -F\' "/'dbpassword'/{print \$4;exit}" /var/www/nextcloud/config/config.php) 
-      mysql -u$dbuser -p$dbpassword</code>+mysql -u$dbuser -p$dbpassword</code> 
 +      
 Inside the MySQL console: Inside the MySQL console:
-      <code>use <nextclouddb>; + 
-      update oc_storages set id='local::/new/path/to/data/' where id='local::/path/to/data/'; //take care about backslash at the end of path!! +<code> 
-      quit;</code> +use <nextclouddb>; 
- Again outside the MySQL console +update oc_storages set id='local::/new/path/to/data/' where id='local::/path/to/data/';  
-      <code>unset dbuser dbpassword+quit;
 </code> </code>
-<code></code> +       
-<code></code> +Again outside the MySQL console 
-<code></code> + 
-<code></code> +<code>unset dbuser dbpassword</code> 
-<code></code>+  
 +turn maintenance mode off: 
 + 
 +<code>sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --off</code> 
 + 
 +After that, carefully test Nextcloud, the files inside web ui, shares, tags, comments etc. If everything is working fine and Nextcloud indeed handles the files on the new location, you could remove the backups: 
 + 
 +<code>rm -R /path/to/data //old location!! 
 +rm /path/to/dbdump/dump.sql</code>
  
Last modified: le 2022/03/01 18:42