nextcloud-docker-dev icon indicating copy to clipboard operation
nextcloud-docker-dev copied to clipboard

Add nfs for storage

Open max-nextcloud opened this issue 2 years ago • 2 comments

I'm working on adding an nfs container that can be attached as storage.

Collecting my notes here so they do not get lost.

max-nextcloud avatar Aug 16 '23 06:08 max-nextcloud

Following https://blog.ruanbekker.com/blog/2020/09/20/setup-a-nfs-server-with-docker/ for a start.

Only difference is that i use ./data/nfs for the volume.

Trying to mount nfs from nextcloud instance fails due to missing statd.
docker-compose --env-file stable27.env exec nextcloud /bin/bash

root@90be4ba34a42:/var/www/html# mount -v -o vers=4,loud nfs:/ /mnt/nfs
mount.nfs: timeout set for Wed Aug 16 06:38:14 2023
mount.nfs: trying text-based options 'vers=4,addr=192.168.27.6,clientaddr=192.168.27.7'
mount.nfs: mount(2): Operation not permitted
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.

root@90be4ba34a42:/var/www/html# update-rc.d rpcbind enable

root@90be4ba34a42:/var/www/html# update-rc.d nfs-common enable

root@90be4ba34a42:/var/www/html# service rpcbind restart
Stopping RPC port mapper daemon: rpcbind.
Starting RPC port mapper daemon: rpcbindln: failed to create symbolic link '/run/sendsigs.omit.d/rpcbind': No such file or directory
 failed!

root@90be4ba34a42:/var/www/html# mount -v -o vers=4,loud nfs:/ /mnt/nfs
mount.nfs: timeout set for Wed Aug 16 06:41:21 2023
mount.nfs: trying text-based options 'vers=4,addr=192.168.27.6,clientaddr=192.168.27.7'
mount.nfs: mount(2): Operation not permitted
mount.nfs: trying text-based options 'addr=192.168.27.6'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.27.6 prog 100003 vers 3 prot TCP port 2049
mount.nfs: portmap query retrying: RPC: Program/version mismatch
mount.nfs: prog 100003, trying vers=3, prot=17
mount.nfs: portmap query failed: RPC: Program not registered
mount.nfs: requested NFS version or transport protocol is not supported

So now it fails with mount(2): Operation not permitted.

setting `privileged: true' on the nextcloud container fixed this.

max-nextcloud avatar Aug 16 '23 06:08 max-nextcloud

It was not possible to move the data folder out of the way because it was in use.

I ended up copying and removing it. Disabled the apached/sites-enabled - but maybe that was not necessary in the end because copy and move did the trick.

So basically

apt update && apt install nfs-client
mkdir /mnt/nfs
mount -v -o vers=4,loud nfs:/  /mnt/nfs
cp -ar data /mnt/nfs
rm -rf data/*
mount -v -o vers=4,loud nfs:/data  /var/www/html/data

max-nextcloud avatar Aug 16 '23 12:08 max-nextcloud