You can easyly backup your home folder on an external harddrive with

rsync -a --exclude=.cache --progress /home/$USER /media/linuxbackup/home/$USER

I excluded the .cache folder cause I think I will never need it when I have to re-install from this backup.

I found this list of all folders that I could exclude in a normal backup here:
What files and directories can be excluded from a backup of the home directory?

I created a list of this answer that contains some coments in this form:

#These directories may be excluded:

.gvfs                           # contains mounted file systems?
.local/share/gvfs-metadata
.Private                        # contains the actual encrypted home directory
.dbus                           # session-specific
.cache
.Trash                          # do I need to say more?
.local/share/Trash
.cddb                           # cached info about audio CDs
.aptitude                       # cached packages lists

#Flash-specific:

.adobe                          # Cache for flash, maybe others?
.macromedia   # except for Flash persistence, there is no reason to keep this

#Files:

.xsession-errors            # contains errors from the current graphical session
.recently-used              # recently used files
.recently-used.xbel
.thumbnails

Here is the full list at gist

How can I add this list to my rsync command?

share|improve this question
    
besides .Trash, there's frequently also .Trash-1000 (under current Ubuntu-MATE 14 at least), so better settle for .Trash-*? – Frank Nocke Feb 26 '17 at 12:43
up vote 25 down vote accepted

Download the ignorelist to /var/tmp/ignorelist

wget https://raw.githubusercontent.com/rubo77/rsync-homedir-excludes/master/rsync-homedir-excludes.txt -O /var/tmp/ignorelist

Then start the rsync with

rsync -aP --exclude-from=/var/tmp/ignorelist /home/$USER/ /media/$USER/linuxbackup/home/

Note:
In the ignorelist there is a section at the start with folders, that are directories, probably not worth a backup.

share|improve this answer
2  
You can combine the two commands, since rsync can read from stdin: wget https://... -O - | rsync -a --progress --exclude-from=- ... – muru Nov 4 '14 at 18:08
5  
good point, but I think it is recommendable first to look at the ignorelist before starting the rsync – rubo77 Nov 4 '14 at 18:17

From man rsync:

 --exclude-from=FILE     read exclude patterns from FILE
          This option is related to the --exclude option, but it specifies
          a FILE that contains exclude patterns  (one  per  line).   Blank
          lines  in  the  file  and  lines  starting  with  ’;’ or ’#’ are
          ignored.  If FILE is -, the list  will  be  read  from  standard
          input.
share|improve this answer
    
There is such a list, I edited my question – rubo77 Nov 4 '14 at 17:40
    
@rubo77 I stand by my statement that there's no list of all folders you could exclude. That's a recommendation, and I doubt even Lekenstyn would say it's a complete list. – muru Nov 4 '14 at 17:43
    
The list doesn''t have to be complete I just would like to create my backup faster so skip obvious useless folders – rubo77 Nov 4 '14 at 17:44
    
@rubo77 I think you'll have to shift the comments to different lines. – muru Nov 4 '14 at 17:52
    
thx, I updated the gist file so the comments are on single lines – rubo77 Nov 4 '14 at 18:04

Could try this if directories and files within are all you want backing-up. Excludes all hidden directories.

rsync -aP --exclude=.* /home/$USER/ /media/$USER/folder

share|improve this answer
    
Can you be more specific "quotest missing"? – arth May 17 '15 at 16:34
    
Oh, sorry - I was terse, and messed it up by a typo: "quotest" instead of "quotes" missing. – Volker Siegel May 17 '15 at 16:58
    
The shell could expand the * (maybe not in that place?). The paths should be quoted - the user name can not contain a space, but /media/ could be /Old Media/ or so... – Volker Siegel May 17 '15 at 17:02
    
I apologize I am not getting it. The '.*' is to not include any '.' pattern which are hidden directories at home directory '/home/$USER/' to backup destination: external hdd or pen drive '/media/$USER/folder'. By doing this, only the actual directories and files are being backup. If you're pointing something else, please elaborate. – arth May 17 '15 at 18:23
1  
It is not really sensefull to exclude all directories starting with a dot, for example .thunderbird directory is one of the most important directories – rubo77 May 17 '15 at 21:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.