Rh436-rename a usb device with udev (rhel5.5)

Source: Internet
Author: User
[Root@localhostrules.d] # lsb_release-aLSBVersion: core-3.1-amd64: core-3.1-ia32: core-3.1-noarch: graphics-3.1-amd64: graphics-3.1-ia32: graphics-3.1-noarchDistributorID: & nbsp

[Root @ localhost rules. d] # lsb_release-
LSB Version: core-3.1-amd64: core-3.1-ia32: core-3.1-noarch: graphics-3.1-amd64: graphics-3.1-ia32: graphics-3.1-noarch:
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release: 5.5
Codename: Tikanga
[Root @ localhost ~] # Df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/sda2 9.7 GB 2.2G 7.1G 24%/
/Dev/sda1 190 M 12 M 169 M 7%/boot
Tmpfs 501 M 0 501 M 0%/dev/shm
/Dev/sdb1 31G 4.6G 26G 16%/media/SSK
[Root @ localhost ~] # Udevinfo-q path-p/dev/sdb
No record for '/dev/sdb' in database
[Root @ localhost ~] # Udevinfo-q path-n/dev/sdb
/Block/sdb
[Root @ localhost ~] # Udevinfo-a-p/block/sdb
...
Looking at parent device '/devices/pci0000: 00/0000: 00: 11.0/. 0/usb1/1-1 ':
ID = "1-1"
BUS = "usb"
DRIVER = "usb"
SYSFS {configuration} = ""
SYSFS {serial} = "AA00000000000605"
SYSFS {product }= = "usb disk"
SYSFS {manufacturer} = "SMI Corporation"
SYSFS {maxchild }= = "0"
SYSFS {version }== "2.00"
SYSFS {devnum} = "2"
SYSFS {speed} = "480"
SYSFS {bMaxPacketSize0 }= "64"
SYSFS {bNumConfigurations }== "1"
SYSFS {bDeviceProtocol} = "00"
SYSFS {bDeviceSubClass }== "00"
SYSFS {bDeviceClass }== "00"
SYSFS {bcdDevice} = "1100"
SYSFS {idProduct} = "1000"
SYSFS {idVendor }== "090c"
SYSFS {bMaxPower }== "500mA"
SYSFS {bmAttributes} = "80"
SYSFS {bConfigurationValue }== "1"
SYSFS {bNumInterfaces }== "1"
...

Vim/etc/udev/rules. d/99-myusb.rules
US = "usb" SYSFS {serial} = "AA00000000000605" SYSFS {manufacturer} = "SMI Corporation" NAME = "myusb % n" SYMLINK + = "myulink % n"

[Root @ localhost rules. d] # df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/sda2 9.7 GB 2.2G 7.1G 24%/
/Dev/sda1 190 M 12 M 169 M 7%/boot
Tmpfs 501 M 0 501 M 0%/dev/shm
/Dev/myusb1 31G 4.6G 26G 16%/media/SSK
[Root @ localhost rules. d] # ll/dev/my *
Lrwxrwxrwx 1 root 5 May 27/dev/myulink-> myusb
Lrwxrwxrwx 1 root 7 May 27/dev/myulink00-> myusb00
Lrwxrwxrwx 1 root 7 May 27/dev/myulink02-> myusb02
Lrwxrwxrwx 1 root 6 May 27/dev/myulink1-> myusb1
Lrwxrwxrwx 1 root 7 May 27/dev/myulink81-> myusb81
Brw-r ----- 1 root disk 8, 16 May 27/dev/myusb
Crw ------- 1 root 442, 8 May 27/dev/myusb00
Crw ------- 1 root 442, 8 May 27/dev/myusb02
Brw-r ----- 1 root disk 8, 17 May 27/dev/myusb1
Crw ------- 1 root 442, 8 May 27/dev/myusb81

We can see that the sdb has been changed to myusb and the myulink link has been created. However, it is not clear how the three stand-alone devices come out.

Simple troubleshooting:
You can use the udevmonitor command to view some udev events and messages.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.