backup_with_rsync
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| backup_with_rsync [2026/02/04 21:55] – created steve | backup_with_rsync [2026/02/06 16:06] (current) – Just adding more notes. steve | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ==== Backup with rsync ==== | ==== Backup with rsync ==== | ||
| + | So, this is what I've been doing to make backups of machines for years, it stores permissions, | ||
| + | \\ | ||
| + | This is what I see in my /Backup folder with;\\ | ||
| + | '' | ||
| <code bash> | <code bash> | ||
| - | ## Type ↓ ↓ ↓, User stejon0jadmin in ~ on usmiftnilnx001 ## | ||
| - | ls -Al /Backup | ||
| total 64 | total 64 | ||
| drwxr-xr-x 12 root root 4096 2026-02-04+15: | drwxr-xr-x 12 root root 4096 2026-02-04+15: | ||
| Line 12: | Line 14: | ||
| -rwx------ | -rwx------ | ||
| </ | </ | ||
| + | \\ | ||
| + | Below is a short script that just runs the actual backup script with different sets of options for what goes where;\\ | ||
| + | '' | ||
| <code bash / | <code bash / | ||
| - | ## Type ↓ ↓ ↓, User stejon0jadmin in ~ on usmiftnilnx001 ## | ||
| - | sudo cat / | ||
| #!/bin/bash | #!/bin/bash | ||
| # make sure we're running as root | # make sure we're running as root | ||
| Line 30: | Line 32: | ||
| cat / | cat / | ||
| </ | </ | ||
| + | \\ | ||
| + | The .conf script below that gets sourced by the backup script below that;\\ | ||
| + | '' | ||
| + | <code bash / | ||
| + | # =-=-=-=-=-=- File locations and variables. | ||
| + | # Where to write the backups, begins with / only. | ||
| + | SNAPSHOT_RW=/ | ||
| + | # What directory to back up, begins and ends in /. | ||
| + | SNAP_DIR="/"; | ||
| + | # Where to store the list of files and directories that we backed up. | ||
| + | FILELIST=$SNAPSHOT_RW/ | ||
| + | # Summary file, a short list of actions taken by rsync to complete the backup. | ||
| + | SUMMARY=$SNAPSHOT_RW/ | ||
| + | # Stuff not to back up, there is always stuff to not back up! | ||
| + | EXCLUDES=$SNAPSHOT_RW/ | ||
| + | # How many snapshot backups do we want to keep? Must be at least 2! | ||
| + | NUM_SNAP=10; | ||
| + | </ | ||
| + | \\ | ||
| + | Below is the actual script that calls rsync to do the backup, into a unique folder-by-date.\\ | ||
| + | '' | ||
| <code bash / | <code bash / | ||
| - | ## Type ↓ ↓ ↓, User stejon0jadmin in ~ on usmiftnilnx001 ## | ||
| - | sudo cat / | ||
| #!/bin/bash | #!/bin/bash | ||
| # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ||
| Line 142: | Line 162: | ||
| # } fi; | # } fi; | ||
| </ | </ | ||
| + | \\ | ||
| + | The / | ||
| + | '' | ||
| <code text / | <code text / | ||
| - | ## Type ↓ ↓ ↓, User stejon0jadmin in ~ on usmiftnilnx001 ## | ||
| - | sudo cat / | ||
| /Backup/* | /Backup/* | ||
| / | / | ||
| Line 164: | Line 184: | ||
| / | / | ||
| </ | </ | ||
| + | \\ | ||
| + | And, what's in the partition backup folder;\\ | ||
| + | '' | ||
| <code bash> | <code bash> | ||
| - | ## Type ↓ ↓ ↓, User stejon0jadmin in ~ on usmiftnilnx001 ## | ||
| - | ls -Al / | ||
| total 52 | total 52 | ||
| drwxr-xr-x 44 root root 4096 2026-01-26+15: | drwxr-xr-x 44 root root 4096 2026-01-26+15: | ||
| Line 183: | Line 203: | ||
| -rw-r--r-- | -rw-r--r-- | ||
| </ | </ | ||
| + | \\ | ||
| + | The Summary file is a quick recap of what happened during the last backup;\\ | ||
| + | '' | ||
| <code bash> | <code bash> | ||
| - | ## Type ↓ ↓ ↓, User stejon0jadmin in ~ on usmiftnilnx001 ## | ||
| - | sudo cat / | ||
| sending incremental file list | sending incremental file list | ||
| created directory / | created directory / | ||
| Line 196: | Line 216: | ||
| total size is 264, | total size is 264, | ||
| </ | </ | ||
| + | \\ | ||
| + | Backing up another partition requires only to create another .conf file, creating the folder to drop the backups into, and copying the ' | ||
| + | Below is the .conf for the EFI partition; | ||
| + | '' | ||
| + | <code bash / | ||
| + | # =-=-=-=-=-=- File locations and variables. | ||
| + | # Where to write the backups, begins with / only. | ||
| + | SNAPSHOT_RW=/ | ||
| + | # What directory to back up, begins and ends in / | ||
| + | SNAP_DIR="/ | ||
| + | # Where to store the list of files and directories that we backed up. | ||
| + | FILELIST=$SNAPSHOT_RW/ | ||
| + | # Summary file, a short list of actions taken by rsync to complete the backup. | ||
| + | SUMMARY=$SNAPSHOT_RW/ | ||
| + | # Stuff not to back up, there is always stuff to not back up! | ||
| + | EXCLUDES=$SNAPSHOT_RW/ | ||
| + | # How many snapshot backups do we want to keep? Must be at least 2! | ||
| + | NUM_SNAP=10; | ||
| + | </ | ||
| + | \\ | ||
| + | Other stuff;\\ | ||
| + | In one of the date points in the backup folder, there are a few added files, '' | ||
| + | '' | ||
| + | <code bash> | ||
| + | total 8389772 | ||
| + | drwxr-xr-x | ||
| + | lrwxrwxrwx | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x 149 root root 12288 Feb 4 14:30 etc | ||
| + | -rw------- | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x | ||
| + | lrwxrwxrwx | ||
| + | lrwxrwxrwx | ||
| + | drwxr-xr-x | ||
| + | drwx------ | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x | ||
| + | dr-xr-xr-x | ||
| + | drwx------ | ||
| + | drwxr-xr-x | ||
| + | lrwxrwxrwx | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x | ||
| + | -rw-r--r-- | ||
| + | dr-xr-xr-x | ||
| + | drwxrwxrwt | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x | ||
| + | </ | ||
| + | Notice above that the actual files (the soft links) in this folder have inode counts of 10. That means that they haven' | ||
| + | \\ | ||
| + | Below, you can see that files that change every day change their link count;\\ | ||
| + | '' | ||
| + | <code bash> | ||
| + | -rw-r--r-- 1 root root 22146 Jan 26 06:47 / | ||
| + | -rw-r--r-- 1 root root 23063 Jan 27 12:44 / | ||
| + | -rw-r--r-- 1 root root 23992 Jan 28 06:45 / | ||
| + | -rw-r--r-- 1 root root 24790 Jan 29 06:35 / | ||
| + | -rw-r--r-- 1 root root 28212 Jan 30 09:05 / | ||
| + | -rw-r--r-- 1 root root 31634 Jan 31 12:40 / | ||
| + | -rw-r--r-- 1 root root 3422 Feb 1 14:22 / | ||
| + | -rw-r--r-- 1 root root 6844 Feb 2 06:21 / | ||
| + | -rw-r--r-- 1 root root 10096 Feb 3 06:09 / | ||
| + | -rw-r--r-- 1 root root 11239 Feb 4 08:39 / | ||
| + | </ | ||
backup_with_rsync.1770242147.txt.gz · Last modified: by steve
