NFS mount vs 'Local' External Storage (app)

I’m curious about performance and stability considerations for mounting external storage. I currently have my root directory mounted as an SMB share through the External Storage app. I have read that NFS has less overhead and potentially higher performance (from NAS on a small secure LAN).

Are there any significant differences between using the ‘Local’ option in the External Storage app, and mounting the share directly to the nextcloud /data folder on a file system level?

Nextcloud version: 12.03
Operating system and version: Ubuntu 16.04
Apache or nginx version: Apache 2.4.25
PHP version: 7.0

NFS offers better performance and if only to be used on Linux would be my preference.

Thanks, I switched to nfs4 mounts and pointed the local external storage app at them. It is noticeably quicker.

I’m curious if there are any benefits to mounting directly to the /data folder, vs using the external storage app. It seems to me that they would be the same, but this post seems to indicate a difference…?

You can also do this easily and with higher performance on a filesystem level. Mount an SMB/NFS share to /data via /etc/fstab and then use this as you data dir. :wink:

Having fun learning Linux!

You can use an NFC share as the data dir mounted prior to installation or moved to it later via:

But it’s better you don’t mount shares within the data dir:

  1. Because www-data would need to own the whole share
  2. Because should you have any issues with it unmounting and remounting you could face corruption
  3. Because the external storage app was made for this reason
  4. Because mounting it as a folder in data will mean you shouldn’t use the share with other clients. Again due to corruption possibilities.
1 Like

Awesome, thanks for the advice! (here and in other threads I’ve been browsing)
The ability to mount ‘local’ external storage as the root directory through the app is great. No messing with the /data folder for me…

1 Like


You might be interested in this article that I wrote about this

What is the recommended way to host the main data on a NAS separate from the web server? I didn’t think the external storage app was made for providing the main data directory?

@nachoparker thanks for the info. It definitely helps clarify some of the options.

@ShaunCurrier The external storage app allows you to name an external storage directory " / " which sets it as your top level folder. There is still some data stored in the nextcloud/data folder relating to users, previews, etc., but your files are at the external storage location.

I used NFS4 to mount a NAS share to /mnt on my nextcloud machine, and used the ‘local’ external storage option to point the top level folder to it. Seems to be working pretty well, but I am definitely not an authority on the proper way to set it up…

1 Like

You’d need to permanently mount the share via fstab and either point data to it during the installation or move the data directory to it after.

1 Like

Isn’t this what you’re recommending against, above? I’ve actually already mounted an NFS share on my proxmox host and mapped it into my Nextcloud LXC container to /var/www/nextcloud/data prior to setup. The web server user owns the whole share. But is this the safest and most reliable way? Or is there something better?

Is the something better what @seamaze mentioned?

…and does this need to be somehow done prior to the first start of Nextcloud?

No no, I said you can mount your main storage externally, but not mount other shares directly in data.

This is fine, you’re using a share dedicated to being the data directory, which is how it should be :+1:

No need to go external storage as you’ve perma-mounted the NFS data directory. I’d ignore external storage now unless you have other shares to add.

1 Like

I am revisiting this question (thus googling what others have done) due to fact that NC talks about upcoming speed improvements in SMB. My experience is with NFS.

I’m curious about performance and stability considerations for mounting external storage.

For about 3 years now (OC 7, if I remember correctly) or so I’ve been using OC (now NC) in a setup where “data” directory is mounted share from another machine within LAN (point to point actually). It is used by 12 people everyday via desktop clients.

Setup is as follows.

NC runs on MachineA - Ubuntu Server (due to fact that all files are elsewhere you can make it really small (<7L case) and snappy for FS/DB access - MiniTX MOBO, i3+ CPU (hardware AES can be found on cheaper too), NVMe and lots of RAM).
Real files are on machineB - NAS server (32TB RAID-Z2, ECC, WD REDs, snapshots, scrubs, offsite backups to even another NAS, all the goodies to keep data as safe as possible :slight_smile: ).

MachineA and Machine B are interconnected both through LAN as well as point to point (if each each machine has 2+ NICs, use them, one for LAN, one for point to point).

For example /home/cloud/cloud-www/www/ is webroot on MachineA for NC installation.
I’m also using mpm_itk_module (yes, mod_php on Apache, I’m open for discussion why would anyone want to run NC on PHP-FPM (Apache/nginx) for sub ~60 users) to run it as cloud:gcloud user:group. This is important for my setup.

On machineB i have a dataset with unix (no ACLs!) permissions.
For example /mnt/vol/cloud/

It contains the magical directory “data”, for example /mnt/vol/cloud/clouddata/data

On both machines user “cloud” as well as group “gcloud” has same ID and GID. It is easy to achieve, just when creating users on both machines manually set them.

I have a symlink in machineA /home/cloud/cloud-nas-link that points to /home/cloud/cloud-nas

/home/cloud/cloud-nas on machineA is actually mounted NFS share from machine B

mounting it (fstab) as
XX.XX.XX.XX:/mnt/vol/cloud/clouddata /home/cloud/cloud-nas <params>

would result in that
/mnt/vol/cloud/clouddata/data from MachineB will be reachable in machineA under /home/cloud/cloud-nas/data

Meaning that config.php will contain
'datadirectory' => '/home/cloud/cloud-nas-link/data',

You might ask why I’m using symlink, not
'datadirectory' => '/home/cloud/cloud-nas/data',
Historically I was moving around the mountpoint on MachineA, so in order for me not to have to change config.php I just used symlink, that I could point to mountpoint. I know i should get rid of it, however more better improvement would be something I have postphoned for (too) long now - upgrade that direct link between machines from 1 to 10GbE.

No issues with performance and stability.
One thing though is that you always have to keep in mind that MachineB has to be running before MachineA boots (for example after UPS initiated reboots or needs-to-reboot system updates), otherwise fstab will not fire and you will have to manually mount NFS on MachineA (but don’t worry if it happens, NC will just throw error that data directory is not found, and wait for it to become available).

I hope this is helpful.

EDIT: And yes - reason for manual mounting data is historical. As i said - 3 years. Back then things were different with what you can do in WEB GUI/APPs. Plus it was (and for me still is) NFSv3. And matching permissions (ID/GID) is not an issue, if you are thinking about this you should be root anyways. :wink: