Expanding self-hosted storage

An absolute beginner in all this, I’ve successfully managed to figure my way through various hurdles and got /e/ installed on my OnePlus 7, set up my own self-hosted instance of eCloud on Hetzner and finally got things working. Files, calendars and contacts seem to be syncing, so I think I’m mostly there (I’ll worry about email later).

But now I realise I need more storage, so I added a 100GB volume to Hetzner server and am trying to get it added as an external storage source via the NextCloud UI.

  • I’ve configured the volume as recommended by Hetzner, let’s call it /mnt/folder
  • I’ve installed the external storage app in NextCloud and added /mnt/folder as a local source. Instead of the expected green check, it’s showing a red error symbol, so I checked NextCloud docs, which suggest running the following:
sudo chown -R www-data:www-data /path/to/localdir
sudo chmod -R 0750 /path/to/localdir


sudo -u www-data bash
cd /path/to/localdir
mkdir data

Following all this and power-cycling my server and I still get the error, so something’s not right. I don’t really understand this www-data user - I guess it’s built-in to NextCloud? Is the config different for eCloud?

My Linux knowledge is very basic and I’m pretty new to all this, so I’m treading new ground here. If anyone has any insight into what might be wrong or something obvious I’m missing, please help.


I think it would be easier to move your NextCloud Docker container storage to the new volume, rather than using NextCloud external storage.
And it will be simpler to maintain and use :wink:

I can help with that, all that we will need is your Nextcloud data volume mapping :

  • open /mnt/repo-base/docker-compose.yml with your favorite reader/editor
  • locate the “nextcloud” service
  • copy the /var/www/data volume mapping and post it back here

Example :

    image: registry.gitlab.e.foundation/e/infra/ecloud/nextcloud:316db4e0
    container_name: nextcloud
      - /mnt/repo-base/volumes/nextcloud/html:/var/www/html/
==>>      - /mnt/repo-base/volumes/nextcloud/data:/var/www/data/ <<== THIS ONE

If you still want to use Nextcloud external storage, please be aware that it is running in a Docker container : your new storage has to be added to Docker volumes list (see /mnt/repo-base/docker-compose.yml), and the commands are better run from inside the container (cd /mnt/repo-base then docker-compose exec nextcloud bash).

Thanks smu44. My volume mapping is exactly as your example. Should I simply edit

- /mnt/repo-base/volumes/nextcloud/data:/var/www/data/


- /mnt/repo-base/volumes/nextcloud/data:/mnt/folder/

or do I need to run additional commands?

A little more :wink:

First, I won’t recommend changing the path in docker-compose file, you may break future updates.

At first, remove any definition of external volume in your Nextcloud.

Then, shutdown your Nextcloud and move your data (assuming you using root user and that your volume is at /mnt/HC_Volume_12345678, replace serial accordingly) :

  • cd /mnt/repo-base
  • docker-compose stop nextcloud
  • rm -rf /mnt/HC_Volume_12345678/* <<== this will remove all content in your volume !
  • mv /mnt/repo-base/volumes/nextcloud/data/* /mnt/HC_Volume_12345678/ <<= can take some time

Then we have to mount the volume at the right place :

  • umount -f /mnt/HC_Volume_12345678
  • (launch your favorite editor) edit /etc/fstab
  • copy+comment the line for /mnt/HC_Volume_12345678/
  • in the copy, change /mnt/HC_Volume_12345678/ to /mnt/repo-base/volumes/nextcloud/data/
  • save+close /etc/fstab
  • mount -a then ll /mnt/repo-base/volumes/nextcloud/data/ => you should see your files
  • docker-compose start nextcloud

NB : sorry no time to try it myself, if any error or suspicious message please stop and report

Also, the local path is at first, the second part after the “:” is the mapped path in container.

So, if you want to go with that, it should be :

- /mnt/folder:/var/www/data/


I think I got a bit confused around editing the fstab file. My original entry was:

/dev/disk/by-id/scsi-0HC_Volume_12345 /mnt/folder ext4 discard,nofail,defaults 0 0

which I changed to

/dev/disk/by-id/scsi-0HC_Volume_12345 /mnt/repo-base/volumes/nextcloud/data ext4 discard,nofail,defaults 0 0

Is this correct? I don’t really understand what’s going on, but it looks like I’m mounting the old volume, not my new one?

When I look through /mnt/repo-base/volumes/nextcloud/data/ my files were there, but within the subfolder [username]/files, so if there needs to be a .ocdata file somewhere, I’m not sure where it needs to be exactly.

When I look in my /mnt/folder/ volume, it appears to be empty?

Ok, my bad :frowning:

The mv command did not move hidden files (starting with a .).
I’ve should have included a check :frowning:
Don’t panic, these files are still there ! You simply don’t see them, as we mounted the volume over the data directory. If we need them we could get them back.

You can simply try to create the missing file, on every NC instance I have it’s empty so it’s easy :

  • touch /mnt/repo-base/volumes/nextcloud/data/.ocdata
  • chown www-data:www-data /mnt/repo-base/volumes/nextcloud/data/.ocdata
  • chmod 644 /mnt/repo-base/volumes/nextcloud/data/.ocdata

And then, from /mnt/repo-base, docker-compose restart nextcloud

There is another “hidden” file, .htaccess, but as I can see it’s recreated at each NC startup.

You fstab looks perfect to me :slight_smile:
It just says : "OK, before we mounted the volume at /mnt/folder, now we want to mount the same volume at another place, /mnt/repo-base/volumes/nextcloud/data.

In the …/data/ folder, you should see one sub-folder for every user including ncadmin, a appdata_something, a rainloop-storage, etc.

It’s OK that the /mnt/folder directory is empty : it was the previous mount point for your volume.
As we now mount the volume elsewhere it is normal.
You can remove it (rmdir /mnt/folder).

Very sorry for the unnecessary stress :crying_cat_face:

1 Like

About mounts in Unixes.

Unlike some other OSes, Unixes offer a single, hierarchical view of the storage.
For example, it’s not the same as Windows outline (C:, D:, …).
Unixes gather ALL the storage under a root, named “/”, including supplemental.

“/” is the main storage (let’s say, like C: for Windows), with it’s own directories tree.
If you add a storage, it won’t be available outside of /, you must find a place in the tree to “attach” it. That’s we call “mount point”.

Once mounted, this new storage behaves as it is a part of the initial “/” root of the tree, so it’s easier to use.

If you know Windows, it is like a “subst” for, let’s say, C:\something\ to D:\ (or a hard link, if it is relevant to you). Then you could ignore D: and just use C:\something to access your new storage.

The only issue is that the initial files of “/” under the mount point are no longer available : you told the system that now there is something on top of it, and that’s what you asked to use.
BUT these files are still on the “/” disk ! You can simply unmount your additional storage, and access them again.
That’s why a good practice is to create an empty directory as mount point, so no existing files will me missed :wink:
And this directory is to be deleted if the additional storage mount is no longer needed, it is then useless.

NB : “storage” can be anything : local disk, DVD, network/SAN storage, …

Related to Windows again, what we done is like “OK, my new storage works well with D: drive, but now I want it as E: drive” (assuming you have a software trying to get file on E:, and you can’t change that).

1 Like

If the /mnt/repo-base/volumes/nextcloud/data/.htaccess file won’t get re-created please tell me.

This is so helpful, thank you! Everything (except email, but I’ll worry about that later) seems to be working perfectly.

:warning: Important warning :warning:
If you use Hetzner backups, please be aware that volumes are not included !

If you need help with this, please let me know (open a separate thread, please).