You are not logged in.

#1 2016-10-23 19:54:27

mxfm
Member
Registered: 2015-10-23
Posts: 163

[SOLVED] Udev rule for external drive

Hi!

I am trying to create udev rule for specific usb drive following wiki. I want that particular drive to have persistent name. The drive is recognized by kernel as 'sdb', but I want to rename it to usbhdd. I have following rule:

KERNEL=="sd*", SUBSYSTEM=="scsi", ATTR{size}=="976773168", SYMLINK+="usbhdd%n"

(I decided to detect the drive by size).

Now I have /dev/usbhdd, but there are no nodes for partions, and also old sdb exists. So, how can I fix the rule and delete old sdb node?

Thanks.

Last edited by mxfm (2016-10-24 14:43:59)

Offline

#2 2016-10-23 20:30:58

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: [SOLVED] Udev rule for external drive

“SYMLINK”, as the name implies, just creates symlinks.
Except for network devices, udev does not allow the kernel name to be renamed. So you cannot delete sdb.
Your rule only works for the device and not partitions; you need to add another rule for the partitions.
Use “udevadm info -a” on the sdbX devices to get what you need to write the rule.

Offline

#3 2016-10-24 03:08:18

mxfm
Member
Registered: 2015-10-23
Posts: 163

Re: [SOLVED] Udev rule for external drive

ukhippo wrote:

“SYMLINK”, as the name implies, just creates symlinks.
Except for network devices, udev does not allow the kernel name to be renamed. So you cannot delete sdb.
Your rule only works for the device and not partitions; you need to add another rule for the partitions.
Use “udevadm info -a” on the sdbX devices to get what you need to write the rule.

Well, thanks for information. It is a pitty that deleting sdb link cannot be done.

Offline

#4 2016-10-24 03:49:01

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

Re: [SOLVED] Udev rule for external drive

Please don't use [Closed], it denotes a locked thread, use [Solved] instead.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB