Grade by Grade
C. Computer Environments and Systems · Computer Environments and Systems

Backing Up and Archiving Files

C2.3About 70 minutes
Learning goals
  • I can explain the difference between a backup, an archive and file syncing.
  • I can apply the 3-2-1 rule and choose between full, incremental and differential backups.
  • I can use standard tools to back up files, restore them and check that a backup is good.
  • I can archive old projects in a compressed, well-labelled form, and write Python that backs up and archives files.

Words to know

backup
An extra copy of data, kept separately, so you can restore it if the original is lost, damaged or encrypted.
restore
To copy files back from a backup.
archive
Older files you no longer change, moved off your main drive into long-term storage, often compressed.
sync
Keeping the same files identical on several devices. A change or deletion on one device spreads to the others, so syncing alone is not a backup.
full / incremental / differential backup
Full copies everything. Incremental copies only what changed since the last backup of any kind. Differential copies everything that changed since the last full backup.
3-2-1 rule
Keep 3 copies of important data, on 2 different kinds of media, with 1 copy off-site.
compression
Encoding data so it takes less space, as in a .zip file.
checksum (hash)
A short code calculated from a file's contents. If even one byte changes, the code changes, so matching codes show a copy is identical.

"My laptop won't turn on"

It is the week before exams. Your laptop slides off the kitchen counter, and now it shows a black screen. Your notes, your programs and your culminating project were only on that laptop.

Drives fail, laptops get dropped or stolen, ransomware strikes, and people delete the wrong folder. The only protection against all of these is a backup. In the last lesson, backups were the safety net under every other layer of protection. This lesson shows you how to set one up properly, and how to archive old work so it is safe and out of the way.

Backup, archive and sync are different

  • A backup is an extra copy of files you still use, kept somewhere else, so you can restore them.
  • An archive is where files go when you are finished with them: last year's projects, old photos. They are moved off your main drive into long-term storage, usually compressed and clearly labelled.
  • Syncing (OneDrive, Google Drive, iCloud and similar) keeps the same files on several devices. That is handy, but if you delete or overwrite a file, or ransomware encrypts it, the change syncs too. Many sync services keep older versions or a recycle bin for a while, which helps, but you should not count on sync as your only backup.

The 3-2-1 rule

