Ask a small office in Kampala whether it has backups and the answer is nearly always yes. Ask the next question, when did you last restore from one?, and the room goes quiet. A backup you have never restored is a hope, not a backup. This guide is about turning that hope into a plan you can test on a Friday afternoon.
We will build a simple 3-2-1 backup plan for a small office Linux server using tools that ship with almost every distribution: tar, sha256sum, rsync and cron. Then we will do the part most people skip. We will delete data on purpose and bring it back. Every command output in this article comes from a run I did this morning, 30 November 2026, on the AlmaLinux 8.10 server that hosts this site, inside a throwaway folder under /tmp.
What this guide covers
- Why "we have backups" is not enough
- The 3-2-1 rule in plain terms
- Step 1: a full archive with tar and a checksum
- Step 2: daily snapshots with rsync --link-dest
- Step 3: break it and restore it
- Step 4: automate it with cron, safely
- Step 5: the offsite copy
- A checklist you can use today
Why "we have backups" is not enough
A backup fails in boring ways. The USB disk filled up in March and nobody noticed. The script still runs, but it copies an empty folder because the shared drive was renamed. The only copy sits in the same room as the server, so the same power surge or the same burglar takes both. Or ransomware encrypts the server and then encrypts the backup disk too, because it was always plugged in.
None of these show up until the day you need the data. That is why I teach backups as two skills, not one: making copies and proving the copies work.
There is also a legal angle here. If the office holds personal data, such as staff files, client records or student marks, the Data Protection and Privacy Act (Cap. 97), section 20 requires the data controller to take reasonable technical and organisational measures to prevent loss, damage or unauthorised destruction of that data, and to regularly verify that those safeguards work. A tested backup is one of the clearest ways to show you did that. I covered the Act from a developer's side in an earlier post.
The 3-2-1 rule in plain terms
The rule is old and still good. CISA's guide Data Backup Options states it like this: keep 3 copies of any important file (the original plus 2 backups), on 2 different media types, with 1 copy offsite.
For a small office with one Linux file server, that becomes:
- Copy 1: the live data on the server, for example
/srv/office. - Copy 2: nightly snapshots on a separate disk attached to the server.
- Copy 3: a weekly encrypted archive kept somewhere else, such as a machine at another branch or a cloud bucket.

