change README.md

This commit is contained in:
2025-09-24 08:11:42 +03:00
parent 8c0bd6b785
commit 2c9f03ee52

View File

@@ -3,6 +3,7 @@ This project maintains a list of directories and files you probably do not need
## Usage: ## Usage:
```
# download to `.rsync-ignore` # download to `.rsync-ignore`
wget https://gitaly.ru/anpleenko/rsync/raw/branch/main/.rsync-ignore -O .rsync-ignore wget https://gitaly.ru/anpleenko/rsync/raw/branch/main/.rsync-ignore -O .rsync-ignore
# or clone and copy to `.rsync-ignore` # or clone and copy to `.rsync-ignore`
@@ -27,6 +28,7 @@ This project maintains a list of directories and files you probably do not need
# 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 BACKUPDIR=/media/workspace/home/$USER
SNAPSHOT_DIR="$BACKUPDIR.snapshot_$(date +'%Y-%m-%d_%H%M%S' -u)" SNAPSHOT_DIR="$BACKUPDIR.snapshot_$(date +'%Y-%m-%d_%H%M%S' -u)"
cp -al $BACKUPDIR $SNAPSHOT_DIR 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.