How to create script to mount / unmount drive
I would like to make mounting and unmounting my USB Zip drive just a bit less baroque.
I've put an entry in /etc/fstab, but still to mount the thing requires opening a console and typing the 'mount /media/zip' 'umount /media/zip' etc What's the easiest way to automate this? A script I guess, but I can't find anything provided by Suse. Apparently something like Code:
!/bin/bash 1. So - newbie question, this - how do you get the text file recognised as a script for clicking on in KDE? 2. Also, I came across this script, which apparently works for mounting and unmounting. Does it look possible for a USB device? Code:
#!/bin/bash |
yes, the script would work just fine, just make sure that "/dev/hdd4" is your usb device's actual mount-point, otherwise you'd be mount/unmounting other devices.
|
and chmod+x the script so the system knows its allowed to run it
dont forget the # in #!/bin/bash |
Well it didn't seem to work, but that's okay as I found a much better solution - a 'script' provided by KDE in the form of the app KDiskFree, which I didn't know existed.
Let's face it, you shouldn't really need to write scripts to mount a drive anyway... Thanks for the help anyway, I did learn something for the future occasion when it really is necessary. :) |
You could always just make a desktop icon which mounts the drive when you click it.
Right-click the desktop Create New Link to device Choose fstab entry from dropdown. |
^ is there a way to do that in fedora?
|
Since the OP was using KDE, I did not specify in my reply that my suggestion was for KDE.
In FC4 (or any distro) the solution is dependent on the window manager or desktop environment. In other words, if it works it should work in all distros. That being said, FC4 uses Gnome by default (I believe) and this is a bit different. One method would be to do what was suggested above and use the disk mounter applet which will park itself on the gnome-panel. I am far more familiar with KDE than Gnome. XFCE4 seems much easier in this regard as well. The zip drive has been troublesome for some people using 2.6.X kernels in some distros in that if a disk is not in the drive (mine is an internal ide drive - paralell may differ) at boot, a device node is not created. I have seen fixes for this described in many places which involve creating a permanent device node for the drive. This appears to be a simple process, but I use 2.4.31 still and cannot tell you from experience as I do not have the problem (yet). HTH |
You could try dbus hal if they have that in suse. I installed that in slackware it worked except it caused cd ripping to take forever. I think mabye a kernel or configuration problem.
|
For FC4 - there is a user mount tool.
Launchers can be created the same way in GNOME as in KDE. The zip drive must be mentioned in /etc/fstab in order to be mounted by any user. However - FC4 is very good at autodetecting removeable media. I have not the zip drive, but my usb memory stick is detected and an icon appears on the desktop... I barely have to twitch. |
All times are GMT -5. The time now is 06:35 PM. |