Sample Header Ad - 728x90

Udev rule refuses to trigger when harddrive is added

0 votes
1 answer
2340 views
I'm on Ubuntu 20.04. I'm trying to execute an action when a specific harddrive is connected using an udev rule identifying the drive using UUID. The script will eventually do a routine where it will mount the drive and run rsync. To rule out any errors in that process I'm now just trying out a test command. The harddrive is connected via SATA Hotswap and has an UUID which is confirmed to be correct. I've followed numerous guides that seem to use this exact syntax, and still absolutely nothing happens however I try. Here are the steps I've done: - Created a file called 90-backup.rules in /etc/udev/rules.d. The content is: ACTION=="add", ENV{ID_FS_UUID}=="b527aadc-9dce-4ead-8937-e53ca2cfac84", RUN+="/bin/echo 1 >> /rule.test" - Tried udevadm control --reload-rules && udevadm trigger - Tried systemctl reload udev - Running udevadm test /dev/sdX i can see that it lists the rules file: Reading rules file: /etc/udev/rules.d/90-backup.rules - Using udevadm info /dev/sdX confirm that the ID_FS_UUID environmental variable is correct and can be read. - Tried adding KERNEL=='sd?' before the ACTION argument. Since the server is currently live in use, I haven't tried rebooting it yet. And it would be good to once and for all establish what is necessary to have udev reload the rules properly without reboot, for proper debugging. Any help is appreciated. All the best, Andreas
Asked by A.H (1 rep)
Jan 31, 2022, 01:23 AM
Last activity: Jun 19, 2025, 05:00 AM