Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use backintime, you can tell it to backup via backintime -b as user (not root, but I can change that if needed). Now I'd like it to start as soon as I plug my backup hd. As udev is likely the right tool, there's a bunch of info: http://sprunge.us/icCa. Bonus points if it's possible to assign a label to the disk ("backup") and match against that, not serial numbers.

share|improve this question
Here you can find the answer and some of the answer in this udev question could be also interesting for you. – jofel Mar 23 '12 at 8:59

I do exactly this on my computer. I prefer to match by serial number, since I feel it's more precise. Udev can match by model, but IIRC not by specific device (i.e. if you have two drives that are the same model, it'll run on both). Hence, the script to call backintime is slightly more complicated that you'd expect. Also, you don't necessarily want backintime to run every time the HD is plugged in (e.g. if restoring files), so I've also added a dialogue box with timeout. There are a few other enhancements, so check out the code here.

The script runs backintime as root, so I can backup all files. If you want to run as user, then you could try sudo -u $CURRENTUSER backintime -b, but I can't think of a negative to running as root. (Apart from having to run the root GUI version of backintime.)

The only other thing is that my script is written to be used with a LUKS-encrypted HD. If that is not relevant for you, the script will require some minor modifications. Let me know if you need help with that.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.