Step 1: a full archive with tar and a checksum
For the lab I made a small fake office share with three folders: finance (eleven monthly cashbook CSV files), hr (one 300 KB zip) and shared (a minutes file). Then I archived it.
$ tar -czf backup/office-2026-11-30.tar.gz -C srv office
$ ls -lh backup/
-rw-r--r-- 294K office-2026-11-30.tar.gz
$ sha256sum backup/office-2026-11-30.tar.gz > backup/office-2026-11-30.sha256
$ tar -tzf backup/office-2026-11-30.tar.gz | wc -l
17
Three habits are in those four lines.
- Use
-C. It tells tar to change intosrvfirst, so the archive storesoffice/...and not the full path. Restores become predictable. The GNU tar manual explains the option. - Put the date in the file name. At 2 a.m. during an incident, nobody wants to guess which
backup.tar.gzis the good one. - Record a checksum straight away. The
.sha256file lets you prove later that the archive has not changed or been damaged in transit.
The tar -tzf | wc -l line is a quick sanity check. 17 entries: three folders, the top folder and thirteen files. If that number suddenly drops to 1, your source path is wrong.
Step 2: daily snapshots with rsync --link-dest
A full tar every night is wasteful when most files do not change. rsync with --link-dest gives you a full-looking folder per day while only storing the files that changed. Unchanged files become hard links to the previous snapshot. The rsync manual page documents the option.
$ rsync -a --delete srv/office/ backup/snap-2026-11-29/
# someone edits the November minutes
$ rsync -a --delete --link-dest=../snap-2026-11-29 srv/office/ backup/snap-2026-11-30/
$ du -sh backup/snap-2026-11-29 backup/snap-2026-11-30
360K backup/snap-2026-11-29
20K backup/snap-2026-11-30
$ stat -c "%h %n" backup/snap-2026-11-30/hr/staff-contracts.zip
2 backup/snap-2026-11-30/hr/staff-contracts.zip
Read that output carefully. The second snapshot looks complete if you browse it, but du counts it at 20K, because only the edited minutes file and the folder entries are new. The stat link count of 2 shows the zip is one file on disk, shared by both snapshots.
Two details trip people up. The trailing slash on srv/office/ means "the contents of office", and a relative --link-dest is read relative to the destination folder, which is why it says ../snap-2026-11-29.
Step 3: break it and restore it
Now the real test. I deleted the whole finance folder, then restored from the archive into a separate folder, never over the live data.
$ rm -rf srv/office/finance
$ mkdir /tmp/kat-restore-test && tar -xzf backup/office-2026-11-30.tar.gz -C /tmp/kat-restore-test
$ sha256sum -c backup/office-2026-11-30.sha256
backup/office-2026-11-30.tar.gz: OK
$ ls /tmp/kat-restore-test/office/finance | wc -l
11
$ diff -r /tmp/kat-restore-test/office/hr srv/office/hr && echo "hr: identical"
hr: identical
Eleven cashbook files back, the checksum matches, and the HR folder is byte for byte the same as the live copy. That is a backup I can trust.
I also wanted to see what a damaged archive looks like, so I overwrote four bytes in a copy of it and tested it:
$ gzip -t bad.tar.gz
gzip: bad.tar.gz: invalid compressed data--crc error
That is the message you want to see during a test, not on the day the finance officer is standing behind you. Run gzip -t or sha256sum -c on every archive you move.
Step 4: automate it with cron, safely
Here is a small script for the nightly snapshot. Save it as /usr/local/sbin/office-backup.sh and make it executable with chmod 700.
#!/bin/bash
set -euo pipefail
SRC=/srv/office/
DISK=/mnt/backupdisk
DEST=$DISK/snapshots
TODAY=$(date +%F)
# Stop if the backup disk is not mounted, or we fill the system disk
mountpoint -q "$DISK" || { echo "$(date) backup disk not mounted"; exit 1; }
mkdir -p "$DEST"
LAST=$(ls -1d "$DEST"/20* 2>/dev/null | tail -n 1 || true)
if [ -n "$LAST" ]; then
rsync -a --delete --link-dest="$LAST" "$SRC" "$DEST/$TODAY/"
else
rsync -a --delete "$SRC" "$DEST/$TODAY/"
fi
# Keep the newest 14 snapshots
ls -1d "$DEST"/20* | head -n -14 | xargs -r rm -rf
echo "$(date) snapshot $TODAY done"
Then schedule it with crontab -e as root:
30 1 * * * /usr/local/sbin/office-backup.sh >> /var/log/office-backup.log 2>&1
The mountpoint check is the line I care most about. Without it, if the USB disk is unplugged, rsync happily writes the "backup" into an empty /mnt/backupdisk folder on the system disk, and one night the server runs out of space. If you followed my post on reading logs before restarting a service, you already know why the log line at the end matters: it gives you something to read in the morning.
Step 5: the offsite copy
Snapshots on an attached disk protect you from deleted files and a dead system disk. They do not protect you from fire, theft or ransomware that can reach the mounted disk. That is the job of copy 3. Once a week, build an encrypted archive and push it somewhere else:
tar -czf - -C /srv office \
| gpg --batch --symmetric --cipher-algo AES256 \
--passphrase-file /root/.backup-pass \
-o /var/backups/office-$(date +%F).tar.gz.gpg
scp /var/backups/office-$(date +%F).tar.gz.gpg backup@branch-server:/backups/
Keep the passphrase file readable by root only (chmod 600) and keep a second copy of the passphrase on paper in a safe. An encrypted backup with a lost passphrase is just noise. Use SSH keys for the scp user and give that account no shell access beyond what it needs.
I follow the same idea on this site. Before I rebuild the frontend of ssendi.dev, I take a dated tar archive of the current build first, so a bad build is one tar -xzf away from being undone. It is the same pattern at a smaller scale.
A checklist you can use today
| Check | How | How often |
|---|---|---|
| Snapshot ran | tail /var/log/office-backup.log | Daily |
| Backup disk has space | df -h /mnt/backupdisk | Weekly |
| Offsite copy arrived | List the remote folder, compare checksum | Weekly |
| Restore actually works | Restore one folder to /tmp, diff -r it | Monthly |
| Someone else can restore | A colleague follows your written steps | Every term |
The last row is the one I push hardest with system administrators. If you are the only person who can restore the server, the backup plan has a single point of failure, and it is you.
Try it yourself
- On your Ubuntu or AlmaLinux VM from the Linux basics guide, create
/srv/officewith a few files. - Run Step 1 and Step 2 and compare your
du -shnumbers with mine. - Delete a folder, restore it into
/tmp, and prove it withdiff -r. - Unmount the backup disk and run the script. Confirm it stops with the "not mounted" message instead of filling your system disk.
If you get stuck, note the exact command and the exact error. That is half the fix already.