3

I have 4 internal drives (a,b,c,d) that I would like to back up to external drives (a_bak, b_bak, c_bak, d_bak; respectively).

I've attempted this using udev rules, from HERE, but I can't seem to make it work. First of all, I have two external drives from the same manufacturer, so the prefixes are the same (as they are listed in the ATTR key). I did attempt the code from the link, modifying it so that it matches my system, but it didn't work.

Am I better off creating a cron job, with a script that tries to determine which drive is connected (using the UUID preferably) and rsynching to it? Is there a more elegant method with udev?

Thanks in advance for your help!

EDIT: I'm using Ubuntu desktop 18.04. I have no virtualization, and I don't need to backup the boot drive. The drives I'd like to backup are simply data drives. The drives I'm planning on using are external USB drives. Also, the fs type for each of the drives is ext4. Apologies for not mentioning this earlier.

  • You haven't mentioned a OS/release, or why you're asking here. https://askubuntu.com/help/on-topic – guiverc Mar 07 '20 at 02:01
  • 2
    Please click [edit] and add into your question the OS you're using (Ubuntu Server, Ubuntu Desktop, Kubuntu, Lubuntu, Xubuntu, Ubuntu Kylin, Ubuntu Budgie, Ubuntu MATE, et al.) and its release number. Also, is virtualization in use? Please do use [edit] but don't use Add Comment; Add Comment is our channel to you, whereas what facts you have should go in the Question. – K7AAY Mar 07 '20 at 02:33
  • 1
  • Regarding UUID, does this answer help? – danzel Mar 07 '20 at 16:50
  • Thank you for the responses. I have yet to attempt the suggestions from @pa4080 and danzel. I will try these tonight and report back tomorrow. Thank you all for your help! – rhunt915 Mar 07 '20 at 22:30
  • After reading through the links provided above (thanks again), I am still having no luck. I have modified my backup script to copy a file from the backup source to the backup destination, and have been able to successfully execute it from the command line. After reading though danzel's suggestion, I have added the environment variable to the udev rule. So, now here is my udev rule: SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_UUID}=="298738C85FC70C68", RUN+="/bin/backupStorageA.sh" Many thanks again in advance. – rhunt915 Mar 08 '20 at 15:22

0 Answers0