User Tools

Site Tools


backup_with_rsync

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
backup_with_rsync [2026/02/05 16:30] stevebackup_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, and you can export the /Backup folder via NFS, then remap it to another folder as read-only so users can do their own restores if you want (not going into that here).\\+So, this is what I've been doing to make backups of machines for years, it stores permissions, and you can export the /Backup folder via NFS, then remap it to another folder as read-only so users can do their own restores if you want (not going into that here).  The reason that the *.conf files start with 00 and 01 is just to set the order that things are backed up, the ''**for Script in *.conf**'' part below goes in lexical order.\\ 
 +\\
 This is what I see in my /Backup folder with;\\ This is what I see in my /Backup folder with;\\
 ''**ls -Al /Backup**''. ''**ls -Al /Backup**''.
Line 36: Line 37:
 <code bash /Backup/01-Root.conf> <code bash /Backup/01-Root.conf>
 # =-=-=-=-=-=- File locations and variables.  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # =-=-=-=-=-=- File locations and variables.  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-# Where to write the backups+# Where to write the backups, begins with / only.
         SNAPSHOT_RW=/Backup/01-Root;         SNAPSHOT_RW=/Backup/01-Root;
-# What directory to back up, begins and ends in /+# What directory to back up, begins and ends in /.
         SNAP_DIR="/";         SNAP_DIR="/";
 # Where to store the list of files and directories that we backed up. # Where to store the list of files and directories that we backed up.
Line 216: Line 217:
 </code> </code>
 \\ \\
 +Backing up another partition requires only to create another .conf file, creating the folder to drop the backups into, and copying the 'Excludes' file there.\\
 +Below is the .conf for the EFI partition;\\
 +''**sudo cat /Backup/00-EFI.conf**''
 +<code bash /Backup/00-EFI.conf>
 +# =-=-=-=-=-=- File locations and variables.  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 +# Where to write the backups, begins with / only.
 +        SNAPSHOT_RW=/Backup/00-EFI;
 +# What directory to back up, begins and ends in /
 +        SNAP_DIR="/boot/efi/";
 +# Where to store the list of files and directories that we backed up.
 +        FILELIST=$SNAPSHOT_RW/Filelist
 +# Summary file, a short list of actions taken by rsync to complete the backup.
 +        SUMMARY=$SNAPSHOT_RW/Summary
 +# Stuff not to back up, there is always stuff to not back up!
 +        EXCLUDES=$SNAPSHOT_RW/Excludes;
 +# How many snapshot backups do we want to keep? Must be at least 2!
 +        NUM_SNAP=10;
 +</code>
 +\\
 +Other stuff;\\
 +In one of the date points in the backup folder, there are a few added files, ''**/Backup/01-Root/2026-02-04-20-20/Filelist**'' and a copy of the Summary file;
 +''**sudo ls -Al /Backup/01-Root/2026-02-04-20-20/**''
 +<code bash>
 +total 8389772
 +drwxr-xr-x   2 root root       4096 Nov 26  2024 Backup
 +lrwxrwxrwx  10 root root          7 Apr 22  2024 bin -> usr/bin
 +drwxr-xr-x   2 root root       4096 Feb 26  2024 bin.usr-is-merged
 +drwxr-xr-x   4 root root       4096 Feb  3 11:10 boot
 +drwxr-xr-x   2 root root       4096 Feb  4 14:46 dev
 +drwxr-xr-x 149 root root      12288 Feb  4 14:30 etc
 +-rw-------   1 root root    1000059 Feb  4 15:23 Filelist
 +drwxr-xr-x   6 root root       4096 Jan 15  2025 home
 +drwxr-xr-x   2 root root       4096 Feb  3 11:07 i18n
 +lrwxrwxrwx  10 root root          7 Apr 22  2024 lib -> usr/lib
 +lrwxrwxrwx  10 root root          9 Apr 22  2024 lib64 -> usr/lib64
 +drwxr-xr-x   2 root root       4096 Feb 26  2024 lib.usr-is-merged
 +drwx------   2 root root       4096 Jun 27  2024 lost+found
 +drwxr-xr-x   2 root root       4096 Jun 27  2024 media
 +drwxr-xr-x   2 root root       4096 Apr 23  2024 mnt
 +drwxr-xr-x  12 root root       4096 Aug 27 00:14 opt
 +dr-xr-xr-x   2 root root       4096 Feb  3 11:06 proc
 +drwx------  12 root root       4096 Feb  3 10:54 root
 +drwxr-xr-x   2 root root       4096 Feb  4 14:46 run
 +lrwxrwxrwx  10 root root          8 Apr 22  2024 sbin -> usr/sbin
 +drwxr-xr-x   2 root root       4096 Apr  3  2024 sbin.usr-is-merged
 +drwxr-xr-x   2 root root       4096 Apr 23  2024 srv
 +-rw-r--r--  10 root root        116 Jun 27  2024 Summary
 +dr-xr-xr-x   2 root root       4096 Feb  3 15:22 sys
 +drwxrwxrwt   2 root root       4096 Feb  4 14:46 tmp
 +drwxr-xr-x  12 root root       4096 Apr 23  2024 usr
 +drwxr-xr-x  14 root root       4096 Jun 27  2024 var
 +</code>
 +Notice above that the actual files (the soft links) in this folder have inode counts of 10. That means that they haven't changed in all of the backups, it's only a single file in the /Backup sub-folder, with hard links in pointing at the original file.\\
 +\\
 +Below, you can see that files that change every day change their link count;\\
 +''**sudo ls -l /Backup/01-Root/*/var/log/unattended-upgrades/unattended-upgrades.log**''
 +<code bash>
 +-rw-r--r-- 1 root root 22146 Jan 26 06:47 /Backup/01-Root/2026-01-26-20-20/var/log/unattended-upgrades/unattended-upgrades.log
 +-rw-r--r-- 1 root root 23063 Jan 27 12:44 /Backup/01-Root/2026-01-27-20-20/var/log/unattended-upgrades/unattended-upgrades.log
 +-rw-r--r-- 1 root root 23992 Jan 28 06:45 /Backup/01-Root/2026-01-28-20-20/var/log/unattended-upgrades/unattended-upgrades.log
 +-rw-r--r-- 1 root root 24790 Jan 29 06:35 /Backup/01-Root/2026-01-29-20-20/var/log/unattended-upgrades/unattended-upgrades.log
 +-rw-r--r-- 1 root root 28212 Jan 30 09:05 /Backup/01-Root/2026-01-30-20-20/var/log/unattended-upgrades/unattended-upgrades.log
 +-rw-r--r-- 1 root root 31634 Jan 31 12:40 /Backup/01-Root/2026-01-31-20-20/var/log/unattended-upgrades/unattended-upgrades.log
 +-rw-r--r-- 1 root root  3422 Feb  1 14:22 /Backup/01-Root/2026-02-01-20-20/var/log/unattended-upgrades/unattended-upgrades.log
 +-rw-r--r-- 1 root root  6844 Feb  2 06:21 /Backup/01-Root/2026-02-02-20-20/var/log/unattended-upgrades/unattended-upgrades.log
 +-rw-r--r-- 1 root root 10096 Feb  3 06:09 /Backup/01-Root/2026-02-03-20-20/var/log/unattended-upgrades/unattended-upgrades.log
 +-rw-r--r-- 1 root root 11239 Feb  4 08:39 /Backup/01-Root/2026-02-04-20-20/var/log/unattended-upgrades/unattended-upgrades.log
 +</code>
backup_with_rsync.txt · Last modified: by steve