External Hard Drive not working - fresh Ubuntu on Rasp Pi

I cannot for the life of me figure out how to get my external hard drives recognized. If this feature worked correctly nextcloud would be perfect.

Starting off with a brand new raspberry pi 4 + fresh Ubuntu 22.04(the version built into the raspberry pi disk imager tool).

Plugged in external hard drive. (1TB Seagate). Used the GUI disk utility that comes with Ubuntu to format the drive fresh as ext4. Ubuntu has mounted it at “/media/owner/sea”. In the nautilus file manager I can create folders normally. The drive works.

Installed nextcloud via ‘sudo snap install nextcloud’ - it doesn’t give me any option to choose the path for the data folder and goes ahead and installs it anyway. I then setup Nextcloud normally in the web browser.

Went to Apps → Disabled Apps → and enabled “External Storage”.
Went to Settings → Administration → External storage.
Ticked “Allow users to mount external storage”.
Added new storage device called “disk2” with type “Local” and path “/media/owner/sea”.

It simply does not work. Under Settings → Administration → Disk it does not recognize the existence of the external hard drive at all.

Tried mounting the drive to a different path with:

sudo mkdir /mnt/disk2
sudo mount /dev/sda1 /mnt/disk2

And adding mnt/disk2’ in Settings → Administration → External storage.
Doesn’t work.

Tried giving it the most maximal permissions:

sudo chmod -R 0770 /mnt/disk2
 sudo chown -R www-data:www-data /mnt/disk2

Still doesnt work!!

When I go to Logging I can see this error:

Error: opendir(/mnt/disk2/): Failed to open directory: Permission denied at

Got it working. Wow, snap sucks and I have no idea how anybody was supposed to figure this out.

  1. Enable external storage for snap: sudo snap connect nextcloud:removable-media
  2. Stop nexcloud snap: sudo snap stop nextcloud
  3. Update storage location: sudo vim /var/snap/nextcloud/current/nextcloud/config/config.php

change data location:

‘datadirectory’ => ‘/media/storage/data’,

  1. Move the data directory to the storage device: sudo mv /var/snap/nextcloud/common/nextcloud/data /media/storage/
  2. Start nextcloud snap: sudo snap start nextcloud
1 Like

I guess you figured this out, but the External Storage feature is for mounting an extra folder that isn’t in your data folder. It isn’t for moving the data folder itself, nor does it specifically have anything to do with external hard drives.

Right I think its only necessary to run the command ‘snap: sudo snap connect nextcloud:removable-media’ to fix the permission issue caused by snap. still, figuring this out was a real pain in the butt and I dont see how a less tech savvy person would’ve been able to.

It would probably have been less of an issue if it wasn’t the snap version. It it has some limitations and tends to add its own layer of interesting to these issues.

2 Likes

Thing is installing it with snap is just 10x easier. running 1 tiny little command vs a complex multi step tutorial. Lots of people would rather do it the easy way. The developers should add a message box on the External Storage page when it has been installed by snap, which says something along the lines of “External drives support not enabled on system, please run the following command to enable: sudo snap connect nextcloud:removable-media” otherwise hundreds of people are going to get stuck on this step. Just google for Nextcloud+External Drives+Permission problem and theres a lot already. on Youtube comments too people have this problem. Would take like 10 minutes of the developers time to add the message like I said and would save hundreds or thousands of people from getting stuck here and spending hours on digging up a solution.

My guy.

You can’t even know how much you helped me and how much I was going mad, and I’m fairly technical too.Actually I just created this account to thank you, and then after this reply I’m going back to the depth of the internet.

For the people trying to do this, and installing the first time after running:

sudo snap install nextcloud

then go with

sudo snap connect nextcloud:removable-media

follow the guide at:

And then you will be able to finally setup correctly.
Be careful about the directories, as stated in the article the partition you want to use must be mounted somewhere in /media/ or /mnt/.

Thanks again OP, I love you.

1 Like