CentOS 8.x Owncloud changing datadirectory for a new installation

From Notes_Wiki

Home > CentOS > CentOS 8.x > Desktop tools or applications > Owncloud > Changing datadirectory for a new installation


There is updated article on this at Rocky 9.x Owncloud Manually moving DataDirectory


It is not possible to change datadirectory easily on an existing installation as various databases hashes and paths need to be updated. However, for a new owncloud installation (Tested on bitnami ownloud 10.6.0-2) we can change data directory using:

  1. Create folder for data directory. This could be an LVM mount point. For example /mnt/files
    mkdir /mnt/files #Or mount <lvm-device> /mnt/files
  2. Change the ownership on this folder to daemon:daemon
    chown -R daemon:daemon /mnt/files
  3. Move existing data directory files to this location
    cd /opt/owncloud-10.6.0-2/apps/owncloud/data
    mv * /mnt/files
    mv .* /mnt/files #Important to move .ocdata and .htaccess files
  4. Update '/opt/owncloud-10.6.0-2/apps/owncloud/htdocs/config/config.php' with the new path
    'datadirectory' => '/mnt/files',
  5. Log into database using credentials from the above config file using '/opt/owncloud-10.6.0-2/mysql/bin/mysql -u root -p' and do following changes
    1. Check oc_accounts table
      select * from oc_accounts;
    2. If admin data folder is pointing to older path and not to updated /mnt/files then use following:
      update oc_accounts set home = '/mnt/files/admin' where user_id='admin';
  6. Now scan for changes for all paths using
    cd /opt/owncloud-10.6.0-2/apps/owncloud/htdocs
    sudo -u daemon /opt/owncloud-10.6.0-2/php/bin/php occ files:scan --all
  7. Upload a small test file to admin user and check contents of /mnt/files/admin/files folder to see if the new uploaded file is available there.


Home > CentOS > CentOS 8.x > Desktop tools or applications > Owncloud > Changing datadirectory for a new installation