Problem with second usb device for the backup

I have nextcloud running on a raspberry pi on a flash drive.

If I want to use a second flash drive for the backup, I should remove the first one to prepare the second stick for it, but this is not possible.

is there a solution for this?

I am looking for instructions on how to prepare the second flash drive manually via the terminal without the nextcloud tools.

Sorry i do not use a Pi for Nextcloud and i do not know the backup function from ??? NextcloudPi ???

But you can shutdown your Nextcloud and make an image copy of your stick. Do you use Linux on a client? Then you can use e.g. the command dd.
On Windows i think you must use an external program. Read e.g. this. Not tested.

be careful not to accidentally delete the first stick.

Now I was able to help myself.
I solved the problem by simply mounting the second flash drive as a drive permanently.

This is how I did it:

first i logged in as user pi via ssh in a terminal:

After that I become root as follows:
sudo -i

now determine the connected drives:
ls -l /dev/sd*

In my case the flash drive with the system on it has 2 partitions (boot & root).
The other one has one partition (which still has the windows format).
root@nextcloudpi:~# ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 M�r 17 12:28 /dev/sda
brw-rw---- 1 root disk 8, 1 17. M�r 12:28 /dev/sda1
brw-rw---- 1 root disk 8, 16 17. M�r 12:28 /dev/sdb
brw-rw---- 1 root disk 8, 17 17. M�r 12:28 /dev/sdb1
brw-rw---- 1 root disk 8, 18 17. M�r 12:28 /dev/sdb2

Now you have to repartition the second flash drive. In my case the sda.
Please have a look before (best at what to do why and how!).
For start point/end point or size I simply quit with enter:

fdisk /dev/sda


Now the flash drive will be partitioned
mkfs.ext4 /dev/sda1

We now change to the media directory:
cd /media

Now create a directory for the mount, e.g. ncbusb:
mkdir ncbusb

Now we mount the new flash drive with the following command:
sudo mount /dev/sda1 /media/ncbusb

Now we get the UUID of the new drive with blkid:

In my case, the output looked like this:
root@nextcloudpi:~# blkid
/dev/sda1: UUID=“8b800054-c154-4666-bd47-1fa308672ee7” BLOCK_SIZE=“4096” TYPE=“ext4”
/dev/sdb1: LABEL_FATBOOT=“boot” LABEL=“boot” UUID=“F914-FF4D” BLOCK_SIZE=“512” TYPE=“vfat” PARTUUID=“93b980bb-01”
/dev/sdb2: LABEL=“rootfs” UUID=“1943b829-a99b-45b8-9fe5-7136dbea4c4a” BLOCK_SIZE=“4096” TYPE=“ext4” PARTUUID=“93b980bb-02”

We need here the UUID of the sda1 so the 8b800054-c154-4666-bd47-1fa308672ee7

Now we edit the fstab. This will be processed at boot time. So we mount the backup flash drive at boot time:
nano /etc/fstab

At the end of the fstab we make a new line, which should look like this (of course with your own UUID!!):
UUID=8b800054-c154-4666-bd47-1fa308672ee7 /media/ncbusb ext4 defaults 0 0

Now you have successfully mounted the new flash drive into the system.

At nextcloudpi in the administration you can now set up an automatic backup under BACKUPS
to set up an automatic backup.

Now enter the following as destination directory:

I tested my system with a manual backup and rebooted.
Everything works as desired!

Translated with DeepL Translate: The world's most accurate translator (free version)

1 Like