Change path of datadir + dbdir from "USBdrive" to drive label

How can I change the path of datadir and dbdir (external drive) to use the USB Disc Label and not USB Drive Number?

I was moving datadir and dbdir to an external drive (formatted a.s.o. from NextCloudPi as described):


These paths are valid (also shown as valid in NextCloudPi)

But in System info, I always get


After as soon as I plug in a second drive USBdrive changes to USBdrive1 plugging in a second drive breaks NextCloud.

If I try to set the path to “/media/myCloudDrive/…” using the move database/datadir tools I get an error this folders are not empty - well, yes, they host the current datadir/database , just under the “label” path and not usb drive path.

So - how do I change this? How can I tell Nextcloud to plleeeeeaasssseeeee use the label and not the hard coded drive path…? So not MOVING the directory, just use the label name…?



|NextCloudPi version|v1.16.4|

|distribution|Raspbian GNU/Linux 10 \n \l|

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 1.16.04):
Operating system and version (eg, Ubuntu 17.04):
Apache or nginx version (eg, Apache 2.4.25):
PHP version (eg, 7.1):

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N):

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:


The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):


The output of your Apache/nginx/system log in /var/log/____:


Maybe this helps:

I tried with this, but as I understand it its more telling the OS to mount at a desired location. The drive already mounts with the label I want, but depending on mounting order the hard coded path seems to be USB or USB1 - but the label always stays the same so if NextCloud would use the label this shouldn’t matter.

But in the System info, the path is listed as /media/USBdrive/ncdata instead of /media/myCloudDrive/ncdata so this fails if USBdrive changes to USBdrive 1.

There is a tool to MOVE the directories, but I don’t find any place to simply EDIT the location. So this is what I am missing, simply beeing able to tell Nextcloud (not the OS) where the directory is, without moving it.

What I want to achieve is like also suggested here - having two drives mounted, one drive with the the data and database, and a second with the backup and synced snapshots of the data. So if the datadrive fails I can plug in a new one and read the backup and snapshots back from the secondary drive.

Unfortunately the link how to mount a second harddrive on this article leads to a moved to nowhere page, so im struck how to get two drives running in a robust way - preferred using the drive labels and not some mounting points which might change depending the order the OS has mounted the drives.

1 Like

having the exact same issue, how can you edit the location of Mariadb?

@MatHeb and @Mack_Baise
Check How to mount an external drive using UUID and fstab
Although this method should work using both LABEL= or UUID=

nc-automount creates a symbolic link /media/USBdrive to the actual mountpoint and uses the label name for the the mointpoint /media/myCloudDrive
Check with

ls -lh /media/

Before adding a second drive, it is best to manually edit the path in NC’s config.php in a terminal, to adjust the values of ‘datadirectory’ and 'tempdirectory ’ to the /media/myCloudDrive/ncdata.