Seperate software and storage for Pi3 Snap


I have recently managed to get my Pi3 setup with Nextcloud 11. The system is running Ubuntu Core, and I have installed the Nextcloud Snap version. My plan is to use this together with a WD 1TB Red 2.5" HDD, but during this initial testing phase I am just using a USB memory stick. At this moment the USB stick is setup through the “external storage” app, but in this way the USB storage has come in addition to the 8GB SD card. I want the USB stick to be the only storage available so that the SD card is not a part of the cloud.

How can I separate the systems so that the SD card is just for running the software, while the USB stick is storage?

HI @RBorlet, does your box detects the USB? If it doesn’t try formatting it in Fat32 and check again. Once your box detects the storage you can easily point your config file to your new data storage or partition.

Thanks @SPeedY. The USB drive is functioning and is formatted to ext4. I found the config.php file, and changed the data path to my mount point which is “/media/storage”, I have also used the “lsblk” to check that sda1 has this mountpoint.

When I go to the Nextclouds IP address, it now says “Data folder (/media/storage) is invalid, verify that this folder contains a .ocdata file” (roughly translated to English).

Should I copy something over from the previous data-folder? In that case what, and where was it (stupid me didn’t write it down)?.

Yes, you should copy all from your current/old data directory and adjust permission to the drive. ex. chown www-data:www-data /media/storage

I got it to work, but I ran into something strange. I am a linux beginner, so I am no good at using the terminal to manipulate the system, so for every single thing I do I have to google (move file, see folder content, etc).

I started with
sudo su
and followed with
mv /var/snap/nextcloud/common/nextcloud/data/* /media/storage
which to my understanding moved all the contents of the first directory to the second.
I then used
chown www-data:www-data /media/storage as you recommended, but I am not sure how this command works.

I though that was it, but when I went to my nextclouds IP address, it still indicated the lack of a .ocdata file, and it said that it didn’t have writing permission to /media/storage.

With the terminal I navigated to the /var/snap/nextcloud/common/nextcloud/data folder and checked it’s content with
I could see that there was two files left that had not been moved “.htacces” and “.ocdata”. I checked the /media/storage folder and verified that these two files were in fact missing.

I ran
cp -a /var/snap/nextcloud/common/nextcloud/data/. /media/storage
to copy the two missing files, and tried to access the nextcloud again.
This time with success :slight_smile:

Even though the cloud is now working with the USB as it’s single storage location, I have no idea if there maybe is something that should be fixed. The old data folder still has two files “.htaccess” and “.ocdata”, and I am not sure if the permissions were given correctly. I have found that for every time I run the chown permission-giving command, I have to copy the .htaccess and .ocdata files afterwards to get the cloud to work.

when you use the “chown” you are assigning your webserver user access to your new data directory. You no longer need the old directory unless you want to keep it for backup purpose.
If your cloud is working fine and you have no other warning in your logs then there is nothing else you should do, but enjoy it.

From what I can see it is functioning as it should. I have tried the iOS app and checked that photos upload correctly, and that I can manipulate the files and folder and everything is syncing correctly.

There are however a reoccurring error in the log every 10-15min, see below:

Don’t know if this is related or if I should post it somewhere else.

From the tutorial i followed when first setting up the snap version:

Install Nextcloud
The Nextcloud snap uses the removable-media interface, which grants access to /media/*, and requires manual connection:

sudo snap install nextcloud
sudo snap connect nextcloud:removable-media core:removable-media 

Does this second line of code do the same as the “chown” command?

Due to a non-related problem I had to install format the drive and install Ubuntu Core and Nextloud again, and it seems to be working without the “chown” command.

Also: No errors in the log after reinstalling Core and Nextcloud.

Thanks for reporting your new findings. Am glad is all working now