create exclude file
This commit is contained in:
48
.rsync-ignore
Normal file
48
.rsync-ignore
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
.gvfs
|
||||||
|
.cache/*
|
||||||
|
.local/share/[Tt]rash*
|
||||||
|
*.backup*
|
||||||
|
*~
|
||||||
|
.dropbox*
|
||||||
|
.Private
|
||||||
|
|
||||||
|
# Flatpack
|
||||||
|
.var/app/*/cache
|
||||||
|
.var/app/*/.cache
|
||||||
|
|
||||||
|
# Recently used files
|
||||||
|
.local/share/RecentDocuments
|
||||||
|
.recently-used
|
||||||
|
.recently-used.xbel
|
||||||
|
recently-used.xbel
|
||||||
|
.thumbnails
|
||||||
|
.thumb
|
||||||
|
Thumbs.db
|
||||||
|
.DS_Store
|
||||||
|
.localised
|
||||||
|
.CFUserTextEncoding
|
||||||
|
.zcompdump*
|
||||||
|
.wget-hsts
|
||||||
|
|
||||||
|
# Thunderbird Cache in your profile folder
|
||||||
|
.thunderbird/*/Cache
|
||||||
|
|
||||||
|
#Google Chrome:
|
||||||
|
.config/google-chrome/ShaderCache
|
||||||
|
.config/google-chrome/*/Local Storage
|
||||||
|
.config/google-chrome/*/Session Storage
|
||||||
|
.config/google-chrome/*/Application Cache
|
||||||
|
.config/google-chrome/*/History Index *
|
||||||
|
.config/google-chrome/*/Service Worker/CacheStorage
|
||||||
|
.config/google-chrome/*/WebStorage/*/CacheStorage
|
||||||
|
|
||||||
|
# VS Code
|
||||||
|
.config/Code/logs/
|
||||||
|
.config/Code/Cache/*
|
||||||
|
.config/Code/CachedData/*
|
||||||
|
|
||||||
|
# golang Cache
|
||||||
|
go/pkg/mod/cache
|
||||||
|
|
||||||
|
# Java
|
||||||
|
.java
|
44
README.md
44
README.md
@@ -1,2 +1,44 @@
|
|||||||
# rsync
|
# 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-ignore`
|
||||||
|
wget https://gitaly.ru/anpleenko/rsync/raw/branch/main/.rsync-ignore -O .rsync-ignore
|
||||||
|
# or clone and copy to `.rsync-ignore`
|
||||||
|
git clone https://gitaly.ru/anpleenko/rsync
|
||||||
|
cd rsync-homedir-excludes
|
||||||
|
cp rsync-homedir-excludes.txt .rsync-ignore
|
||||||
|
|
||||||
|
# edit the file .rsync-ignore to your needs
|
||||||
|
nano .rsync-ignore
|
||||||
|
|
||||||
|
# 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-ignore /home/$USER/ $BACKUPDIR/
|
||||||
|
|
||||||
|
# check for permission denied errors in your homedir:
|
||||||
|
rsync -naP --exclude-from=.rsync-ignore /home/$USER/ $BACKUPDIR/ | grep denied
|
||||||
|
|
||||||
|
# if it is all fine, actually perform your backup:
|
||||||
|
rsync -aP --exclude-from=.rsync-ignore /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.
|
||||||
|
Reference in New Issue
Block a user