10

Pardon my ignorance, I am a new user of this site, Linux, and the Raspberry Pi.

The following is a link to a question, from which I used user goldilocks' well documented answer of using rsync, to create my own rsync command to make a backup to a folder on the HDD of a MacBook Pro on my local network:

Can a Raspberry Pi be used to create a backup of itself?

I was unable to follow up on this question and unable to message the user goldilocks because it seems that there is no such thing on Stack Exchange?

What I came up with is this:

rsync -aHv --rsync-path="sudo rsync" --delete-during --exclude-from=/Users/user/Documents/rsync-exclude.txt --rsh="ssh" user@host:/ /Users/user/Desktop/rpi-backup/

From what I understand the addition of the --rsync-path="sudo rsync" argument allows for not having to use an (insecure) root account over ssh.

All seems to go well but unfortunately I get an error at the end of the transfer which looks like this:

rsync error: some files could not be transferred (code 23) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/main.c(1400) [generator=2.6.9]

Is this something I should be worried about and if so how do I fix it? Or, is this because I used a rsync-exluded.txt file to exclude certain directories from being copied over during the rsync and this error is just confirming this?

Also, it was said by a user who replied to this question that it wouldn't be possible to backup to a Mac? My command seemed to work without problems as there was obviously a backup of the filesystem in the folder which I designated as the destination. The only hitch was the error that I received at the end of the rsync.

chaoticslacker
  • 347
  • 1
  • 2
  • 12

2 Answers2

1

There are several problems with doing what you are trying to do.

  1. As others pointed out, you lose a lot of metadata going from ext[234]fs to hfs+ and back. Also, by default hfs+ is case-preserving but case-insensitive, so if you have, e.g, /bin/foo and /bin/Foo, you'll lose one of them. Better use another linux machine. In the extremely unlikely case that you don't have a spare machine, just bring up a linux VM on your macbook.
  2. the rsync options are not wrong. You need -avSHxAX to correctly transfer all metadata.
  3. You don't really need --rsync-path or --rsh. Just do what you are doing as root, and set up .ssh/authorized_keys on the other machine's root account to allow access. Less confusing.
  4. The right way to take backups is to use dump/restore.
JayEye
  • 1,908
  • 12
  • 19
1

I've been using rpi-clone every day for a few weeks to clone my running RPi3 running Raspian Jessie. It takes about 10 minutes to clone to a second Micro SD card. I then switch off, take out both cards, store the original and boot using the clone. Hence I know that the backup works. I rotate 3 cards in this way, so that I always have a safe card. It works for me ;-)

Geoff
  • 194
  • 6