Skip to content

elir0n/backup-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

backup-tool

Lightweight, dependency‑free backup helper for Linux and other POSIX systems. It mirrors a source directory into a destination directory using hard links by default, so repeated backups reuse existing disk blocks instead of copying data. You can switch to plain file copies, preserve symlinks, or dry‑run to see what would change.

Features

  • Hard‑link based mirroring for fast, space‑efficient backups
  • Optional byte‑for‑byte copy mode
  • Verbose logging and dry‑run for safe previews
  • Choice to recreate symlinks or follow them

Build

Requires a C compiler with POSIX headers (tested with gcc and clang).

gcc -std=c11 -Wall -Wextra -O2 backup.c -o backup-tool

or simply:

make

Test

Run the shell-based integration suite:

make test

Usage

./backup-tool [options] <source_directory> <backup_directory>

Options:

  • -v verbose output
  • -n dry run (no filesystem writes)
  • -m {link|copy} choose how regular files are duplicated (default: link)
  • -L follow symlinks instead of recreating them
  • -h show help
  • --version print version and exit

Examples:

# Fast, space‑efficient snapshot using hard links
./backup-tool -v ~/Projects/myapp ~/Backups/myapp-$(date +%Y%m%d)

# Preview the actions without touching the disk
./backup-tool -vn src/ build/backup-preview

# Force byte‑for‑byte copies and follow symlinks
./backup-tool -m copy -L data/ /mnt/usb/data-backup

Notes

  • The destination path must not already exist; it will be created with the same permissions as the source root.
  • Special files other than regular files, directories, and symlinks are skipped.
  • Works best on filesystems that support hard links (e.g., ext4, xfs, btrfs).

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors