Execute command on mount and integrate with gnome-mount / umount
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Execute command on mount and integrate with gnome-mount / umount
Hello I have a Western Digital Passport 250 GB USB drive (1058:0702 Western Digital Technologies, Inc. Passport External HDD). Unfortunately it is rather quirky on linux, and I haven't been able to use it since I originally purchased it a year ago (loss of data, slow transfers, etc)
I have finally traced down the problem and can now use the drive. After connecting it I have to run (as root, and assuming it has been assigned to sdb)
echo 128 >/sys/block/sdb/device/max_sectors
and finally after unmounting the drive, I have to run
sdparm --command=stop /dev/sdb.
before disconnecting it.
Now I am trying to figure out how to have this happen automatically when I mount/unmout the drive, and preferrably be integrated with gnome's (nautilus) eject system so that my girlfriend doesn't have to resort to the command line.
I've been trying various things with udev and hal but can't really figure it out.
Does anyone have an idea how to get this to work?
thanks
p.s. I'm on Ubuntu Intrepid Ibex
Last edited by Peter Rhone; 11-17-2008 at 05:30 AM.
Does Ubuntu have gnome-volume-manager installed? Are you using Gnome desktop? What file system format is it?
I have a WD 250gb My Book about two years old and has never had a problem with it mounting/unmounting automagically. I use Gnome also.
gnome-volume-manager isn't installed by default so I installed it, it doesn't seem to give me the option to run the commands I need after mounting/unmounting.
The My Book is a different creature than the passport, so it doesn't surprise me that you don't have the same issues.
In my fiddling I have managed to write a udev profile which creates a /dev/passport node, but I can't eject it from nautilus and it also doesn't seem to execute the commands I need, and I can't figure out when the 'action remove' part is being called, if at all (is this called on umount or only after I have physically pulled the usb plug from the computer?).
Last edited by Peter Rhone; 11-17-2008 at 05:29 AM.
I'm not sure how all of it works with the internals, but plugging any usb device opens up a window for the device. If I type the command to mount a device manually, an icon will appear on my desktop. If I type the unmount command, it disappears from the desktop and I can unplug the device.
yes, Saptech, that works most of the time. In fact, it works for this WD drive as well in that it is mounted automatically and the contents are displayed. Unfortunately the drive requires special attention as mentioned in my first post. I need to know how to run those special commands when the device is connected/disconnected. The automounting without those commands being run is damaging to the drive and useless.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.