# udev action on mount encrypted volume

## mistake25

Hi,

is there possibility to run script, when specific encrypted volume is mounted? To explain my situation, I have encrypted USB drive, using cryptsetup/luks, when I plug it into computer, gnome automatically asks me for a password, I enter password and it successfully mounts encrypted drive, and I want to run an action when this drive is mounted, not when plugged in, is there way how to do it?

Thanks

----------

## ulenrich

When you decrypt an encrypted device then an additional device is created.

Isn't this a task udev is able to do:

If device then execute a script

(I have never done this yet)

----------

## mistake25

yes, actually realized that, but how can I identify that appropriate device is created? found one possible way to check DM_NAME attrib, but is there way how can I specify what DM_NAME should my device have (some human-readable string), actually it is something like udisks-luks-uuid-DEVICE_ID-uid1000, I would like to specify somewhere that drive with some specific ID, or serial number should have some specific DM_NAME is there way how can I do this?

----------

