-1

I am trying to backup raspbian onto itself following this stackexchange post but it seems the exclude from flag doesnt work,

This is the command I am using

sudo  rsync -avH --delete-during --delete-excluded --exclude-from=/home/pi/Desktop/rsync-exclude.txt /  /media/usb0/pi_backup/

and this is my rsync-exclude.txt file.

/proc/*
/sys/*
/dev/*
/boot/*
/tmp/*
/run/*
/mnt/*
/data/*
/media/*

.Trashes
._.Trashes
.fseventsd
.Spotlight-V100
.DS_Store
.cache
.AppleDesktop
.AppleDB
Network Trash Folder
Temporary Items
lost+found

.bash_history
/etc/fake-hwclock.data
/home/pi/pydio-core-6.2.2.tar.gz
/var/lib/rpimonitor/stat/
/home/pi/.cache/
/media/usb0/
/home/pi/.kodi/addons/
/home/pi/Library/Application Support/Plex Media Server/

enter image description here

and this is the command I am using now that is resulting what above you can see

shopt -s dotglob; sudo  rsync -auvoltH --devices --delete-during -E --stats --progress --exclude "/home/pi/pi_backup2/home/kodi/.kodi/userdata/Thumbnails/" --exclude "/media/" --exclude "/home/pi/.cache/" --exclude "/home/pi/Library/Application Support/Plex Media Server/" --exclude "/home/kodi/.kodi/addons/" --log-file=/home/pi/Desktop/backup.log --delete-excluded --exclude-from "/home/pi/Desktop/rsync-exclude.txt" /  /media/usb0/pi_backup/
  • In what sense doesn't it work? As in, at all? All that stuff just gets copied? – goldilocks Aug 29 '16 at 13:51
  • Yes , it gets copied however I passed individual path to --exclude flag while passing command and that works but not the paths from file – Ciasto piekarz Aug 29 '16 at 14:14
  • Dunno what to say. I just tried replicating this -- normally I don't have blank lines or paths with spaces, but all that didn't make any difference. It worked as expected. – goldilocks Aug 29 '16 at 14:41
0

Try the command below.

sudo  rsync -avH --delete-during --delete-excluded --exclude-from '/home/pi/Desktop/rsync-exclude.txt' / /media/usb0/pi_backup/

The exclude from should be used as --exclude-from '/home/backup/exclude.txt' instead of --exclude-from-/home/backup/exclude.txt

Change your path to relative paths. I think that's where the problem is.

The tricky thing with rsync is that you need to use a relative path when you are trying to exclude things, because when it tries to match the exclusions it won’t use the first part of the path for the match…

proc/*
sys/*
dev/*
boot/*
tmp/*
run/*
mnt/*
data/*
media/*
  • --exclude-from=foobar.txt should be fine as long as the file path doesn't include spaces. – goldilocks Aug 29 '16 at 14:39
  • File path doesn't includes spaces, however a hyphen in file name. I tried as per answer the but proc, sys and all folder mentioned by @goldilocks are getting created – Ciasto piekarz Aug 29 '16 at 14:58
  • If you use /proc/* the proc folder should be created, just nothing in it will be copied, and the destination side contents will be deleted. I.e., it should be empty afterward. – goldilocks Aug 29 '16 at 15:01

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.