Local External Storage not working?

I have just installed Nextcloud Server on a fresh Ubuntu 18.04 LTS system, following this guide by DigitalOcean. I found it a bit odd that it did not involve setting up mariadb/apache2 like all the other guides, but this was the only one that worked to the end with no error messages. I wish to set up a NAS which I can access from other devices anywhere. This system has an 8TB LVM comprised of 2x 4TB hard drives (and a separate small hdd for the OS).

I have managed to get the web interface working using this system’s local ip address (192.168.1.xxx), and added the plugin for External Storage.

I added External Storage type (Local) and path “/mnt/lvm/”.

I then tried to test if it’s working by creating a new .txt file, but I get Could not create file "123123.txt" error message, with no other information.

Going back to the External Storage app via Settings, it no longer allows addition of new External Storages, nor editing of current configurations. If I click the tick (Save) on the right of my entry, a red stop sign appears on the left. If I click the stop sign, it immediately turns into a green sign with a tick, but the external storage folder still cannot be used.

Does anyone know what is going wrong here? Did I configure local external storage correctly?

There are 2 places to create external storages:

  1. From the user panel: https://.../index.php/settings/user/externalstorages
  2. Global from administrator panel: https://.../index.php/settings/admin/externalstorages. Here you can also forbid to create external storages from the user panel. Only admin can create external storage linked to local folder.

Please check if you enable or disable creation of external shares for users in 2, in this case 1 will not work as you described (user will see storages set by admin, but will not be able to change them or added new).

Check if web user has rights to write to the directory. Try to set it to 777 and check if it works, this will give you a hint.

Thanks! I was looking for the admin/externalstorages page but really could not find it again, I thought it just disappeared and got replaced by the user/externalstorages after ‘enabling’ external storage!

I have went back to that page and added both my user account and the admin account in the “Available for” field. However, this did not solve the issue.

I have also chmod 777’ed the mount point for my HDDs which I am trying to use as external storage, and that does not work either. I can create files in the Ubuntu file system, but this is not reflected on Nextcloud.

  1. Could you please verify if this is the right way to point to a local storage folder?
    I have entered /mnt/lvm under the “Configuration” field since it says Location before I enter anything.

  2. I see this error message at the top:

"smbclient" is not installed. Mounting of "SMB / CIFS", "SMB / CIFS using OC login" is not possible. Please ask your system administrator to install it.

Is this relevant to the issues I’m having?

To do so, you need to ether check this folder via NC GUI to trigger immediately refresh, or run command (e.g. via OS cronjob) to do re scan of external storage’s:

sudo -u www-data php /var/www/nextcloud/occ files:scan --path="tschneemann/files/externalShareMountName"

Check this out:

I have set rights to 664 and added my NC user www-data to the group of local folder owner - in my case sambashare) by running following command (see explanation here):

sudo usermod -a -G sambashare www-data

You can check if user belongs to correct groups by running command groups <user>, in my case:

# groups www-data
www-data : www-data sambashare

I have /at the end e.g. /mnt/lvm/ not sure if it is really relevant. And in your case it could be as following:

Nope, if you mounting local folder, not samba :grinning: I have the same message on top.

P.S.

  1. You can test if your NC user has access to your local folder. E.g. for user www-data it could be:
    sudo -u www-data ls -la /mnt/lvm/
    Check if you can see content of the folder and then just try to access 1 particular file:
    sudo -u www-data tail /mnt/lvm/someFile.txt
    if not - you have access rights issue.

  2. I have a few external shares and to not mount it in root for this particular user you can create folder e.g. Externals and by mounting just set it as per screenshot. Folder fill be mounted under Externals under SomeFolder.
    image

@gas85, are you sure the user would be www-data on a snap install? I’m running into the exact same problem as @jolly_jaybird and have found nothing works…

Nope, for snap it is totally different.
All Apps are installed under you home in .snap, e.g. ~/.snap. Applications suppose to access regular user files, but I do not use it and could not help you exactly.
Wiki says your snap files under $SNAP_DATA ( /var/snap/nextcloud/current/ by default)

Removable media

Also note that the interface providing the ability to access removable media is not automatically connected upon install, so if you’d like to use external storage (or otherwise use a device in /media for data), you need to give the snap permission to access removable media by connecting that interface:

$ sudo snap connect nextcloud:removable-media

That’s what I thought; thanks, @gas85. Trying to set the permissions as requested and adapting them for a snap install yields no results; even connecting removable-media does nothing.

Oh, well.

It seems as though there is a “push” for nextcloud to be installed via snap from now on, so I hope the official wiki will reflect more specific instructions for that method.

Thanks for the insight.

Hello.
I am having the same issue.
I have installed ncpi with dockers.
I have tried the comand line above sudo -u www-data ls -la and it returned: ls: não foi possível acessar ‘/media/pi/744cd53e-d66a-4d25-a05d-a9e5afec7d01’: Permissão negada
How can I access my external HD? I have already installed external storage app like in this video and it didn’t work: https://youtu.be/pcAvknt53vs
Cound anyone help?
I am really a newbie.
Thank you very much.

