[opensuse] How to mount external drives automatically?
Hello, In opensuse-11.0, external usb drives were mounted automatically on /media/label-of-filesystem when they were plugged in. In 11.1 only a window pops up showing the "last attached devices". I would like specific drives (that is, filesystems with labels that match an expression like /^backup-\d+$/) to be mounted automatically whenever they are attached. Any hints how to configure this? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Friday 09 January 2009 03:06:49 pm Josef Wolf wrote:
Hello,
In opensuse-11.0, external usb drives were mounted automatically on /media/label-of-filesystem when they were plugged in. In 11.1 only a window pops up showing the "last attached devices".
I would like specific drives (that is, filesystems with labels that match an expression like /^backup-\d+$/) to be mounted automatically whenever they are attached. Any hints how to configure this?
It looks like KDE4 specific. When you open entry in Dolphin it will be mounted ie. it will be in /media directory. -- Regards, Rajko -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Rajko M. said the following on 01/09/2009 08:48 PM:
On Friday 09 January 2009 03:06:49 pm Josef Wolf wrote:
Hello,
In opensuse-11.0, external usb drives were mounted automatically on /media/label-of-filesystem when they were plugged in. In 11.1 only a window pops up showing the "last attached devices".
I would like specific drives (that is, filesystems with labels that match an expression like /^backup-\d+$/) to be mounted automatically whenever they are attached. Any hints how to configure this?
It looks like KDE4 specific. When you open entry in Dolphin it will be mounted ie. it will be in /media directory.
We've had this question before. Opening the entry with Dolphin (perhaps through the device notifier) is every bit as lame as running "mount" from a command line. Some applications need to work without that explicit manual intervention. Or at least the mount should be automatic when they are attached. I can think of the underlying event manager - udev? - recognising the label and triggering a backup as one very practical example. Can we PLEASE have a response to this question as asked. Its been asked before and got the lame "open it with Dolphin" response before. PLEASE! Even if the reply is only "give up on 11.1 and go back to 11.0 or 10.3". -- Life's a bitch. Then you die. Then you get re-incarnated and it starts all over again only worse. And it doesn't matter if you don't believe in reincarnation, Life's still a bitch. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Friday 09 January 2009 08:01:34 pm Anton Aylward wrote:
Rajko M. said the following on 01/09/2009 08:48 PM:
On Friday 09 January 2009 03:06:49 pm Josef Wolf wrote:
Hello,
In opensuse-11.0, external usb drives were mounted automatically on /media/label-of-filesystem when they were plugged in. In 11.1 only a window pops up showing the "last attached devices".
I would like specific drives (that is, filesystems with labels that match an expression like /^backup-\d+$/) to be mounted automatically whenever they are attached. Any hints how to configure this?
It looks like KDE4 specific. When you open entry in Dolphin it will be mounted ie. it will be in /media directory.
We've had this question before. Opening the entry with Dolphin (perhaps through the device notifier) is every bit as lame as running "mount" from a command line.
I can almost agree, because it is easier then command line, and some people don't want everything plugged in to run instantly, so to satisfy everybody it should be configurable.
Some applications need to work without that explicit manual intervention. Or at least the mount should be automatic when they are attached.
I can think of the underlying event manager - udev? - recognising the label and triggering a backup as one very practical example.
That is actually answer to the second question that I missed, for no reason. Josef, look in /etc/udev/rules.d/ . There is number of files, you can add one that will handle your USB drives. I usually use existing files as example.
Can we PLEASE have a response to this question as asked. Its been asked before and got the lame "open it with Dolphin" response before.
First question: first answer :-)
PLEASE! Even if the reply is only "give up on 11.1 and go back to 11.0 or 10.3".
That is not reply :-) -- Regards, Rajko -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Fri, Jan 09, 2009 at 09:01:34PM -0500, Anton Aylward wrote:
Rajko M. said the following on 01/09/2009 08:48 PM:
On Friday 09 January 2009 03:06:49 pm Josef Wolf wrote:
In opensuse-11.0, external usb drives were mounted automatically on /media/label-of-filesystem when they were plugged in. In 11.1 only a window pops up showing the "last attached devices".
I would like specific drives (that is, filesystems with labels that match an expression like /^backup-\d+$/) to be mounted automatically whenever they are attached. Any hints how to configure this?
It looks like KDE4 specific. When you open entry in Dolphin it will be mounted ie. it will be in /media directory.
It should work even when no desktop is installed at all.
We've had this question before. Opening the entry with Dolphin (perhaps through the device notifier) is every bit as lame as running "mount" from a command line.
Some applications need to work without that explicit manual intervention. Or at least the mount should be automatic when they are attached.
I can think of the underlying event manager - udev? - recognising the label and triggering a backup as one very practical example.
Exactly!
Can we PLEASE have a response to this question as asked. Its been asked before and got the lame "open it with Dolphin" response before.
Thanks! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello,
In the Message;
Subject : Re: [opensuse] How to mount external drives automatically?
Message-ID : <20090110065217.GB1765@raven.wolf.lan>
Date & Time: Sat, 10 Jan 2009 07:52:17 +0100
[Josef] == Josef Wolf
Am Freitag 09 Januar 2009 22:06:49 schrieb Josef Wolf:
In opensuse-11.0, external usb drives were mounted automatically on /media/label-of-filesystem when they were plugged in. In 11.1 only a window pops up showing the "last attached devices".
I would like specific drives (that is, filesystems with labels that match an expression like /^backup-\d+$/) to be mounted automatically whenever they are attached. Any hints how to configure this?
If you want to mount devices automatically, with a graphical interface, you should have a look at the package ivman. This allows the automatically mount, running of scripts and contains a halmount, you that is used internally for the mount and can be used to unmount the device from a script, too. Herbert -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Am Samstag 10 Januar 2009 18:56:09 schrieb Herbert Graeber:
Am Freitag 09 Januar 2009 22:06:49 schrieb Josef Wolf: [...]
Sorry...
If you want to mount devices automatically, with a graphical interface, you
s/with/without/
Herbert
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sat, Jan 10, 2009 at 06:56:09PM +0100, Herbert Graeber wrote:
Am Freitag 09 Januar 2009 22:06:49 schrieb Josef Wolf:
In opensuse-11.0, external usb drives were mounted automatically on /media/label-of-filesystem when they were plugged in. In 11.1 only a window pops up showing the "last attached devices".
I would like specific drives (that is, filesystems with labels that match an expression like /^backup-\d+$/) to be mounted automatically whenever they are attached. Any hints how to configure this?
If you want to mount devices automatically, with a graphical interface, you should have a look at the package ivman. This allows the automatically mount, running of scripts and contains a halmount, you that is used internally for the mount and can be used to unmount the device from a script, too.
Thanks for the hint, Herbert! I'll take a look into it. I am somewhat confused by this hal/udev topic. Isn't one of them replaced/obsoleted by the other? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Josef Wolf said the following on 01/12/2009 04:38 PM:
I am somewhat confused by this hal/udev topic. Isn't one of them replaced/obsoleted by the other?
Indeed! I was led to believe that udev had replaced all the ivman stuff. Can anyone confirm/deny this? Do we still need ivman to use things like USB? -- Psst! Viral marketing works! Tell everyone you know! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Mon, Jan 12, 2009 at 07:08:58PM -0500, Anton Aylward wrote:
Josef Wolf said the following on 01/12/2009 04:38 PM:
I am somewhat confused by this hal/udev topic. Isn't one of them replaced/obsoleted by the other?
I was led to believe that udev had replaced all the ivman stuff. Can anyone confirm/deny this? Do we still need ivman to use things like USB?
Finally, I've (almost) figured out how to do what Randall and myself want, and it turns out that all this can be done by udev directly. No ivman needed. I've put into /etc/udev/rules.d/80-my-backup-mounts.rules the following: ACTION=="add", # when device is attached KERNEL=="sd[a-z][0-9]*", # and matches this pattern PROGRAM="/lib/udev/vol_id -l %N", # retrieve filesystem label RESULT=="na-ppc-[0-9]*", # label has to match this pattern RUN+="/bin/mkdir -p /media/$result", # create mountpoint and mount RUN+="/bin/mount -orw,nodev,nosuid,noexec,noatime /dev/%k /media/$result", OPTIONS="last_rule" # abort processing All this must be a single line and comments are to be removed. All the labels of my backup drives match the regex /^na-ppc-\d+$/ and the RESULT rule makes sure that everything else is ignored by this rule. Unfortunately, udevd understands only simple shell-style globbing. Then I run "udevadm control --reload-rules" This (almost) does what we both (and maybe others?) want. The OPTIONS="last_rule" stops further processing and therefore prevents the event to be forwarded to HAL and the desktop (that is the "manually" part of Randall's question) The only problem that I could not figure out (yet) is that of the RUN array: only the last command (the mount in this case) is run. If I use RUN+="/bin/mkdir foo; /bin/mount bar baz" instead, then mkdir is run with foo;, /bin/mount, bar and baz as options. So the remaining question is: how to run multiple commands from a single udev rule? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wed, Jan 14, 2009 at 10:45:16PM +0100, Josef Wolf wrote:
Finally, I've (almost) figured out how to do what Randall and myself want, and it turns out that all this can be done by udev directly. No ivman needed.
I've put into /etc/udev/rules.d/80-my-backup-mounts.rules the following:
ACTION=="add", # when device is attached KERNEL=="sd[a-z][0-9]*", # and matches this pattern PROGRAM="/lib/udev/vol_id -l %N", # retrieve filesystem label RESULT=="na-ppc-[0-9]*", # label has to match this pattern RUN+="/bin/mkdir -p /media/$result", # create mountpoint and mount RUN+="/bin/mount -orw,nodev,nosuid,noexec,noatime /dev/%k /media/$result", OPTIONS="last_rule" # abort processing
All this must be a single line and comments are to be removed.
All the labels of my backup drives match the regex /^na-ppc-\d+$/ and the RESULT rule makes sure that everything else is ignored by this rule. Unfortunately, udevd understands only simple shell-style globbing.
Then I run "udevadm control --reload-rules"
This (almost) does what we both (and maybe others?) want. The OPTIONS="last_rule" stops further processing and therefore prevents the event to be forwarded to HAL and the desktop (that is the "manually" part of Randall's question)
The only problem that I could not figure out (yet) is that of the RUN array: only the last command (the mount in this case) is run.
I've got it now: simply duplicate the rule. The first one should contain the RUN+="mount ..." and the second should contain the run+="mount ..." But there are two more points on my wishlist: - how do I rmdir the mount point when the device is removed? This turns out to be somewhat tricky, since the device node will already be gone and vol_id won't work anymore. - Is there any possibility to automatically umount when the device is removed? Guess this would require to activate the sync mount option? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (5)
-
Anton Aylward
-
Herbert Graeber
-
Josef Wolf
-
Masaru Nomiya
-
Rajko M.