Results 1 to 4 of 4

Thread: rsync - restricted backup - include files failure

Hybrid View

  1. #1
    Join Date
    Aug 2013
    Beans
    10

    Question rsync - restricted backup - include files failure

    My use case is simple enough; to backup home dir without hidden files and without some other dirs, e.g. Downloads. But to also including a few of the hidden files.

    One example of the hidden files is the firefox bookmarks directory.
    So, the config includes "- .*" at the end of the list and has "+ .mozilla/firefox/xxxxxxxx.default-release/bookmarkbackups/*"
    or hopefully more generically "+ .mozilla/firefox/*.default*/bookmarkbackups/*". The problem with the firefox files backup is that none of the bookmark files are backed up, nor anything else in the .mozilla directory which is the intent.

    The current rsyncFiles.cfg file is show below. The logic is to exclude what I dont want, so that all else is backed up, achieved with the last line "- .*". This more recent approach to find a solution to the issue may well cause most of the lines beginning with "- " to not be needed. Anyway, thus far ... .

    Tried dozens of suggestions from google searches to no avail. Please help!

    The rsync command being used is:
    Code:
    rsync -navhsHm --exclude-from=$HOME/.rsync-backup/rsyncFiles.cfg  ~/  /media/backup/$HOME/
    and the current "rsyncFiles.cfg" file contains:
    Code:
    #Directories
    
    - /snap
    - /deja-dup
    - /Downloads
    - /Public
    - /Videos
    - /dwhelper
    - /efax-gtk-server
    - /faxin
    - /faxout
    - /faxsent
    - /my_docker
    
    #Mounted filesystem
    - .local/share/gvfs-metadata
    - .Private
    - .gvfs
    
    #Session-specific directories and files
    - .dbus
    - .cache
    - .Trash
    - .local
    - .Xauthority
    - .ICEauthority
    - .pulse-cookie
    - .var
    - .config
    - .gconf
    - .gnome2_private
    - *.parts
    + .ssh
    + .cert
    + .bash*
    + .profile
    
    #Recent Files
    - ./local/share/recently-used.xbel
    
    #Firefox
    + .mozilla/*
    + .mozilla/firefox/*
    + .mozilla/firefox/*.default-*/*
    + .mozilla/firefox/*.default*/bookmarkbackups/*
    - .mozilla/***
    
    #Other Applications
    + .thunderbird
    
    - .*

  2. #2
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: rsync - restricted backup - include files failure

    I would separate exclude and include patterns into two separate files called via

    Code:
    --exclude-from=
    --include-from=
    An alternative is to use the crude filter rules with + and -, but I think it is more difficult to manage.

    Code:
    --filter=
    There is a lot written about filter rules in man rsync
    Last edited by sudodus; October 21st, 2021 at 01:41 PM.

  3. #3
    Join Date
    Aug 2013
    Beans
    10

    Re: rsync - restricted backup - include files failure

    Finally figured it out after much reading of the man pages and other forums with out success. I finally came across this site https://sites.google.com/site/rsync2...de-from-option which clarified what I was missing, and is arguably missed on the other pages I looked at.

    so the current "homeDir.filter" file, which includes the desired files, and excludes what is not wanted, and works is:
    Code:
    #Directories
    
    - /snap
    - /deja-dup
    - /Desktop
    - /Downloads
    - /Music
    - /Pictures
    - /Public
    - /Videos
    - /dwhelper
    - /efax-gtk-server
    - /faxin
    - /faxout
    - /faxsent
    - /my_docker
    
    #Hidden directories and files
    
    + /.ssh/
    + /.cert/
    + /.bash*
    + /.profile
    
    #Firefox
    + /.mozilla/
    + /.mozilla/firefox/
    + /.mozilla/firefox/*.default*/
    + /.mozilla/firefox/*.default*/bookmarkbackups/
    - /.mozilla/*
    - /.mozilla/firefox/*
    - /.mozilla/firefox/*.default*/*
    
    #Other Applications
    + /.thunderbird/
    
    - .*

    Hope this is helpful and saves people looking to achieve something similar, a lot of time. Note, the order is important to get this to work.

  4. #4
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: rsync - restricted backup - include files failure

    Thanks for sharing your solution

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •