Nextcloud 13 - Change Data Directory

Hello!

I have some problems with Nextcloud after installation app i found my difficult to change my data directory to another disk.
I have mount disk on UCS 4.3.
I don’t know what steps i need to do to change my data directory.
Anyone have the same problem can help me?

Best regards

Hi,
it looks like moving the files from /var/lib/univention-appcenter/apps/nextcloud/data/nextcloud-data to the new disk and changing the mount point to this directory should do.
It is obvious that preventing access to the data before (by shutting down the container before) is a good idea.

hth,
Dirk

Hi,
First, thanks for answer.
I thinks its easy but i don’t know i am doing wrong.
what i did:
->move to
cd /var/lib/univention-appcenter/apps/nextcloud/data/nextcloud-data
-> move file to mounted diretory:
rsync -av . /mnt/storageA/nextcloud-data
-> Check the files:
ls -a
-> Stop Container:
univention-app stop nextcloud
-> change ‘datadirectory’ to /mnt/storageA/nextcloud-data
nano /var/lib/univention-appcenter/apps/nextcloud/conf/config/config.php
-> Start again
univention-app start nextcloud

what i miss? some permissions?

best regards

Hi,

you can not change the datadirectory inside the container to something that only exists outside in the UCS host.
The only way I see is to change the mount from /mnt/storageA to /var/lib/univention-appcenter/apps/nextcloud/data

hth,
Dirk Ahrnke

Hi,

it depends on the installation, but I would move univention-app stop nextcloud to be the first step.

Besides: nano /var/lib/univention-appcenter/apps/nextcloud/conf/config/config.php is only copied to the container on an app-update and not every time the app starts. So to follow your path, you would have to change the config.php inside the app too. You can do it, but I think it is in general not recommend with univention-app shell nextcloud. Perhaps you will have to install an editor inside the container too.

Be careful when editing nano /var/lib/univention-appcenter/apps/nextcloud/conf/config/config.php and change the permission back to the original owner, that is: www-data. Or on the next app-upgrade you will have problems on the initial setup.

The mentioned way by @ahrnke seems to be safer.

best regards,
Bernd

Hi,
@Iebernd i understand what you mean, but i can’t mount disk on my container and this isn’t best way.
What you suggest its the same of @ahrnke right?

create a mount point on /var/lib/univention-appcenter/apps/nextcloud/data and don’t edit anything on config.php file.

what is possible to do? create this mount point or i need more commands?

Best regards,
Carlos

Any updates to this? I too have been wanting to change the data directory for Nextcloud and am having trouble finding a way to do this without affecting updates, etc. Using an NFS mount, etc would be useful

No updates needed. Just perhaps a step by step howto?

You can mount an external share permanently through /etc/fstab

Add an entry like:
IP.OF.NFS.SER:/data/yourshare/nextcloud /var/lib/univention-appcenter/apps/nextcloud/data nfs defaults 0 0

For the procedure I would probably:

  1. univention-app stop nextcloud
  2. move/copy the content of /var/lib/univention-appcenter/apps/nextcloud/data to a new directory like tmp/nc
  3. edit /etc/fstab according to your NFS-Server. There are a lot of howtos about mounting a nfs-share to linux. Try to mount it. mount -a
  4. check permissions of /var/lib/univention-appcenter/apps/nextcloud/data and copy the parked files tmp/nc back to it
  5. univention-app start nextcloud

Check if everything works as before.

Best, Bernd

Thanks for the reply! I was able to mount the share following your guide. That worked very well but of course I am now in a “permissions” mess. No big deal as this is a test system that I am learning on before I put this plan into production. I assume the owner of the share should be “www-data” as that is the HTTP user for Nextcloud

Mastodon