Ubuntu/Debian mirror synchronisation with intelligent deduplication using hardlinks.
- Downloads from upstream and hardlinks duplicate files (same SHA256 hash) to save bandwidth and disk space
- Supports multiple mirrors with global deduplication across all mirrors
- Uses curl for duplicate files, rsync for unique files and metadata
- Configurable via YAML files
- Systemd timer support for automated synchronisation
Download the latest .deb package from GitHub Releases:
wget https://github.com/munger/mirror-dedupe/releases/download/v0.2.0/mirror-dedupe_0.2.0-1_all.deb
sudo dpkg -i mirror-dedupe_0.2.0-1_all.debThis includes systemd integration, man pages, and proper package management.
pip install mirror-dedupeThen install systemd files manually:
sudo ./install.sh --pipgit clone https://github.com/munger/mirror-dedupe.git
cd mirror-dedupe
sudo ./install.shConfiguration files are located in /etc/mirror-dedupe/:
mirror-dedupe.conf- Global settingsrepos-available/- Available repository configurationsrepos-enabled/- Enabled repositories (symlinks to repos-available)
Use the scanner to auto-generate configuration for a repository, for example:
mirror-dedupe-scan --name grafana --dest grafana https://apt.grafana.comSee config/repos-available/README.md for the full mirror-dedupe-scan
reference and ready-made commands for all of the packaged example
repositories.
Then test and enable it using the CLI:
# Test that the upstream and GPG key URL (if configured) are reachable
mirror-dedupe --test grafana
# If the test looks good, activate the repository
mirror-dedupe --activate grafanaIf you prefer, you can still enable it manually with a symlink:
cd /etc/mirror-dedupe/repos-enabled
ln -s ../repos-available/grafana.conf .By default, both tools use /etc/mirror-dedupe. You can override this with --config, e.g. for testing or multiple instances:
mirror-dedupe --config /tmp/mirror-test --test grafanaThe package includes pre-configured repositories:
- ubuntu - Ubuntu main archive (noble)
- ubuntu-ports - Ubuntu ports archive (noble)
- ubuntu-cloud - Ubuntu Cloud Archive (selected OpenStack tracks on noble)
- debian - Debian stable archive (bookworm)
- docker - Docker packages for Ubuntu noble
- grafana - Grafana APT repository
- influxdb - InfluxData repository for Debian/Ubuntu
- kubernetes - Kubernetes packages from apt.kubernetes.io
- nginx - Official NGINX packages for Ubuntu
- nodesource-node22 - Node.js 22.x LTS from NodeSource
- postgresql - PostgreSQL APT repository (noble-pgdg)
# Sync all mirrors
mirror-dedupe
# Sync specific mirror
mirror-dedupe --mirror ubuntu
# Dry run
mirror-dedupe --dry-run
# Dedupe only (no sync)
mirror-dedupe --dedupe-onlyIf installed via Debian package, systemd is already configured. Otherwise:
sudo systemctl enable --now mirror-dedupe.timer
sudo systemctl status mirror-dedupe.timerView logs:
journalctl -u mirror-dedupe.serviceSee nginx/mirror.conf for an example nginx configuration.
MIT License - see LICENSE file for details.
Tim Hosking tim@mungerware.com