You are not logged in.

#1 2016-04-09 14:42:34

AcFelis
Member
Registered: 2016-04-09
Posts: 2

[SOLVED]udev rule for usb device not working

hi guys
/etc/udev/rules.d/90-usbdisk.rules

KERNEL=="/dev/sd[a-z][0-9]", SUBSYSTEM=="block", ATTR{size}=="6553600", ATTR{start}=="2048", ATTR{partition}=="1", ACTION=="add", SYMLINK+="USB_HOME"
KERNEL=="/dev/sd[a-z][0-9]", SUBSYSTEM=="block", ATTR{start}=="6555648", ATTR{size}=="772096", ATTR{parition}=="2", ACTION=="add", SYMLINK+="USB_SWAP"

the rules not working,then i write every rule with two lines like this:

KERNEL=="/dev/sd[a-z][0-9]", SUBSYSTEM=="block", ATTR{size}=="6553600", ATTR{start}=="2048", ATTR{partition}=="1",
 ACTION=="add", SYMLINK+="USB_HOME"
KERNEL=="/dev/sd[a-z][0-9]", SUBSYSTEM=="block", ATTR{start}=="6555648", ATTR{size}=="772096", ATTR{parition}=="2",
 ACTION=="add", SYMLINK+="USB_SWAP"

i can find symbolic link,but they all link with /dev/sdc1

lrwxrwxrwx  1 root root             4 Apr  9 22:11 USB_HOME -> sdc1
lrwxrwxrwx  1 root root             4 Apr  9 22:11 USB_SWAP -> sdc1

here is udev info:

  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host20/target20:0:0/20:0:0:0/block/sdc/sdc1':
    KERNEL=="sdc1"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{alignment_offset}=="0"
    ATTR{discard_alignment}=="0"
    ATTR{inflight}=="       0        0"
    ATTR{partition}=="1"
    ATTR{ro}=="0"
    ATTR{size}=="6553600"
    ATTR{start}=="2048"
    ATTR{stat}=="      58        0     4144      459        0        0        0        0        0      302      459"

  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host20/target20:0:0/20:0:0:0/block/sdc/sdc2':
    KERNEL=="sdc2"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{alignment_offset}=="0"
    ATTR{discard_alignment}=="0"
    ATTR{inflight}=="       0        0"
    ATTR{partition}=="2"
    ATTR{ro}=="0"
    ATTR{size}=="772096"
    ATTR{start}=="6555648"
    ATTR{stat}=="      86        0     5168      485        0        0        0        0        0      311      485"

Any tips? Thanks.

Last edited by AcFelis (2016-04-09 16:11:32)

Offline

#2 2016-04-09 15:22:15

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED]udev rule for usb device not working

ATTR{parition}=="2"

The correct word is "partition" wink

Offline

#3 2016-04-09 16:10:47

AcFelis
Member
Registered: 2016-04-09
Posts: 2

Re: [SOLVED]udev rule for usb device not working

brebs wrote:

ATTR{parition}=="2"

The correct word is "partition" wink

i also found the wrong value ,KERNEL=="/dev/sd[a-z][0-9]",should be "sd[a-z][0-9]" . Thanks a lot!

Offline

#4 2016-04-09 18:57:17

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED]udev rule for usb device not working

Not a Sysadmin issue, moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB