== Basic knowledge ==

For udev Howto, see http://www.reactivated.net/writing_udev_rules.html

To generate a uuid for a jfs filesystem, type

 sudo jfs_tune -U random /dev/sde1

The Information about devices you have with a uuid is in


But wouldn't it be better to have a /dev device like you wish?

(don't do)
 SYSFS{vendor}==SAMSUNG, SYSFS{model}=="HD400LD", SYMLINK+="backup"



Would do that, if the vendor is SAMSUNG and the model is called HD400LD.
But there may be problems caused by multiple SYSFS (are illegal) or multiple
SAMSUNG discs. For more about that consult the udev Howto and udevinfo.
So this will work mostly, another way would be UUID.

== Use UUID to rename a device ==

To have a condition based on uuid, you need:
 IMPORT{program}="vol_id --export $tempnode"

This will run vol_id (unter debian in /lib/udev/vol_id) and export everything
to environment. As the main effect you can use ENV{ID_FS_UUID} from now on.

With the technique above you already know the uuid, so just use it with the rule:

 ENV{ID_FS_UUID}=="154b128d-f198-47b3-ace3-b1a25bc906d6", SYMLINK+="backup"

Perfectly, my backup device will now be also symlinked by /dev/backup!

== Running a script when plugging a device ==

RUN can be used to run a script when a condition is successful.
Make sure that the script detaches itself immediately, because udev
is blocked until the program is running.

Fr Jul 30 13:54:24 CEST 2021
patent_button.gif valid-html401.png elektra.jpg fsfe-logo.png valid-css.png vim.gif anybrowser.gif