External storage on raspberry pi 4

NextCloud Version 20.0.2

SO: Raspbian OS 2020-08-20

Raspberry pi 4, 4gb.

Hello good, I have installed NextCloud on a 4gb raspberry pi 4. The installation I have done through Portainer, the installation fine. The problem comes when I want to install an external drive as storage, for some reason the external drive doesn’t recognize me. In rasbian I have the disk mounted in / disk and it has all the permissions to access it, in nextcloud I have external storage activated.

I do the configuration but the external disk still does not appear

What do you mean it doesn’t recognize you?

What permission specifically?

when i say it doesn’t recognize it from netxcloud, i mean i can’t access that drive. mount the disk in / disk and from raspbian I can access that unit without problem, I leave an image.

817ae1f1-2456-40ad-b2fd-6c7a809d3c89

to give you permission I put the 2 command you use,

sudo www-data chown -R www-data: www-data /disk

sudo www-data chmod -R 0750 /disk

I think this is a misconception regarding how file ownerships in Nextcloud are managed.

I’ll try to briefly explain the concepts:

  • Nextcloud does not directly access a location on the server
  • Instead you define a location where the data goes (‘datadirectory’ in config.php) -> all user files are stored at/on/in this location/drive/patition/directory
  • If a file is shown in Nextcloud and who may access it (sharing) is information that is stored in an SQL database
  • I.e. just putting a file on the drive on the server (without using Nextcloud) will NOT show the file in Nextcloud
  • Instead you would have to manually update the file index (which is possible)
  • adding a file via Nextcloud (e.g. a synced directory or an upload) will also update the database accordingly
  • same problem appears for deleting items

Why is that so? The webserver (apache/ngix) is sandboxed to the locations as defined in the page configs for security reasons, using a database to index file possessions is a matter of speed and better options for managing.

So if I understand you right, there are two options

  1. move your datadirectory to the external drive, including the old data

  2. create a virtual partition consiting of the old datadir and the external drive with help of e.g. mhddfs