2

Background

I am trying to make a very comprehensive backup of my Ubuntu system. I am running the following rsync command:

sudo rsync -aAEHSXxv --progress --delete --exclude={/home/sterlingbutters/Butters-Ubuntu-Backup/*, /home/*/.cache/*, /home/*/.local/share/Trash/*, /dev/*, /proc/*, /sys/*, /tmp/*, /mnt/*, /media/*, /lost+found} / /home/sterlingbutters/Butters-Ubuntu-Backup

Where the file structure should be pretty evident.

Problems

  1. I get the following output regarding non-existent files/directories:

    rsync: change_dir "/home/*/.cache" failed: No such file or directory (2)
    rsync: change_dir "/home/*/.local/share/Trash" failed: No such file or directory (2)
    rsync: link_stat "/dev/*," failed: No such file or directory (2)
    rsync: link_stat "/proc/*," failed: No such file or directory (2)
    rsync: link_stat "/sys/*," failed: No such file or directory (2)
    rsync: link_stat "/tmp/*," failed: No such file or directory (2)
    rsync: link_stat "/mnt/*," failed: No such file or directory (2)
    rsync: link_stat "/media/*," failed: No such file or directory (2)
    rsync: link_stat "/lost+found}" failed: No such file or directory (2)
    created directory /home/sterlingbutters/Butters-Ubuntu-Backup
    IO error encountered -- skipping file deletion
    

    Does this mean that file doesn't exist on the source or the destination? (Because they clearly exist on the source)

  2. Later on, I start to get a bunch of entries regarding the .cache directory that I thought I excluded:

    ... 
    home/sterlingbutters/.cache/mozilla/firefox/90d4yr8z.default/cache2/entries/76A1426700B3173C5B976F65F04FA6CD01D90D15
    ...
    
  3. I'm worried to "just see what happens" because if the directories aren't excluded correctly, I might end up with an infinite copy-loop since the destination directory is located at ~/.

  4. My code almost exactly follows the patterns specified in the docs here (the only changes I've made I feel should still be acceptable): I also feel that my syntax follows that which I have found on other forum posts. Even if it didn't, wouldn't that pose a discrepancy between that and the docs in the link?

All help is appreciated - Thanks!

Fabby
  • 34,259
  • 1
    There should be no space after the commas in the exclude list, --exclude={/home/sterlingbutters/Butters-Ubuntu-Backup/*,/home/*/.cache/*, etc. – sudodus Apr 13 '18 at 16:57
  • Wow... seriously? That was it? Thanks – Sterling Butters Apr 13 '18 at 17:05
  • One bug. Please come back when you have tested the command, and tell us if it works or if there is some other bug too. – sudodus Apr 13 '18 at 17:08
  • Working now, will let you know if any problems arise – Sterling Butters Apr 13 '18 at 17:09
  • I'm glad it works for you. Let us hope that it continues working, and performs the backup you want :-) – sudodus Apr 13 '18 at 17:11
  • @sudodus Don't forget to answer if Sterling comes back and it works. Sterling Don't forget to accept the answer so the next person around know this works... – Fabby Apr 14 '18 at 00:09
  • You can exclude a lot of temporary files. And then best to use a separate file list. Some files(temp, cache etc) to exclude from /home backup - post #8 by Paddy Landau http://ubuntuforums.org/showthread.php?t=1883834 and http://askubuntu.com/questions/545655/backup-your-home-directory-with-rsync-and-skip-useless-folders and http://askubuntu.com/questions/40992/what-files-and-directories-can-be-excluded-from-a-backup-of-the-home-directory/40997#40997 – oldfred Apr 14 '18 at 03:36

1 Answers1

3

Your rsync command line was almost correct.

There should be no space after the commas in the exclude list,

sudo rsync -aAEHSXxv --progress --delete --exclude={/home/sterlingbutters/Butters-Ubuntu-Backup/*,/home/*/.cache/*,/home/*/.local/share/Trash/*,/dev/*,/proc/*,/sys/*,/tmp/*,/mnt/*,/media/*,/lost+found} / /home/sterlingbutters/Butters-Ubuntu-Backup
sudodus
  • 46,324
  • 5
  • 88
  • 152
  • Just want to see if I can avoid making another post: I want to backup the /run directory but rsync seems to ignore it, why is this even though its not listed in the exclude argument? – Sterling Butters Apr 14 '18 at 21:49
  • If I understand correctly, /run is a temporary directory, that you {need not/should not} backup. You can check the dates of the files there with sudo ls -l /run – sudodus Apr 14 '18 at 21:58
  • Thats what I've read as well but some of the utilities (xauth to name one) I have been using are putting configuration data in the /run directory that i would like to preserve. – Sterling Butters Apr 14 '18 at 22:00
  • @SterlingButters, See What is this new /run filesystem?; Anyway, it will be re-created at each boot/reboot, so it is not much to save. If problems with rsync, I think you can try to back it up with sudo tar ..., but if things change because of the backup during the backup, the result will not be quite OK. I think many backup tools skip /run. – sudodus Apr 14 '18 at 22:30
  • 1
    You can add a lot of more folders inside your home directory, see my repo: https://github.com/rubo77/rsync-homedir-excludes – rubo77 Jun 17 '20 at 19:27