LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Execute command on mount and integrate with gnome-mount / umount (http://www.linuxquestions.org/questions/linux-newbie-8/execute-command-on-mount-and-integrate-with-gnome-mount-umount-683816/)

Peter Rhone 11-16-2008 11:48 AM

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

Saptech 11-16-2008 02:14 PM

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.

Peter Rhone 11-17-2008 05:27 AM

Quote:

Originally Posted by Saptech (Post 3343988)
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?).

Saptech 11-17-2008 11:46 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.

Hope this helps some.

Peter Rhone 11-18-2008 05:28 AM

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.


All times are GMT -5. The time now is 09:38 PM.