linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Udev rule for external HD
@ 2009-06-01 20:55 unni krishnan
  2009-06-01 21:13 ` Greg KH
  2009-06-02  7:50 ` unni krishnan
  0 siblings, 2 replies; 3+ messages in thread
From: unni krishnan @ 2009-06-01 20:55 UTC (permalink / raw)
  To: linux-hotplug

Hello,

  I have written a udev rule to change the name of the external hard
disk to /dev/external.

SUBSYSTEM="block", SUBSYSTEMS="scsi", ATTRS{model}="ST3120827AS",
NAME="external"

The code is like the above. That works also. But the problem is that.
without that rule my device creates 2 device nodes.

1. sdb for the drive
2. sdb1 for the one partition in it.

  The mount command without the rule will show that the device sdb1 is
mounted on /media. But after adding that rule only one device node is
created at /dev/external and there is no second device like I expected
( ie /dev/external1 ). Why it is like that ? Any idea ?

  Is there anything wrong in my udev rule ?

---------------------
With regards,
Unni

"A candle loses nothing by lighting another candle"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Udev rule for external HD
  2009-06-01 20:55 Udev rule for external HD unni krishnan
@ 2009-06-01 21:13 ` Greg KH
  2009-06-02  7:50 ` unni krishnan
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2009-06-01 21:13 UTC (permalink / raw)
  To: linux-hotplug

On Tue, Jun 02, 2009 at 02:24:35AM +0530, unni krishnan wrote:
> Hello,
> 
>   I have written a udev rule to change the name of the external hard
> disk to /dev/external.
> 
> SUBSYSTEM="block", SUBSYSTEMS="scsi", ATTRS{model}="ST3120827AS",
> NAME="external"
> 
> The code is like the above. That works also. But the problem is that.
> without that rule my device creates 2 device nodes.
> 
> 1. sdb for the drive
> 2. sdb1 for the one partition in it.
> 
>   The mount command without the rule will show that the device sdb1 is
> mounted on /media. But after adding that rule only one device node is
> created at /dev/external and there is no second device like I expected
> ( ie /dev/external1 ). Why it is like that ? Any idea ?
> 
>   Is there anything wrong in my udev rule ?

You shouldn't need it at all, just use the links in /dev/disk/ instead.
You can label your partition "external" and then mount
/dev/disk/by-label/external/ just fine.

good luck,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Udev rule for external HD
  2009-06-01 20:55 Udev rule for external HD unni krishnan
  2009-06-01 21:13 ` Greg KH
@ 2009-06-02  7:50 ` unni krishnan
  1 sibling, 0 replies; 3+ messages in thread
From: unni krishnan @ 2009-06-02  7:50 UTC (permalink / raw)
  To: linux-hotplug

Hi,

  I have added the %n along with the name and fixed it. I am adding my
final rule, so that it will be useful to any other who is searching
for it ;-)

SUBSYSTEM="block", SUBSYSTEMS="scsi", ATTRS{model}="2500BEV
External", KERNEL="sd*", NAME="external%n"

Greg, thanks for the suggestion :-)

On Tue, Jun 2, 2009 at 2:43 AM, Greg KH <greg@kroah.com> wrote:
> On Tue, Jun 02, 2009 at 02:24:35AM +0530, unni krishnan wrote:
>> Hello,
>>
>>   I have written a udev rule to change the name of the external hard
>> disk to /dev/external.
>>
>> SUBSYSTEM="block", SUBSYSTEMS="scsi", ATTRS{model}="ST3120827AS",
>> NAME="external"
>>
>> The code is like the above. That works also. But the problem is that.
>> without that rule my device creates 2 device nodes.
>>
>> 1. sdb for the drive
>> 2. sdb1 for the one partition in it.
>>
>>   The mount command without the rule will show that the device sdb1 is
>> mounted on /media. But after adding that rule only one device node is
>> created at /dev/external and there is no second device like I expected
>> ( ie /dev/external1 ). Why it is like that ? Any idea ?
>>
>>   Is there anything wrong in my udev rule ?
>
> You shouldn't need it at all, just use the links in /dev/disk/ instead.
> You can label your partition "external" and then mount
> /dev/disk/by-label/external/ just fine.
>
> good luck,
>
> greg k-h
>



-- 
---------------------
With regards,
Unni

"A candle loses nothing by lighting another candle"

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-02  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-01 20:55 Udev rule for external HD unni krishnan
2009-06-01 21:13 ` Greg KH
2009-06-02  7:50 ` unni krishnan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).