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):

/media/myCloudDrive/ncdatabase
and
/media/myCloudDrive/ncdata

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

But in System info, I always get

/media/USBdrive/ncdata
and
/media/USBdrive/ncdatabase

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…?

Thanks

Matthias

|NextCloudPi version|v1.16.4|

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

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com 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:

example

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

longer
example
here

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:

PASTE HERE

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

PASTE HERE

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

PASTE HERE

Maybe this helps:
https://www.raspberrypi.org/documentation/configuration/external-storage.md

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 https://ownyourbits.com/2018/10/19/nextcloudpi-backup-strategies/ - 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.

2 Likes

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=

1 Like

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.

1 Like

Hello, my first post but I think I am having the exact same issue as the OP so i know this thread has been quiet for a while but rather than starting another one I thought I might give this a bump.

I have Nextcloudpi v1.37 running nexcloud 20.0.11.1 on a Rpi 3B+ with the datadir on an external usb drive. All going Ok apart from when I plug in a second drive to use it for backup and snapshot. So, so far;

I have a working datadir at /media/myCloudDrive which is reported when I log into nextcloud > settings > system. However this is listed as /media/USBdrive/ncdata when i log in to my nexcloudpi system panel.

I unplugged my original drive and used NC-format-USB on the new drive to have it as btrfs and gave it the label mybackup expecting that it would then show up as /media/mybackup and all would be right in the world.

So I unplugged the new ‘mybackup’ drive and plugged the original ‘myclouddrive’ back in and it all worked ok. So i plugged in the new ‘mybackup’ drive as well as the original ‘myclouddrive’ but instead of showing up it threw up a data directory not found error and I couldnt log in to nextcloud. I could log into nextcloudpi dashboard and that would also show a datadir not found error state. It did show two devices under usb devices, so they are both there.

If I unplug the new ‘mybackup’ drive it and restart all is ok again.

So I am thinking that way back when I fist started with nextcloud maybe I didn’t label the original drive? Or I did but config.php is just looking at /media/USBdrive/ncdata rather than /media/myCloudDrive/ncdata?

This sounds like I need to do what @OliverV stated in the last post.

Before I start poking around and doing more harm than good as im not greatly experienced on linux, I wanted to revive this thread to see if the last suggestion resolved it for the OP and if people agree with my train of thought?

Thanks in advance.

2 Likes

Hi @HeavyD
I have faced same issue - did you work it out?

Yes, follow Oliver’s instructions to mount the drive in fstab via label or uuid. That is the solution.

1 Like

Hiya,

No I haven’t tried it yet or had any replies. But I see the comment below that says this is the way to go. So I’m going to manually clone the SD card and backup the data before I fiddle then give it a go.