You are not logged in.

#1 2016-12-27 01:40:59

FilippoFantinato
Member
Registered: 2016-12-27
Posts: 1

Writing udev rules

Hello everybody. I wanted to ask if someone was kind enough to help me write a udev rules to ensure that a determinated usb, when inserted, is mounted on a specific folder in /mnt
I've seen the guides in debian and arch regarding this site and I was able to write this

[ffantinato@ant-asus rules.d]$ cat 10-personal-rule.rules
ACTION=="add",SUBSYSTEMS=="usb",ATTRS{product}=="STORE N GO",RUN+="/bin/mkdir -p /mnt/%k",RUN+="/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /mnt/%k"

Performing this

udevadm test /sys/block/sdb

he tells me that it can not mount the block /dev/sdb, and I do not understand why the rule does not take only the block /dev/sdb1

Thanks in advance

Offline

#2 2016-12-27 01:46:49

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

Re: Writing udev rules

This is the wrong approach, for a couple fo reasons. First, RUN+= will block for long running commands, second, you can accomplish this with udiskie or one of the other automounters.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2016-12-27 10:16:11

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

Re: Writing udev rules

FilippoFantinato wrote:

I do not understand why the rule does not take only the block /dev/sdb1

Because you're filtering on the device, rather than partition 1 of the device.

Offline

Board footer

Powered by FluxBB