Compare commits

...

9 Commits

Author SHA1 Message Date
b477b945a1 Add .rsync-plex-ignore 2025-09-24 10:08:49 +03:00
8e90cd5a83 Delete backup_home.sh 2025-09-24 10:02:45 +03:00
5edea5168d Update .rsync-ignore 2025-09-24 09:30:53 +03:00
e4e9ef714b remove telegram cache 2025-09-24 09:28:26 +03:00
de3d71d2d9 create backup script 2025-09-24 08:25:21 +03:00
d1615920ec change readme 2025-09-24 08:17:05 +03:00
ea42e14006 exclude chrome files 2025-09-24 08:12:20 +03:00
a7b9f7433d create .gitignore file 2025-09-24 08:11:58 +03:00
2c9f03ee52 change README.md 2025-09-24 08:11:42 +03:00
4 changed files with 41 additions and 22 deletions

0
.gitignore vendored Normal file
View File

View File

@@ -9,6 +9,7 @@
# Flatpack # Flatpack
.var/app/*/cache .var/app/*/cache
.var/app/*/.cache .var/app/*/.cache
.var/app/org.telegram.desktop/data/TelegramDesktop/tdata/user_data
# Recently used files # Recently used files
.local/share/RecentDocuments .local/share/RecentDocuments
@@ -35,6 +36,9 @@ Thumbs.db
.config/google-chrome/*/History Index * .config/google-chrome/*/History Index *
.config/google-chrome/*/Service Worker/CacheStorage .config/google-chrome/*/Service Worker/CacheStorage
.config/google-chrome/*/WebStorage/*/CacheStorage .config/google-chrome/*/WebStorage/*/CacheStorage
.config/google-chrome/SingletonCookie
.config/google-chrome/SingletonLock
.config/google-chrome/SingletonSocket
# VS Code # VS Code
.config/Code/logs/ .config/Code/logs/
@@ -46,3 +50,4 @@ go/pkg/mod/cache
# Java # Java
.java .java

10
.rsync-plex-ignore Normal file
View File

@@ -0,0 +1,10 @@
Preferences.bak
.LocalAdminToken
plexmediaserver.pid
Cache/*
Codecs/*
Crash Reports/*
Diagnostics/*
Drivers/*
Logs/*
Updates/*

View File

@@ -3,30 +3,32 @@ This project maintains a list of directories and files you probably do not need
## Usage: ## Usage:
# download to `.rsync-ignore` ```
wget https://gitaly.ru/anpleenko/rsync/raw/branch/main/.rsync-ignore -O .rsync-ignore # download to `.rsync-ignore`
# or clone and copy to `.rsync-ignore` wget https://gitaly.ru/anpleenko/rsync/raw/branch/main/.rsync-ignore -O .rsync-ignore
git clone https://gitaly.ru/anpleenko/rsync curl https://gitaly.ru/anpleenko/rsync/raw/branch/main/.rsync-ignore > .rsync-ignore
cd rsync-homedir-excludes # or clone and copy to `.rsync-ignore`
cp rsync-homedir-excludes.txt .rsync-ignore git clone https://gitaly.ru/anpleenko/rsync
cd rsync
# edit the file .rsync-ignore to your needs # edit the file .rsync-ignore to your needs
nano .rsync-ignore nano .rsync-ignore
# define a Backup directory (with trailing slash!) # define a Backup directory (with trailing slash!)
# some examples: # some examples:
BACKUPDIR=/media/workspace/home/$USER BACKUPDIR=/media/workspace/home/$USER
BACKUPDIR=/media/$USER/linuxbackup/home/$USER BACKUPDIR=/media/$USER/linuxbackup/home/$USER
BACKUPDIR=/media/$USER/USBSTICK/backup/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: # 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/ rsync -naP --exclude-from=.rsync-ignore /home/$USER/ $BACKUPDIR/
# check for permission denied errors in your homedir: # check for permission denied errors in your homedir:
rsync -naP --exclude-from=.rsync-ignore /home/$USER/ $BACKUPDIR/ | grep denied rsync -naP --exclude-from=.rsync-ignore /home/$USER/ $BACKUPDIR/ | grep denied
# if it is all fine, actually perform your backup: # if it is all fine, actually perform your backup:
rsync -aP --exclude-from=.rsync-ignore /home/$USER/ $BACKUPDIR/ rsync -aP --exclude-from=.rsync-ignore /home/$USER/ $BACKUPDIR/
```
You can edit the exclude file before execution: 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. - All lines starting with a `#` are ignored by rsync, i.e. those directories will be backed up.
@@ -37,8 +39,10 @@ You can edit the exclude file before execution:
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. 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: 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)" BACKUPDIR=/media/workspace/home/$USER
cp -al $BACKUPDIR $SNAPSHOT_DIR 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. Next time you run your backup, the snapshot directory will be intact despite the changes rsync made to the files in the backup directory.