Nextcloud upload speed differences on an external flash drive

Hello. I have a snap Nextcloud setup, Nextcloud Hub II (23.0.3), Ubuntu 20.04.4.

It’s a simple test-ish local server I’m trying to run “on” my RAID0 out of a few flash drives.

To make it work this way, I created a nextcloud directory on the drive:

sudo mkdir /media/KINGSTON-RAID0/nextcloud

Then copied the data folder to this location:

sudo cp -a /var/snap/nextcloud/common/nextcloud/data/. /media/KINGSTON-RAID0/nextcloud/data

The config file I edited this way:

sudo nano /var/snap/nextcloud/30261/nextcloud/config/config.php

'datadirectory' => '/media/KINGSTON-RAID0/nextcloud/data',

Then I set the permissions and rebooted the system.

It works, but the uploading speed onto the server is too slow, around 2.4 MB/s. It feels like it gets loaded into the system drive first (the system runs on a slow sd card), then gets moved to the actual data location. To my observation, after the uploading is done, for a short period of time (the first 10 seconds or so) I see a .part file in the place where it should be, and only after a period of time it gets changed to the actual .png file.

sudo ls /media/KINGSTON-RAID0/nextcloud/data/xxx/files

After some time:

sudo ls /media/KINGSTON-RAID0/nextcloud/data/xxx/files

When I connect the same place as a local external drive through the Nextcloud plugin:


I get the full speed of around 10MB/s, which is the capabilities of the Ethernet port of my server.

How to make Nextcloud work the way I want it to?

I guess something isn’t right with the permissions? I set the owner of the “file” directory to www-data:

sudo chown www-data:www-data /media/KINGSTON-RAID0/nextcloud/data/xxx/files

And now I see 10 MB/s upload speeds, but at the end of the upload, I get a 403 Forbidden error. Changing the default permissions from 775 to 777 to the “files” directory while keeping the owner to www-data lets me upload the files, but the speeds are back to 2.4 MB/s.

you may set your temp directory outside your slow system disk by setting tempdirectory in your config.php

‘tempdirectory’ => ‘/media/KINGSTON-RAID0/nextcloud/data/tmp’,

check your permissions on files

sudo find /media/KINGSTON-RAID0/nextcloud/ -type f -print0 | sudo xargs -0 chmod 0640

check permissions on directories

sudo find /media/KINGSTON-RAID0/nextcloud/ -type d -print0 | sudo xargs -0 chmod 0750


sudo chown -R www-data:www-data /media/KINGSTON-RAID0/nextcloud

Makes sense. USB flash drives are absolute trash when it comes to speed.

  • Upgrade to a gigabit router.
  • Connect your Nextcloud over gigabit ethernet
  • Buy an SSD connected over usb 3.0 or pci-e or nvme
    • This is the only way you’ll be moving hundreds of megabytes per second.
  • If your device with Nextcloud cannot support at least gigabit ethernet and USB 3.0 or better you’ll need to upgrade.
    • The only way to attain high performance will be with a full x86 tower with at least i5 cpu, 8gb+ of RAM and SSD disks. I’d recommend an i7 with 16gb - 32gb ram so you can run Nextcloud on top of TrueNAS.

Cool experiment. :grin: Practically, it is useless.:desert_island:

What are your server specs?

If you have SATA or mSATA or NVME ports, use them.
If you only have USB 2.0 you are in trouble and will need to buy a better device, because you’ve already discovered the maximum speeds.

As you’ve found, every weak spot will hold Nextcloud back. And, it is a hungry beast, especially once you add more users or the office suite or the HPB for Talk calls or…

Unfortunately, it still uses the internal location of the tmp file. Also, after giving the folder to www-data:www-data the web interface returns an error.

Here’s how the lines look like in my config file:

'datadirectory' => '/media/KINGSTON-RAID0/nextcloud/data',

'tempdirectory' => '/media/KINGSTON-RAID0/nextcloud/data/tmp',

The permissions:

sudo ls -l /media/KINGSTON-RAID0/nextcloud/data
total 12
drwxr-x--- 7 root root 4096 May 10 01:48 appdata_ocw3r4n1loxo
drwxr-x--- 6 root root 4096 May 10 01:48 xxx
-rw-r----- 1 root root    0 May 10 01:36 index.html
drwxr-x--- 2 root root 4096 May 10 02:04 tmp

If I do the last command you suggest:

sudo chown -R www-data:www-data /media/KINGSTON-RAID0/nextcloud

sudo ls -l /media/KINGSTON-RAID0/nextcloud/data
total 12
drwxr-x--- 8 www-data www-data 4096 May 10 02:23 appdata_ocw3r4n1loxo
drwxr-x--- 6 www-data www-data 4096 May 10 01:48 xxx
-rw-r----- 1 www-data www-data    0 May 10 01:36 index.html
drwxr-x--- 2 www-data www-data 4096 May 10 02:04 tmp

I get this error trying to access Nextcloud:


  • Your data directory is invalidEnsure there is a file called “.ocdata” in the root of the data directory.

Recursively giving it back to root:root lets me access Nextcloud and upload the files, but the tmp directory isn’t in use.

While I upload a file:

sudo ls -l /var/snap/nextcloud/common/nextcloud/tmp
total 7296
-rw------- 1 root root 7471104 May 10 02:29 phpXEIGMo
sudo ls -l /media/KINGSTON-RAID0/nextcloud/data/tmp
total 0

To test the speeds I tried making a simple rclone-powered WebDAV server and I can see stable 11,4 MB/s while uploading the files onto the RAID, which is enough for my use case. Nextcloud on the other hand shows the speeds simiar to the speeds of the SD card the system runs on, even when the data is set to an external location. @Vincent_Stans suggestion of moving the tmp directory to another place sounds ideal, but as of now, it didn’t work.

Sadly I can’t perform any upgrades, my device is more than limited in these terms. It’s “Orange Pi PC”, it can only boot from an SD card and the one I have is way slower than my RAID. It’s funny how it has everything to not run Nextcloud on: USB 2.0, 100M Ethernet, catastrophic Cortex-A7 Allwinner H3 CPU, 1GB of RAM. The best thing I can do is to make this software RAID array, I think even SSD would’ve been too excessive with USB 2.0. However, for my use case with lots of plugins turned off, it performs fine, other than this problem of separating it from the SD card.

For the context, the use case here is a local hub/layer for cloud storages to access from my local network and have a unified interface on any device, where the RAID acts as a cache. It’s not even for the cloud plugins, it’s for rclone mount (the uploading tests into Nextcloud are done locally excluding rclone for the purity). My ISP provides me with a 100Mbps channel, this is why I say that 10 MB/s is enough for me.

But I’ll definitely remember the suggestions in case if I would want to make an actual setup, thanks for the input!

1 Like

Ended up switching from snap to docker. NextCloudPi in my case, but a normal Nextcloud for Docker should do the trick as well. Changed the root directory of Docker to my external location, set things up, happy with the speeds now!