According google Translate you have no access to this folder :slight_smile: Also this check that you did is valid for manual installation.

As you are using docker, you have to:

  1. give an access (mount it) to your local folder to the docker container - nextcloud
  2. configure external storage in nextcloud.

Lets go!
Step 1: You have to mount your local folder to the docker container with -v. E.g. based on Stackoverflow:

docker run -d -v /media/pi/744cd53e-d66a-4d25-a05d-a9e5afec7d01:/mnt/localFolder1:rw nextcloud

Please read more about persistent storage.
Step 2: Now you should be able to added /mnt/localFolder1 as external storage type - local folder on your nextcloud.

UPDATE:
Did not read it cearfully…

This means you took nextcloudPI image and use it in you PI? Or you install Debian/Ubuntu/Centos/etc. with a docker and then install Nextcloud??? Because those are different.

I have installed raspbian image and then used Dockers

Then try to mount your folder to docker container as was mentioned above.
Posiible that it will not work 100% at the end, becaus you need to give a special permissions, or do chmod -R 777 /media/pi/744cd53e-d66a-4d25-a05d-a9e5afec7d01 to the folder (allow to all), what I will not recommend. Please write back when you finished with folder mount and added it to NC.

Update: I found in tickets, solution how it should looks like (read from “For anyone setting this up for the first time, and wanting to add their filesystems they’ve attached to the docker container”):

I did not make this command yet because you said you did not recommend it. [quote=“gas85, post:12, topic:55081”]
chmod -R 777 /media/pi/744cd53e-d66a-4d25-a05d-a9e5afec7d01
[/quote]
I have made this instead: sudo docker run -d -p 443:443 -p 80:80 -v /media/pi/9C84EEE084EEBC40/:/data --name nextcloudpi ownyourbits/nextcloudpi 192.168.0.35 --restart:always
And it appeared in nextcloud server, but says that I do not have permission to see or write there.

1 Like

Could you please run this command and check (I added :rw at the end to ensure write and read.):

docker run -d -v /media/pi/744cd53e-d66a-4d25-a05d-a9e5afec7d01:/mnt/localFolder1:rw nextcloud

If you have then problem that Nexctloud create files that you can’t read afterwards, please find out to whom belongs your files. For this run:

ln -n /media/pi/744cd53e-d66a-4d25-a05d-a9e5afec7d01/

Then you can take this ID and mount folder mapped to it. E.g. if UID is 1001 you can added to your command -e USERID=$UID as -e USERID=1001. Read more about:

docker run -d -v /media/pi/744cd53e-d66a-4d25-a05d-a9e5afec7d01:/mnt/localFolder1:rw -e USERID=1001 nextcloud

I am sorry, but it didn’t work either. I can not see my external storage drive. :pensive:

Post output of following 3 commands :

df -h

sudo fdisk -l /dev/sd*

ls -lh /dev/disk/by-uuid/

Thank your for your hepl

Filesystem Size Used Avail Use% Mounted on
/dev/root 29G 7.0G 21G 25% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 464M 0 464M 0% /dev/shm
tmpfs 464M 6.4M 457M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 464M 0 464M 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 40M 214M 16% /boot
tmpfs 93M 0 93M 0% /run/user/1000
/dev/sda1 916G 72M 870G 1% /media/pi/ae99c1bc-5cdd-46a5-beab-284ae0637f9b

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Generic
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x26786c9a

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 1953523711 1953521664 931.5G 83 Linux

Disk /dev/sda1: 931.5 GiB, 1000203091968 bytes, 1953521664 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

isk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Generic
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x26786c9a

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 1953523711 1953521664 931.5G 83 Linux

Disk /dev/sda1: 931.5 GiB, 1000203091968 bytes, 1953521664 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
pi@raspberrypi:~ $ ls -lh /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 15 Aug 24 04:57 3122c401-b3c6-4d27-8e0d-6708a7613aed -> …/…/mmcblk0p2
lrwxrwxrwx 1 root root 15 Aug 24 04:57 3FFE-CDCA -> …/…/mmcblk0p1
lrwxrwxrwx 1 root root 10 Aug 24 04:57 ae99c1bc-5cdd-46a5-beab-284ae0637f9b -> …/…/sda1

Not sure if this is what you want to achieve, but could

sudo mkdir /mnt/LocalFolder1

Now you can use docker volume option -v

docker run -d -v /media/pi/ae99c1bc-5cdd-46a5-beab-284ae0637f9b:/mnt/localFolder1:rw nextcloud

Could not work for you as you copied verbatim UUID of example, you should insert UUID of your drive which we have established as ae99c1bc-5cdd-46a5-beab-284ae0637f9b
Also assume for second part of the -v option : /mnt/LocalFolder1 needs to exist on your system.

I assumed that will install another nextcloudpi with dockers, correct? So I need to stop the other one is already running, correct?

Yes, you have to stop and remove the existing container.
If running ncp image should read this also

Which command did you use to start the currently running container?