Background
A client needs an automated backup solution to an external drive (to be taken offsite weekly). I'd typically suggest rsnapshot (or perhaps rolling out a custom rsync
script), but this question is slightly more involved.
The Arch Linux based system is headless and therefore the solution must be fully automated, requiring no user intervention.
An ideal scenario would be as follows:
- The user plugs in a USB hard drive
- A complete incremental backup is made
- The hard drive is unmounted
- The user is notified that the hard drive can be unplugged
Proposal
My proposed solution consists of:
- A
udev
rule automatically mounts the drive The backup is started with:
- The same
udev
rule also triggers arsnapshot
script - An inotify create event detects the new mount point and triggers
rsnapshot
- The same
After
rsnapshot
exits,umount
is ran on the drivePossible ways to notify the hard drive can be removed:
- The CD drive opens
- A sound is played through the PC speaker
If an error occurred at any point, email the user and unmount the drive.
Questions
- My proposal seems feasible but are there obvious flaws? How can I make it robust?
- For security purposes, how can I make sure the hard drive plugged in is the user's?
ssh
keys? Drive label? - Are there existing (Linux) solutions that encompass this?