Nextcloud Pi, wanting to add second HDD for backup

Hi Just,

Sorry for the long delay, work and family commitments leave little time for tinkering.

I have just had a go after watching / reading about the fstab file.

I fired up another pi and plugged in the USB HDD that I formatted with my nextcloudpi.

I used the df-Th command to list drives and formats and found it as sda1 in btrfs format.

I used ls -lh /dev/disk/by-uuid/ to find the UUID for the disk. Got that and then.

I used Sudo nano /etc/fstab to edit the mount point.

I put in UUID=myuuidlongcode /media/mybackup btrfs rw,users, 0 0

Saved the fstab file and ran df -Th again and could see the sda1 disc was mounted where I wanted it.

I had a permission error when I tried to write to it but that’s as expected and I didn’t want to change the permissions on it as this was just a test.

Hopefully that is the theory part done and I would be able to repeat it on my nextcloudpi install.

Previously I want getting the mount point thing (coming from windows) I had my disk partitioned and formatted with the name I wanted why isn’t it working? But I hadn’t grasped that unless I then tell the raspberry pi “hey this disk, please always mount it in this place” it wouldn’t. So when I insert a new USB HDD with automount on then the nextcloudpi just sees two USB HDD’s and doesn’t know where anything is.

So onto the real deal. I assume I should edit the fstab for both USB HDD’s, the existing one with the datadir etc on it and the new one I want to use as a backup. I will do the existing one before plugging the backup in.

Looking at my settings:
NCP System info lists my datadir as /media/USBdrive/ncdata - this is the place it is automatically put.
NC settings page shows it as /media/myCloudDrive - this is the place I want to set the mount point in fstab so that it carries on business as usual.

So assuming I have my head (somewhat) around this now. Once I have done the fstab magic on the original USB HDD with the datadir etc on it I follow Olivers guidance in post Change path of datadir + dbdir from "USBdrive" to drive label - #2 by eehmke and edit the config file so that anything pointing at the old automount location /media/USBdrive/ncdata etc looks at the new set mount point of /media/myCloudDrive/ncdata etc.

Then I can plug in the new external USB HDD that I’m using as a backupdrive and edit fstab to mount it at /media/mybackup.

I will need to give user permissions for nextcloud sudo chown www-data:www-data /media/mybackup.

I can then use the nextcloudpi webUI or the commandline UI to set the backup tasks to look at the /media/mybackup folder.

I hope this is somewhat correct…