* udev RUN+=: device but no partitions
@ 2008-06-05 22:35 Dick Repasky
2008-06-06 0:04 ` Matthew Dharm
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dick Repasky @ 2008-06-05 22:35 UTC (permalink / raw)
To: linux-hotplug
If I use udev to run a script when a usb disk device appears, the device file
for the whole device is available in the script but device files for partitions
on the device are not.
Example: usb thumbdrive that appears as sdb and has one partition sdb1.
Udev entry
KERNEL="sdb", RUN+="/usr/local/sbin/check-sdb"
In check-sdb, if I run either "ls /dev/sdb*" or find /dev -name "sdb*", only
/dev/sdb appears but not /dev/sdb1. Is that behavior correct? When the same
script is run from the command-line, the partition device file appears.
My system is Ubuntu 8.04 (hardy) running udev-117-8.
Thanks,
Dick Repasky
-
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: udev RUN+=: device but no partitions
2008-06-05 22:35 udev RUN+=: device but no partitions Dick Repasky
@ 2008-06-06 0:04 ` Matthew Dharm
2008-06-06 6:12 ` Kay Sievers
2008-06-06 11:06 ` Dick Repasky
2 siblings, 0 replies; 4+ messages in thread
From: Matthew Dharm @ 2008-06-06 0:04 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 1395 bytes --]
I wonder if this could be a timing problem. The disk is discovered before
it's partitions are discovered... if your script gets called in that time
window between the two, you would get the results you describe.
Matt
On Thu, Jun 05, 2008 at 06:35:05PM -0400, Dick Repasky wrote:
>
> If I use udev to run a script when a usb disk device appears, the device file
> for the whole device is available in the script but device files for partitions
> on the device are not.
>
> Example: usb thumbdrive that appears as sdb and has one partition sdb1.
>
> Udev entry
>
> KERNEL=="sdb", RUN+="/usr/local/sbin/check-sdb"
>
> In check-sdb, if I run either "ls /dev/sdb*" or find /dev -name "sdb*", only
> /dev/sdb appears but not /dev/sdb1. Is that behavior correct? When the same
> script is run from the command-line, the partition device file appears.
>
> My system is Ubuntu 8.04 (hardy) running udev-117-8.
>
> Thanks,
>
> Dick Repasky
>
>
> -
> --
> To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Matthew Dharm Home: mdharm-usb@one-eyed-alien.net
Maintainer, Linux USB Mass Storage Driver
Way to go, lava boy.
-- Stef to Greg
User Friendly, 3/26/1998
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: udev RUN+=: device but no partitions
2008-06-05 22:35 udev RUN+=: device but no partitions Dick Repasky
2008-06-06 0:04 ` Matthew Dharm
@ 2008-06-06 6:12 ` Kay Sievers
2008-06-06 11:06 ` Dick Repasky
2 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2008-06-06 6:12 UTC (permalink / raw)
To: linux-hotplug
On Fri, Jun 6, 2008 at 12:35 AM, Dick Repasky <rrepasky@indiana.edu> wrote:
>
> If I use udev to run a script when a usb disk device appears, the device file
> for the whole device is available in the script but device files for partitions
> on the device are not.
>
> Example: usb thumbdrive that appears as sdb and has one partition sdb1.
>
> Udev entry
>
> KERNEL="sdb", RUN+="/usr/local/sbin/check-sdb"
>
> In check-sdb, if I run either "ls /dev/sdb*" or find /dev -name "sdb*", only
> /dev/sdb appears but not /dev/sdb1. Is that behavior correct? When the same
> script is run from the command-line, the partition device file appears.
You get separate events for the partitions, which you may want to hook
in, instead of expecting the partitions to be available when the disk
shows up.
In theory, the event for the disk is delayed until the partition table
is scanned and hte partitions are created. We changed that in the
kernel a while ago:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h‘d7e5dffc4844ef51fe11f497bd774c04413a00
Maybe that does not work for you for some reason.
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: udev RUN+=: device but no partitions
2008-06-05 22:35 udev RUN+=: device but no partitions Dick Repasky
2008-06-06 0:04 ` Matthew Dharm
2008-06-06 6:12 ` Kay Sievers
@ 2008-06-06 11:06 ` Dick Repasky
2 siblings, 0 replies; 4+ messages in thread
From: Dick Repasky @ 2008-06-06 11:06 UTC (permalink / raw)
To: linux-hotplug
Thanks to you all.
I've skirted the problem by inserting a delay. If my script is called
with no argument (as udev would call it) the script invokes itself in
the background with a single argument and the re-invoked script sleeps
for a second before doing anything. By the time that the script is
finished napping, the partition device files are available.
Dick Repasky
Kay Sievers wrote:
> On Fri, Jun 6, 2008 at 12:35 AM, Dick Repasky <rrepasky@indiana.edu> wrote:
>> If I use udev to run a script when a usb disk device appears, the device file
>> for the whole device is available in the script but device files for partitions
>> on the device are not.
>>
>> Example: usb thumbdrive that appears as sdb and has one partition sdb1.
>>
>> Udev entry
>>
>> KERNEL="sdb", RUN+="/usr/local/sbin/check-sdb"
>>
>> In check-sdb, if I run either "ls /dev/sdb*" or find /dev -name "sdb*", only
>> /dev/sdb appears but not /dev/sdb1. Is that behavior correct? When the same
>> script is run from the command-line, the partition device file appears.
>
> You get separate events for the partitions, which you may want to hook
> in, instead of expecting the partitions to be available when the disk
> shows up.
>
> In theory, the event for the disk is delayed until the partition table
> is scanned and hte partitions are created. We changed that in the
> kernel a while ago:
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;hÔd7e5dffc4844ef51fe11f497bd774c04413a00
> Maybe that does not work for you for some reason.
>
> Kay
--
Dick Repasky
Center for Computational Cytomics
UITS Cubicle 101.08
Indiana University
USA
rrepasky@indiana.edu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-06-06 11:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-05 22:35 udev RUN+=: device but no partitions Dick Repasky
2008-06-06 0:04 ` Matthew Dharm
2008-06-06 6:12 ` Kay Sievers
2008-06-06 11:06 ` Dick Repasky
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).