How to mount a removable USB drive from a script

Jacques B. jjrboucher at gmail.com
Sun Nov 26 02:29:29 UTC 2006


On 11/25/06, Jonathan Ryshpan <jonrysh at pacbell.net> wrote:
> I have a removable USB drive on my system.  When KDE starts an icon
> appears on the desktop that allows the drive to be mounted in the /media
> directory; as a side effect the directory /media/usb-disk/ is created on
> which to mount the drive.  This is done by right clicking the icon and
> clicking on the desired action in the popup menu.
>
> There must be some way to have a shell script perform the same operation
> that clicking on the icon/popup line mount makes happen.  What is it?
>
> If I create the directory /media/usb-disk and then "$
> mount /dev/sda1 /media/usb-disk", everything works fine till I unmount
> the disk, as can be done using the icon; but then an attempt to remount
> the drive by clicking on the "Open" line in the popup fails with the
> message:
>         The mount point '/media/usb-disk' is already occupied
>
> which is, of course, not correct.  I think I've filed a bug on this, but
> I have so many bugs outstanding that I'm not sure.
>
> Thanks - jon
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>
If I understand correctly, you mounted the USB device via command line
but unmounted it via the GUI?  Unless I am mistaken that is not
permitted in gnome.  I believe the last time I tried that it gave an
error saying it was mounted via command line therefore must be
unmounted the same way.  Perhaps the same applies with KDE but KDE is
failing to give that message  and thinks that it unmounted it.  Check
your mount command after unmounting via KDE to see if it really is
unmounted or if KDE mistakenly believes it to be.  Because that would
certainly cause the error you noted.  The bug would be with KDE not
properly detecting that it was mounted via the command line and
therefore must be unmounted the same way (unless KDE upon detecting
that can unmounted it appropriately.

I'm not clear what you want the script to do.  If it's simply to mount
via the command line, then you simply put what you typed at the
command line into a script (you can technically omit the #!/bin/bash
for that case).

Jacques B.




More information about the users mailing list