Keep What Matters, Delete What Does Not

Data retention is about deliberate housekeeping rather than endless hoarding. Keeping every log file and temporary export consumes disk space and increases breach exposure, while overly aggressive pruning removes records you may need years later.
A workable policy answers three questions for each folder or dataset:
- Legal or practical minimum: How long must it stay accessible?
- Useful lifespan: How long does it remain valuable?
- Deletion method: When and how should it be pruned automatically?
Retention by Data Type
| Data Type | Minimum Retention | Typical Target | Notes |
|---|---|---|---|
| Personal photos and videos | Indefinite | Indefinite | Irreplaceable family records |
| Financial and tax records | 6 years (HMRC guidance) | 7 years | UK self-assessment and company records |
| Business correspondence | 3 years | 5 years | Contract reference |
| Medical records | Lifetime | Lifetime | Personal health history |
| Code repositories | Active lifetime | Active + 2 years | Archive finished projects |
| System security logs | 90 days | 1 year | Incident review |
| Application debug logs | 14–30 days | 90 days | Troubleshooting |
| Backup snapshots | Per rotation policy | 7d / 4w / 12m | See Backup Strategies |
| Container images | Current + previous | 2–3 versions | Fast rollback |
| Browser bookmarks | Indefinite | Indefinite | Negligible storage |
Automated Lifecycle Policies
Restic Backup Rotation
# Keep: 7 daily, 4 weekly, 12 monthly, 5 yearly
restic forget \
--keep-daily 7 \
--keep-weekly 4 \
--keep-monthly 12 \
--keep-yearly 5 \
--pruneLog Rotation with Logrotate
# /etc/logrotate.d/docker-logs
/var/lib/docker/containers/*/*.log {
rotate 7
daily
compress
delaycompress
missingok
notifempty
copytruncate
}Docker System Cleanup
# Remove stopped containers, unused networks, dangling images, build cache
docker system prune -f
# Also remove unused volumes (careful!)
docker system prune --volumes -f
# Automate via cron (weekly)
0 2 * * 0 /usr/bin/docker system prune -f >> /var/log/docker-prune.log 2>&1Storage Tiering
Match drive speed and redundancy to how often files are read:
| Tier | Storage Medium | Typical Contents | Retention |
|---|---|---|---|
| Hot | NVMe SSD (RAID 1) | Databases, active projects, container volumes | Always online |
| Warm | HDD (RAID 5/6/SHR) | Media libraries, local backups, recent archives | Months to years |
| Cold | External HDD off-site | Completed projects, historical archives | Years to decades |
| Long-term archive | M-DISC optical, LTO tape, cold object storage | Critical legal or family archives | Decades |
UK GDPR Considerations for Self-Hosters
Purely personal household services sit outside UK GDPR, but hosting accounts for wider community members or business clients brings legal duties:
- Right to erasure: Be able to locate and delete an individual's records on request.
- Data minimisation: Collect only fields the service needs.
- Storage limitation: Purge inactive accounts and stale logs on schedule.
- Documentation: Record what personal data each service holds and where backups reside.
Directory Structure for Clean Retention
Organising folders by lifecycle makes automated cleanup straightforward:
/data/
/active/ # Current work, hot tier
/archive/
/2024/ # Completed year
/2025/ # Completed year
/media/
/photos/ # Organised by year/month
/music/ # Permanent
/video/ # Permanent
/backup/
/daily/ # 7-day rotation
/weekly/ # 4-week rotation
/monthly/ # 12-month rotation
/temp/ # Auto-delete after 30 daysAuto-Delete Temporary Files
# Cron: delete files in /data/temp older than 30 days
0 3 * * * find /data/temp -type f -mtime +30 -deleteDeletion Methods
When retiring drives or scrubbing sensitive records, confirm the deletion level matches the risk:
- Logical deletion: Removes filesystem pointers while blocks remain recoverable until overwritten.
- Secure overwrite: Overwrites file blocks (
shred), less reliable on wear-levelled SSDs. - Cryptographic erasure: Store sensitive volumes on LUKS-encrypted disks so destroying the encryption header renders all blocks unreadable immediately.
Building Your Retention Policy
- Inventory: List every directory and database you maintain.
- Classify: Assign each category a retention window and legal or practical reason.
- Automate: Configure
restic forget,logrotate, and scratch-folder pruning. - Document: Save a short
retention.mdfile inside/docs/. - Review annually: Adjust storage tiers and schedules as projects evolve.
Product links may include affiliate partnerships. See our affiliate disclosure for details.