Using udevadm to gather information about specific device

Usually, udevadm requires the sysfs device path of the device in question. But you can also ask udevadm which device path belongs to a certain device node. This gets really helpful if you combine these two queries.

Example: You want to get a list of attributes for a specific device. You do not know the complete device path; all you know is the device node /dev/sdb:

# udevadm info -a -p  $(udevadm info -q path -n /dev/sdb)

A nice document describing how to use this information to write udev rules can be found on http://www.reactivated.net/writing_udev_rules.html.

12 thoughts on “Using udevadm to gather information about specific device

  1. Pingback: /dev/blog

  2. Pingback: Rambles of Ev » Blog Archive » /dev/blog » Using udevadm to gather information about specific device

  3. Pingback: ogre 3d III « Invalidmagic's Blog

  4. Pingback: Can not mount my USB disk– Ubuntu nor windows[dmesg including] Drija

  5. avatarJoshua

    Old page, but still comes up as the first google result for ‘udevadm examples’. This seems to be the same thing as above in a more natural form:

    # udevadm info -a -n /dev/sdb

  6. avatarPsnarf

    Please let the folks over at reactivated.net know that udevinfo got replaced by udevadm. Otherwise, the example udev rules are a valuable reference, as is this page.

    –Internet Society For Replacing Obsolete Data In Reference Documentation (ISFRODIRD)

    Thanks for giving the relatively new system admins a leg-up!

  7. Pingback: Delicious Bookmarks for August 2nd through August 4th « Lâmôlabs

  8. Pingback: Udev & Udevadm gather info about a device & all devices (little info on mknod & mdev -s) - kossboss

  9. avatarmuahaha

    can confirm. This is the first result for udevadm examples… not many examples tho 🙁

  10. avataradmin Post author

    @muahaha
    Yeah, sorry. It was intended as memory hook for myself. I should do a new, more verbose post since this is almost six years old…

  11. Pingback: Android 開發環境之安裝 | [心] 誌

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.