0

I have been looking at other threads. Some have said the problem is a permission issue, and some have said it hasn't been solved. I am using rsync to backup to a USB drive. When I insert the usb drive, I can find it in /media/pi/USBNAME. Here is the command I'm using.

sudo rsync -avH --delete-during --delete-excluded --exclude-from=/home/pi/Documents/backup/rsync-exclude.txt / /media/pi/*/

It works fine for a while, but then it will randomly stop copying the files to the USB drive. If I re-run the command, it will stop at a different file.

Any help?

Seamus
  • 23,558
  • 5
  • 42
  • 83
Test4444
  • 15
  • 1
  • 3

1 Answers1

0

Who knows what /media/pi/*/ will actually do.

You should NOT use wildcards with rsync and generally you would NOT use a trailing / on the target. (This depends on exactly what you are trying to achieve rsync is rather particular about directory paths.)

See https://raspberrypi.stackexchange.com/a/28087/8697 for a script I use.

NOTE I ALWAYS check that the target drive is mounted in RW mode. Otherwise rsync will still try to copy somewhere, and may copy to your SD Card (until full).

I mount my backup drive with sudo mount /mnt/PiData NOTE /mnt/PiData must already exist

This requires an entry in /etc/fstab such as the following:-

UUID=94dc6686-0eda-41ba-87f7-494d7e37f913       /mnt/PiData     ext4    defaults,noatime,noauto  0     0

You can use the following to find the UUID of your partition:-

sudo blkid /dev/sda

Milliways
  • 62,573
  • 32
  • 113
  • 225