Giter Club home page Giter Club logo

rsync-homedir-excludes's Introduction

rsync-homedir-excludes

This project maintains a list of directories and files you probably do not need to back up, which you can pass to the rsync command's --exclude-from option.

Usage:

# download to `rsync-homedir-local.txt`
wget https://raw.githubusercontent.com/rubo77/rsync-homedir-excludes/master/rsync-homedir-excludes.txt -O rsync-homedir-local.txt
# or clone and copy to `rsync-homedir-local.txt`
git clone https://github.com/rubo77/rsync-homedir-excludes
cd rsync-homedir-excludes
cp rsync-homedir-excludes.txt rsync-homedir-local.txt

# edit the file rsync-homedir-local.txt to your needs
nano rsync-homedir-local.txt

# define a Backup directory (with trailing slash!)
# some examples:
BACKUPDIR=/media/workspace/home/$USER
BACKUPDIR=/media/$USER/linuxbackup/home/$USER
BACKUPDIR=/media/$USER/USBSTICK/backup/home/$USER

# first specify the "-n" parameter so rsync will simulate its operation. You should use this before you start:
rsync -naP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR/

# check for permission denied errors in your homedir:
rsync -naP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR/ | grep denied

# if it is all fine, actually perform your backup:
rsync -aP --exclude-from=rsync-homedir-local.txt /home/$USER/ $BACKUPDIR/

You can edit the exclude file before execution:

  • All lines starting with a # are ignored by rsync, i.e. those directories will be backed up.
  • The syntax doesn't support comments at the end of a line yet.
  • At the start there is a section with directories that are probably not worth backing up. Uncomment those lines to exclude them as well.

Making incremental backups:

When running locally or with the --whole-file option (for backups over SSH), rsync doesn't modify files but replaces them entirely. This allows us to create a snapshot directory (with hardlinks) with the state of the backup directory at a certain point in time.
Run this after finishing the rsync backup and it'll create a new snapshot:

BACKUPDIR=/media/workspace/home/$USER
SNAPSHOT_DIR="$BACKUPDIR.snapshot_$(date +'%Y-%m-%d_%H%M%S' -u)"
cp -al $BACKUPDIR $SNAPSHOT_DIR

Next time you run your backup, the snapshot directory will be intact despite the changes rsync made to the files in the backup directory.

rsync-homedir-excludes's People

Contributors

bell07 avatar captaintyphoo avatar djcrashdummy avatar eduardobcastro avatar errantlinguist avatar habitzreuter avatar jackm avatar jorickert avatar logological avatar m8 avatar maltekiefer avatar marcusfey avatar materliu avatar mikkoi avatar mozlima avatar nettnikl avatar nl6720 avatar pad92 avatar rlndvt avatar rswrz avatar rubo77 avatar samwilson avatar skierpage avatar sskender avatar szemanek avatar themeier avatar wesq3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rsync-homedir-excludes's Issues

._DS_Store

You can also safely exclude ._DS_Store

Slash prefix resolves to actual root instead of current working dir

Hi, just encountered an issue with the entries using a slash prefix.
And as there are cases where the excludes are to be employed only for entries in the current root directory (#8), i think this might be worth a look.

Some implementations of rsync type exclude lists (i'm using this) see the leading slash as the actual root path - not the PWD, the path we are executing the backup in.

My workaround is to use ./ instead, e.g. ./Android/Sdk instead of /Android/Sdk or Android/Sdk.

What's your thoughts?

Excluding shell history files and python local packages

What is the reason behind excluding files such as .bash_history, .zsh_history, and .python_history?
Also, why exclude .local/lib/python*, which contains locally installed Python packages to the user scheme? A user might want to keep the Python packages that they've already installed into their home directory in their backup.
I would have thought that backing up files/folders such as these would be somewhat important. I'm more curious as to why they were excluded to begin with.

Electron Apps clearup

The file contains the "universal" settings for Electron Apps

# Electron Apps
.config/**/blob_storage
.config/**/Application Cache
.config/**/Cache
.config/**/CachedData
.config/**/Code Cache
.config/**/GPUCache

Some of apps are configured separately. Maybe the file should be cleared up. I am about removal of some redundant google chrome, chromium and brave lines ..

Add flatpak .var directory ?

Thanks for this. On Fedora 31 I have a ~/.var directory, containing only ~/.var/app with a directory for each flatpak. Most of mine 2-16 MB, but com.valvesoftware.Steam is 2GB.

https://github.com/flatpak/flatpak/wiki/Filesystem says "each application sandbox gets a per-app data directory mounted which persists over app upgrades." Mostly these directories contain cache and config directories. I've never intentionally modified them.
So I think add to the # directories, probably not worth a backup # section of rsync-homedir-excludes.txt :

## Flatpak applications' data, mostly cache and config
#/.var/app

Lots of missing leading slashes?

Hi Ruben,

Thanks for sharing the list. It saved me quite some time today.

I noticed that some of the entries had a leading slash, while some didn't (e.g., there are entries of the form /Downloads, but also entries of the form .android. I didn't know what this slash meant, but I looked it up (see for example this question on unix.stackexchange) and if I understand it correctly, more or less every entry should start with a slash: we (presumably) do not want to skip every folder containing .android somewhere in its path, but we only want to skip /home/$USER/.android, and that is what the slash is for.

Dev backup rules

Could you add some rules

node_modules # Node libs
vendor # php composer libs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.