A widely used guideline for important data:

  • 3 copies: the original plus two backups.
  • 2 different kinds of media (for example, the laptop's internal SSD and an external hard drive), so one kind of failure cannot destroy everything.
  • 1 copy off-site: in the cloud, or on a drive kept somewhere else, so a fire, flood or theft at home does not take every copy.

Keep at least one backup disconnected when you are not using it. Ransomware can encrypt any drive that is plugged in.

3📄📄📄copies of your datathe original+ 2 backups2💻different kinds of mediae.g. internal SSD+ external drive1☁️copy off-sitecloud, or a drive keptat a relative's home
The 3-2-1 rule for backups: three copies, two kinds of media, one off-site.

Full, incremental and differential backups

  • Full backup: copies everything every time. Simplest to restore, but slow and uses the most space.
  • Incremental backup: after one full backup, each backup copies only the files that changed since the last backup. Fast and small, but to restore you need the full backup plus every incremental since, in order.
  • Differential backup: after one full backup, each backup copies everything that changed since the last full backup. Each one grows during the week, but a restore needs only the full backup plus the latest differential.

Many people do a full backup weekly or monthly with incremental or differential backups in between. Built-in tools do this for you: File History on Windows and Time Machine on macOS keep hourly or daily versions on an external drive, and cloud backup services work in the background.

SunMonTueWedThuFull every day10 GB10 GB10 GB10 GB10 GBIncremental10 GB2 GB2 GB2 GB2 GBDifferential10 GB2 GB4 GB6 GB8 GBAssume 10 GB of files and 2 GB of different files changing each day.
Daily backup sizes for each method (drawn to scale). Incremental backups stay small; differential backups grow until the next full backup.

Standard backup procedures

  1. Decide what to back up: your user folders (Documents, Desktop, Pictures, course folders). Programs can be reinstalled; your work cannot.
  2. Choose media and a schedule that follow 3-2-1: for example, File History or Time Machine to an external drive daily, plus cloud backup for school folders.
  3. Automate it. A backup you have to remember is a backup that does not happen.
  4. Test a restore. Regularly restore a file to a different folder and open it. A backup you cannot restore is not a backup.
  5. Check integrity. Tools can compare a checksum (hash) of each original and its copy; if they match, the copy is identical.
  6. Label and protect backup drives (date, contents), store them safely, and encrypt them if they hold private information.
from pathlib import Path
import shutil
import hashlib
src = Path("project")
src.mkdir(exist_ok=True)
(src / "game.py").write_bytes(b"print('Hello, Thunder Bay!')\n")
(src / "scores.txt").write_bytes(b"Ava 120\nLiam 95\n")
backup = Path("backup_2026-10-16")
shutil.copytree(src, backup, dirs_exist_ok=True)
def fingerprint(path):
return hashlib.sha256(path.read_bytes()).hexdigest()[:12]
for f in sorted(src.iterdir()):
copy = backup / f.name
print(f.name, fingerprint(f), "copy matches:", fingerprint(copy) == fingerprint(f))

A tiny backup program. shutil.copytree copies a whole folder, and a SHA-256 checksum (shortened to 12 characters here) proves each copy is identical to its original. Run it in an empty practice folder; it makes the project folder for you. Output (one line each): game.py 8c2dbf45e2f2 copy matches: True / scores.txt 22e0da2d667e copy matches: True

Archiving

When a course or project is finished:

  • Collect everything for that project into one folder, delete true junk (temporary files, duplicate downloads), and add a short README.txt saying what it is.
  • Compress it into a .zip file with a clear name, such as ICS3U_2026-2027_projects.zip. Compression makes text and code files much smaller.
  • Store the archive on long-term media, with a copy in a second place (archives need backups too).
  • Choose lasting formats: plain text, PDF and common image formats are more likely to open in 20 years than an unusual app's format.
  • Check archives every few years: open them, and copy them to newer media before old drives fail.
  • Respect who owns the data. Archives often hold other people's information. For example, the First Nations principles of OCAP® (ownership, control, access and possession), a registered trademark of the First Nations Information Governance Centre (FNIGC), say that First Nations control how information about their communities is collected, protected, used and shared. Good archiving follows the agreements and privacy laws that cover the data.
import zipfile
from pathlib import Path
folder = Path("old_projects")
(folder / "2025").mkdir(parents=True, exist_ok=True)
(folder / "2025" / "maze.py").write_bytes(b"# maze game\n" * 200)
(folder / "2025" / "quiz.py").write_bytes(b"# quiz game\n" * 50)
with zipfile.ZipFile("old_projects_2025.zip", "w", zipfile.ZIP_DEFLATED) as z:
for f in sorted(folder.rglob("*.py")):
z.write(f, f.relative_to(folder).as_posix())
with zipfile.ZipFile("old_projects_2025.zip") as z:
for info in z.infolist():
print(info.filename, info.file_size, "bytes, smaller when zipped:", info.compress_size < info.file_size)

An archiving program. It zips every .py file in old_projects, then opens the archive and checks each file shrank. Writing bytes (b"...") makes the file sizes the same on every operating system. Output (one line each): 2025/maze.py 2400 bytes, smaller when zipped: True / 2025/quiz.py 600 bytes, smaller when zipped: True

Worked example

Example 1: Which backup type?

Ava's computer has 50 GB of files. Each day she changes about 2 GB of different files. She does a full backup on Sunday. (a) How much space do Monday to Saturday's backups use with incremental and with differential backups? (b) Her drive fails on Saturday night after the backup. What does she need to restore with each method?

  1. Incremental: each day copies just that day's 2 GB. Monday to Saturday: 6 × 2 = 12 GB.
  2. Differential: each day copies everything changed since Sunday: 2, 4, 6, 8, 10, 12 GB. Total: 2 + 4 + 6 + 8 + 10 + 12 = 42 GB.
  3. Restore with incremental: the full backup plus all six incrementals, applied in order (Monday, then Tuesday, ...). If any one is missing or damaged, later changes may be lost.
  4. Restore with differential: the full backup plus Saturday's differential only.

Incremental uses 12 GB but needs 7 pieces to restore; differential uses 42 GB but needs only 2.

Worked example

Example 2: A backup plan that follows 3-2-1

Liam keeps his school work and photos on a laptop. Write a backup plan that follows the 3-2-1 rule.

  1. Copy 1 (original): the laptop's SSD.
  2. Copy 2 (different medium): an external hard drive with File History (or Time Machine) running automatically whenever it is plugged in; Liam plugs it in every Sunday night and unplugs it afterwards so ransomware cannot reach it.
  3. Copy 3 (off-site): his school folders sync to his school cloud account, and his photos use a cloud backup service.
  4. Testing: on the first Sunday of each month he restores one file from the external drive to a test folder and opens it.
  5. Archiving: each June he zips the year's school folders, labels them by school year, and stores the archive on the external drive and in the cloud.

Three copies (laptop, external drive, cloud), two media types, one off-site, automated and tested monthly.

Just for fun

There are two kinds of computer users: those who back up their files, and those who have not lost any files yet.

Hands-on activity

Back up, break, restore

You need: a computer with Python, and a USB flash drive or external drive if you have one (a second folder works too).

  1. Run the backup program in an empty practice folder. Check that backup_2026-10-16 appeared with both files.
  2. Break something on purpose: open project/scores.txt, add a line, and save. Run the program again, but first put # at the start of the two write_bytes lines and the copytree line, so that it only checks and does not overwrite anything. Which file now shows False? Why?
  3. Restore: copy scores.txt from the backup folder back into project using the file manager. Run the check again.
  4. Set up the real backup tool on your computer (File History or Time Machine to an external drive, if your family has one), or copy your course folder to a USB drive and a cloud drive.
  5. Run the archive program, then open old_projects_2025.zip in the file manager and compare its size with the folder's size.

What to look for: in step 2, scores.txt shows copy matches: False, because the original changed and its checksum changed with it. After the restore it shows True again. In step 5 the zip file is much smaller than the files inside it, because repeated text compresses well.

Your turn

1

What is the difference between a backup and an archive?

2

State the 3-2-1 rule.

3

Why is cloud syncing alone not a complete backup?

4

Why should a backup drive be unplugged when you are not backing up?

5

What do you need to restore from incremental backups?

6

Why test a restore?

7

What does a matching checksum tell you?

More practice: warm-up

1

What is the built-in backup tool on macOS called? On Windows (for user files)?

2

Which backup type copies everything every time?

3

What does compressing a folder into a .zip file do?

4

Give one example of off-site storage.

5

Should you back up installed programs or your own work first?

More practice: on your own

1

A computer has 80 GB of files; 5 GB of different files change each day. With a full backup on Sunday, how much space do differential backups from Monday to Friday use in total?

2

Same computer with incremental backups Monday to Friday. Total space?

3

Explain why differential backups are faster to restore than incremental ones.

4

Someone keeps their backup external drive plugged in all the time, in the same room as the laptop. Name two risks.

5

In the backup program, what would happen to the output if scores.txt in the backup were deleted before the check ran?

Challenge

1

Modify the check loop so it prints MISSING for a file that has no copy in the backup, instead of crashing. Write the loop.

2

A photographer has 2 TB of photos and adds about 20 GB a week. Design a backup and archive plan, with numbers, that follows 3-2-1.

3

Why might an archive of old projects saved as .zip still be unreadable in 20 years, and what reduces that risk?

Check your understanding

Quiz

1.

Which statement best describes the 3-2-1 rule?

2.

Why is syncing to the cloud not a complete backup on its own?

3.

To restore from differential backups, you need...

4.

Files total 40 GB; 3 GB of different files change each day after a Sunday full backup. How big is Wednesday's differential backup?

5.

What is the purpose of comparing checksums of an original and its backup?

6.

Which is the best example of archiving?

For parents and teachers

Big idea: Expectation C2.3 asks students to use standard procedures to back up and archive user files. The habit matters more than the tool.

How to help: Help your teen set up a real backup: an external drive with File History (Windows) or Time Machine (macOS), and/or a cloud backup. Ask them to restore one file in front of you. If the family has no backup plan, this lesson is a great reason to make one together. Store one copy away from home (a relative's house or the cloud).

Common difficulties:

  • Believing cloud sync is the same as a backup.
  • Leaving the backup drive always connected (ransomware can reach it).
  • Never testing a restore.
  • Mixing up incremental (since the last backup of any kind) and differential (since the last full backup).

Families with private information (tax files, health records) on backup drives should consider encrypting them.