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?

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

  • Would you mind helping me configure this script to mine settings. Not very familiar with bash. So when I plug in the USB (it's called Test) it is located in /media/pi/Test/. How can check if this is RW along as check that this path is there. – Test4444 Dec 17 '18 at 2:45
  • @Test4444 if you post a script you will get help - you need to add more information. The first thing I would do is NOT use /media and automatic mounting. Start by adapting my script. Preferably exit the GUI and run on command line. – Milliways Dec 17 '18 at 3:28
  • @Test4444 I am not at a computer - how is disk formatted? – Milliways Dec 17 '18 at 3:35
  • I formated with sudo mkfs.vfat /dev/sda. How do I not use /media for automatic mounting. I am not using any GUI, I can only connect to the pi through ssh. – Test4444 Dec 17 '18 at 4:19
  • @Test4444 As per my linked Answer "I backup to an ext4 partition on a HDD mounted on the Pi" You cannot backup to a FAT partition. DO NOT post detail into comments - EDIT your question. If you are not using GUI (which automounts removable media) - how do you mount? – Milliways Dec 17 '18 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.