udev(7) is a system used to manage your computer devices dynamically.

Whenever the kernel detects a new device being plugged in or out, the
udevd(8) daemon will be notified, and can react to this event.

You can then ask it to perform certain actions when such events occur, for
example, start a backup script whenever a specific USB disk is plugged in.

	# /etc/udev/rules.d/usb-backup.conf
	KERNEL=="sd?1"          \
	, SUBSYSTEMS=="usb"     \
	, DRIVER=="usb-storage" \
	, ACTION=="add"         \
	, SYMLINK+="backup"     \
	, RUN+="/usr/sbin/backup-usb.sh"

Now every time a new device is plugged onto your computer, udev will
check if it matches this rule:

+ KERNEL     : device name match "sd?1" ('?' being any character)
+ SUBSYSTEMS : match devices plugged via "usb"
+ DRIVER     : match devices of type "usb-storage"
+ ACTION     : only match when device is "add"ed to the system

Then, if all the above conditions (note the "==") match, udev do the
following:

+ SYMLINK    : create a symlink to the device under /dev/backup
+ RUN        : run the script `/usr/sbin/rsync-usb.sh`

Check udev(7) for more attributes/details on rules syntax.

You can get all attributes for a device with the following command:

	udevadm info -a -p /sys/block/sdc/sdc1

Thanks to udev creating a symlink for your device at /dev/backup, you
can hardcode it in your backup script, which can be as simple as:

	#!/bin/sh

	mkdir -p /mnt/backup/$(hostname -f)
	mount /dev/backup /mnt/backup

	rsync -a /etc /home /mnt/backup/$(hostname -f)

	sync
	umount /mnt/backup