NextCloudPi - USB Drive automount issue - Error: Your data directory is invalid


I am using the latest NextCloudPi version. I have ONE 60GB USB thumb drive connected to my Pi 3. I used the NCP web Admin panel to format the drive to EXT4 and set up automount. It was working fine yesterday but today when I try to log in to my NextCloudPi site I got the error message:
" [ERROR Your data directory is invalid Ensure there is a file called “.ocdata” in the root of the data directory".

I did some researching on here and figured out that I need to change the path in config.php to my data directory. It was /media/USBdrive/ncdata and this is what it should be but I had to change it to /media/myCloudDrive4/ncdata and after this change it is working again, I can now log in to my NextCloudPi website.

But there’s something not right about the way the USB drive is mounting in /media directory. Since I only have ONE USB drive connected to the Pi shouldn’t there be just one folder in /media called USBdrive?

This is a screen shot showing the Samba share on my Windows 7 and beside it the Putty Window showing SSH connection to the Pi showing the output of >> ls - l /media

Can someone help please?

Thank you,


I don’t know how all those directories got in my /media but I sorted it out by SSH’ing to the Pi and trying

umount /media/[each phantom directory] and then
rmdir /media/[each phantom directory]

In this way I unmounted and removed all directories in /media and then switched off nc-automount in nextcloudpi-config TUI and rebooted the pi then switched nc-automount back on again.

Now I have:
/media/myCloudDrive and

I updated the datadirectory and logfile paths using /media/USBdrive/ncdata in config.php and all is working again anyway.

I wonder why there is myCloudDrive and USBdrive in /media? I think one might be a sim link to the other, not sure.


mmm that’s so weird!! why would udiskie do this?

Please share the output of dmesg if it happens again. Hopefully it will just be a residue from old version of automount.

Cheers Nacho.
There was one evening where I plugged in and out the power cable to the Pi several times when I was trying to get SSH working. Maybe the process that mounts the drive doesn’t first check to see if there are any duplicate mounts and/or residues from previous mounts that were never properly umounted.

My USB thumb drive is attached at SDA.

I don’t think this is very useful now that I have already cleaned up /media but good to know about dmesg for the future.


Nice catch! Those directories are created by udiskie, so upon a sudden power cut they would stay there.

Let’s see if I can code something to fix that situation :wink: