0

Could somebody assist me in creating a working udev rules (Debian 11) for the following actions, please:

  1. A USB disk (2 TB or bigger) has a given volume id of e.g. „abc“.
  2. When the USB disk is attached to one of the USB ports of the Debian 11 host, the udev rule should be applied (i.e. telling the operating system that a USB device is „available“ for later-on mount (see note 2 below).

Notes:

  1. The intention is to backup data residing in Windows 10 network shares (provided by Samba on a Debian server) to USB disk, either by rsync or rdiff-backup.
  2. There will be a bash script which will be launched as a nightly cron job performing the backup. The script is going to mount the USB disk.
  3. After the backup is completed, the USB disk will be unmounted and re-mounted the other night by the cron job.
  4. There should be NO user interaction (except manually detaching the physical USB disk and attaching another USB disk to the server.
  5. The backup script has provisions for a protocol about success and/or errors.

Additional questions:

  1. Which tool do you recommend for backup: rsync or rdiff-backup?
  2. Which filesystem do you recommend for the USB disk? Ideally it should be possible to easily restore files and directories via windows workstations back to the network shares, but this is NOT mandatory. Restoring can also be accomplished on Linux.
  3. Do you recommend „ionice“ for the backup procedure? Which options?
0

A USB disk (2 TB or bigger) has a given volume id of e.g. „abc“.

When the USB disk is attached to one of the USB ports of the Debian 11 host, the udev rule should be applied (i.e. telling the operating system that a USB device is „available“ for later-on mount (see note 2 below).

There will be a bash script which will be launched as a nightly cron job performing the backup. The script is going to mount the USB disk.

You don't need a special udev rule for this. If the disk (filesystem on it) has label "abc", the /dev/disk/by-label/abc symlink will be created after connecting it so you can use this path in your cron bash script to mount the device a perform the backup. You can also mount just with the label using mount LABEL="abc" <mountpoint>, mount will resolve the path itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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