External USB HDD with Btrfs disappears from NCP

Hi all,

I’m using NCP on a RasPi 3 and I set it up with the data dir (and I believe the database too) on an external USB HDD which uses Btrfs as a filesystem. It’s connected to the RasPi via a powered USB hub (but this setup behaves funny when restarting I’ve noticed a few times, not sure how to improve it though).
A few days ago I tried to access the web UI and it only returned a blank page. Via SSH and the mount and fdisk -l commands I saw no sign of my external USB HDD. Somehow it got unmounted (and since I’m very much not an expert with Linux I’m not sure if this could be a problem on a lower level than NC).
The HDD is spinning and the LEDs are lit.

I have the ncp-automount option turned on, so I rebootet my RasPi and expected the drive to be mounted again, but nothing changed (web UI down, HDD not shown with the commands).

Where should I look for errors?

There is status info in ncp-web, or you can get more info with sudo ncp-report

ncp-report fails, outputting only a bit of XML.

ncp-diag results in this:
NextCloudPi version|v0.53.28
NextCloudPi image|NextCloudPi_03-18-18
distribution|Raspbian GNU/Linux 9 \n \l
automount|yes
USB devices|none
datadir|/media/USBdrive/ncdata (doesn’t exist)
rootfs usage|1.8G/30G
swapfile|/var/swap
Nextcloud check|error
HTTPD service|up
PHP service|up
MariaDB service|down
Redis service|up
Postfix service|up
internet check|no }
…and then also fails (screen fills up with lines of single “y”).

My guess is that this all happens due to the not available DB (which is on the external drive).
But how to ensure that the HDD is actually auto-mounted? Rebooting doesn’t change the situation. Could still be the power supply, but I have an external USB hub (which seems to also power the RasPi itself through the large USB connector, which I find very weird).

That sounds correct.

Yes, the raspberry pi power system is… pretty bad. It sounds like your drive goes away by itself.

You can try to see if there’s anything at

systemctl status nc-automount

or

systemctl status nc-automount-links

Thanks for the hint and assessment.

The output looks like there is no HDD, right?

systemctl status nc-automount-links
● nc-automount-links.service - Monitor /media for mountpoints and create USBdrive* symlinks
   Loaded: loaded (/usr/lib/systemd/system/nc-automount-links.service; enabled; vendor preset: enable
   Active: active (running) since Tue 2018-06-26 08:26:24 CEST; 1 day 12h ago
 Main PID: 379 (nc-automount-li)
   CGroup: /system.slice/nc-automount-links.service
           ├─379 /bin/bash /usr/local/etc/nc-automount-links-mon
           ├─404 inotifywait --monitor --event create --event delete --format %f %e /media/
           ├─405 grep --line-buffered ISDIR
           └─406 /bin/bash /usr/local/etc/nc-automount-links-mon

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

Unplugging the HDD, replugging it and then rebooting the RasPi (with sudo reboot -h) did the trick. The external USB HDD was recognized again and Nextcloud started just fine.

I’m having the same problem, using a rpi 4 with official power supply and an external 240 GB SSD, and a clean install of Nextcloudpi.
Now when I try to reach my server it says “Your data directory is invalid Ensure there is a file called “.ocdata” in the root of the data directory.”
At work so can’t use ncp-web right now, but yesterday I could also solve it by rebooting/unplugging and replugging the SSD.

This never used to happen with the Pi 3b that I was using previously?