NextcloudPi unresponsive

My Nextcloud server becomes unresponsive

Raspberry Pi 4 4GB
NextcloudPi installed in regular Raspberry OS. up to date, both OS and in ncp-config

Data is stored on an external harddrive, usb2, mounted in fstab
I have activated encryption for the data.

UUID=372b82ae-e7de-4fec-b100-ec73d1ad12d5   /mnt/hallonpajsafiren   ext4   defaults,auto,users,rw,nofail   0 0
#UUID=372b82ae-e7de-4fec-b100-ec73d1ad12d5   /mnt/hallonpajsafiren   ext4   rw,users  0 0
#
/mnt/hallonpajsafiren/sftp              /home/sftp/Safiren              none    defaults,bind   0       0
/mnt/hallonpajsafiren/sftp/Fotoram      /home/fotoram/Safiren/Fotoram           none    defaults,bind   0       0

As you can see I have tried other mounting options, but that made no difference. I have also mounted a couple of folders with bind.

Additionally run an sftp on the Pi

It works fine for a couple of days to a couple of weeks, then the nextcloud server becomes unresponsive. I can still log in via vnc and I can play around, but cpu usage is shown as 100% in the applet. I’m thinking there is some sort of fileoperation that has hanged, but I don’t know and don’t know how to chek either, iotop doesn’t show anything unnormal.

Also ncp-config web interface is unaccessible. Not that important as it works in terminal but I mention it if maybe it is related.

100% usage bottleneck is totally possible.

My guess would be that the usb2 enclosure is a bottleneck along with running the ftp service simultaneous to Nextcloud. Booting off of MicroSD is a similar bottleneck. These can only transfer so many mb/s.

Personally, I recommend moving to USB 3.0 enclosure with SSD drive.
Move your system to boot off of the SSD.
Took me from 10mb/s transfer bottleneck → 300mb/s transfers.

usb2 is still faster than the 100Mbit internetconnection which all transfers are done over, so the usb interface shouldn’t max out, or? And the unresponsiveness do not coincide with any file transfers.

And the 100% cpu usage is stuck, more like a loop bug or read/write error keeps waiting.

SMART shows the drive as ok. I have tried to format the drive.
I have tried another brand new memory card as well. (the first was brand new as well) and the Pi diagnostic tool approved the memory card (first thing I did after installing the OS on the second new card).

Neither the Nextcloudinstance nor the sftp is under any heavy load, it is mostly automated family backup with little new data each day.

Nah, usb2 is limited. What is the typical USB 2.0 external hard drive speed ? :: SG FAQ

I’ve never attained the maximum speed of around 50mb/s when storing the data directory on a usb2 disk. MicroSD cards are even slower. Hope this helps.

Is there anyway to confirm this? Something other than iotop to see what application is doing what io is happenig? Some Nextcloud log to see what is happening? I too have experience from slow usb2 transfers, but there is a difference between slow and stuck for hours or days.

Mind you, 100Mbit is only 12Mega Bytes

A new external drive is rather expensive so I would appreciate if there where some way to identify the problem.

I did a 20GB transfer to the sftp on the Pi to test it out. The first 30 minutes I monitored and this is what I found. The next day the transfer, which was estimated to take about 2 hours, in finished and everything is working as normal.

iotop showed disk write at about 4-5M/s and it took about 2 hours. CPU usage showed at 15-20% while iotop was running in terminal, and 5-15% without iotop.

In the same time I looked at videoclips in my Nextcloud, in my phone. Then iotop showed disk read at about 10M/s. It worked very well on my phone.

And also in the same time I clicked around in Pi OS through VNC and it was as usual.

Maybe the sdcard is a bottleneck, or the usb2 disk, but only in some special circumstance. What log can show me this?