-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/
Ciasto piekarz
  • 355
  • 2
  • 12
  • 28

1 Answers1

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/*
Varad A G
  • 850
  • 6
  • 18