File backup tools

Preserve required metadata

Decide whether ownership, permissions, timestamps, links, extended attributes, and application metadata must survive.

10 minute lesson

~~~

File bytes may be insufficient for recovery. A restored web server with the right content but the wrong ownership won’t serve pages. A restored script without its executable bit won’t run. Executable bits, ownership, links, access controls, and extended attributes can affect service behavior just as much as the content does.

For personal documents, bytes are usually enough. For a system restore, metadata is part of the data.

Capture a baseline

Before you can verify metadata survived, record what it looked like. Capture a metadata baseline:

stat notes/report.txt
getfacl notes/report.txt 2>/dev/null || true
ls -l@ notes/report.txt 2>/dev/null || true

stat shows ownership, mode, and the three timestamps. getfacl shows POSIX ACLs on Linux. ls -l@ shows extended attributes on macOS. The || true keeps the commands from failing on platforms where they don’t exist — this baseline script should run anywhere.

Save that output next to your restore documentation. After a restore, run the same commands and compare:

stat restored/notes/report.txt
# compare Uid, Gid, Access mode with the baseline

Know what your tools preserve

Each tool has limits. rsync --archive preserves permissions, times, and symlinks, but needs the extra -A flag for ACLs and -X for extended attributes. tar stores ownership in the archive, but only restores it when you extract as root — as a regular user, everything becomes yours. Restore to a filesystem that supports the needed metadata and compare. Document any platform conversion you accept.

Where this bites

Do not assume a cloud sync tool or FAT-formatted disk preserves Unix ownership and permissions. FAT and exFAT — the default format on most external drives — have no concept of Unix owners or modes. Copy /etc to an exFAT disk and back, and every file returns owned by you with mangled permissions. Dropbox-style sync clients keep content and quietly discard the rest.

The fix is either a properly formatted destination (ext4, APFS) or an archive format like tar that carries the metadata inside the file itself.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →