Rocky 9.x Owncloud Manually moving DataDirectory

From Notes_Wiki
Revision as of 06:44, 7 October 2022 by Saurabh (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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. 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
  4. 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>
  5. 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
  6. 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
  7. 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
  8. 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
  9. In config/config.php file update DataDirectory path
    Note that value of DataDirectory does not ends with trailing /
  10. Start http service, if it was stopped
    systemctl start httpd
  11. 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