Difference between revisions of "Rocky 9.x Owncloud Manually moving DataDirectory"

From Notes_Wiki
(Created page with "Home > Rocky Linux or CentOS > Rocky Linux 9.x > File Sharing > Owncloud > Manually moving DataDirectory We can change path of owncloud DataDirectory as follows: ('''Assuming moving from''' /var/www/owncloud '''to''' /mnt/owncloud ) # Enable maintenance mode. For example #:<pre> #:: cd /var/www/html/owncloud #:: sudo -u apache php -f occ mainten...")
 
m
 
Line 14: Line 14:
#:: systemctl stop httpd
#:: systemctl stop httpd
#:</pre>
#:</pre>
# '''Figure out various datadirectory in use'''.  Although config/config.php mentions about only one DataDirectory the oc_accounts table might have home value which is not a sub-folder of config/config.php DataDirectory.  In such cases we need to either copy/migrate all these other home folders also.  To see various home folders in use, use below SQL query
#:<pre>
#:: select * from oc_accounts;
#:</pre>
#:: Look at value of home column.  Validate that they are sub-folders of same parent DataDirectory and plan accordingly. 
#:: We can move the home folders to a common location.  But after that we must update various user home path appropriately. 
# Move the files to new folder, Remount old Data directory on new path.  If instead of move copy is preferred then use:
# Move the files to new folder, Remount old Data directory on new path.  If instead of move copy is preferred then use:
#:<pre>
#:<pre>
Line 37: Line 43:
#:</pre>
#:</pre>
#: '''Trailing / in both paths is critical'''
#: '''Trailing / in both paths is critical'''
#: If various accounts have different home folder (Not common DataDirectory, update this step appropriately)
# Validate that output of below SQL is empty:
# Validate that output of below SQL is empty:
#:<pre>
#:<pre>

Latest revision as of 05:53, 15 October 2022

Home > Rocky Linux or CentOS > Rocky Linux 9.x > File Sharing > Owncloud > Manually moving DataDirectory

We can change path of owncloud DataDirectory as follows: (Assuming moving from /var/www/owncloud to /mnt/owncloud )

  1. Enable maintenance mode. For example
    cd /var/www/html/owncloud
    sudo -u apache php -f occ maintenance:mode --on
    sudo -u apache php -f occ maintenance:mode
  2. Optionally stop web server (Dont stop MariaDB database)
    systemctl stop httpd
  3. Figure out various datadirectory in use. Although config/config.php mentions about only one DataDirectory the oc_accounts table might have home value which is not a sub-folder of config/config.php DataDirectory. In such cases we need to either copy/migrate all these other home folders also. To see various home folders in use, use below SQL query
    select * from oc_accounts;
    Look at value of home column. Validate that they are sub-folders of same parent DataDirectory and plan accordingly.
    We can move the home folders to a common location. But after that we must update various user home path appropriately.
  4. Move the files to new folder, Remount old Data directory on new path. If instead of move copy is preferred then use:
    #Use below only if you want to copy instead of moving, Use twice space
    rsync -a /var/www/owncloud/ /mnt/owncloud/
    Trailing / in both paths is critical
  5. Connect to MariaDB using 'mysql'. DB name, Username and Password are part of config/config.php file. For example
    mysql -u <username> -p
    #On mysql> prompt
    use <db-name>
  6. Update oc_storage MariaDB table using:
    UPDATE oc_storages SET id='local::/mnt/owncloud/data/' WHERE id='local::/var/www/owncloud/data/';
    Trailing / in both paths is critical
  7. Update oc_accounts table using:
    UPDATE oc_accounts SET home = REPLACE(home, '/var/www/owncloud/data/', '/mnt/owncloud/data/' );
    Trailing / in both paths is critical
    If various accounts have different home folder (Not common DataDirectory, update this step appropriately)
  8. Validate that output of below SQL is empty:
    SELECT * FROM oc_jobs WHERE class = 'OC\Log\Rotate';
    If it is not empty use reference link below to understand how to update path in oc_jobs table
  9. Look at application setting to see if any application has cached path as part of its settings:
    cd /var/www/html/owncloud
    sudo -u apache php -f occ config:list
    If application has cached path then use reference link below to understand how to update path in oc_jobs table
  10. In config/config.php file update DataDirectory path
    Note that value of DataDirectory does not ends with trailing /
  11. Start http service, if it was stopped
    systemctl start httpd
  12. Remove owncloud from maintenance mode. For example
    cd /var/www/html/owncloud
    sudo -u apache php -f occ maintenance:mode --off
    sudo -u apache php -f occ maintenance:mode


Refer:


There is older article on this at CentOS 8.x Owncloud changing datadirectory for a new installation


Home > Rocky Linux or CentOS > Rocky Linux 9.x > File Sharing > Owncloud > Manually moving DataDirectory