Re: Mounting only inserted disks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 29, 2012 at 04:45, Kai Hendry <hendry@xxxxxxxxxxxxxxxx> wrote:
> I used some udev automounting scripts in Webconverger:
> https://wiki.archlinux.org/index.php/Udev#Auto_mounting_USB_devices

It is very wrong to recommend anything like this to users. It's just
an entirely flawed concept.

> However since users live boot Webconverger and a system that might
> already have an operating system installed like Windows, they
> surprisingly found that once they reboot back into Windows, a chkdsk
> resulted IIUC.
>
> So I've removed the offending scripts:
> http://anonscm.debian.org/gitweb/?p=debian-live/config-webc.git;a=commitdiff;h=ea18dff8af2b6800c580b70ce4219aacae9dae73;hp=65cb0929dd60e0e708e55af81f5bd91bc6173fe6
>
> Now I'm thinking is there a way to only mount disks that were
> *inserted* only once the machine has booted?

No, it is intentional, that udev rules can not distinguish between
bootup from device hotplug; they look exactly the same.

Udev's rule engine is not the right place to hookup mounting of
arbitrary filesystems, or configure non-trivial network settings like
DHCP, or start system daemons, or run any other programs that runs for
an unpredictable amount of time. Udev rules should only be used to
identify or initially configure hardware, but never to execute system
management jobs or things that involve policy or need error handling
like filesystem checking or mounting. Running such programs from udev
rules will block related events, and might render the entire system
unusable. To ensure timely event execution, udev forcefully kills all
programs it has executed from rules, and which take longer than 30 or
60 seconds to finish, and mounting and checking disks can take much
longer than that.

Udev can send events to services which can act on device changes
though. An auto-mounter service can listen to block device events and
take the appropriate actions, such a service will not block udev's
operations for an unpredictable time. Udisks and systemd for example
work like that.

Mounting filesystems is just not simple enough to do that in udev, you
need a real service to do that properly. Udev rules are just not the
right tool for the job, and very likely never will be.

Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux