Ubuntu mount UFD

After upgrading Ubuntu from 8.04 to 10.04, my Ubuntu did not recognize USB flash disk (UFD) automatically any more, for some unknown reasons.

I had to mount it manually by using mount and umount commands . It’s no big deal to me but my sisters found it as an evidence of non-friendliness of Linux . Finally I came up with this simple script to mount/unmount the USB flash disks:

#!/bin/sh
## mount_unmount_usb.sh (ducquoc.vn@gmail.com) 

VOLUME_DIR="/media/external"
USB_DEVICE="/dev/sdb1"
USB_PRESENT=`ls /dev/s* | grep $USB_DEVICE`
USB_MOUNTED=`mount | grep $USB_DEVICE`

if [ "$USB_PRESENT" != "" ] && [ "$USB_MOUNTED" = "" ] ; then
  mkdir -p $VOLUME_DIR
  gksu mount $USB_DEVICE $VOLUME_DIR
  gksu nautilus $VOLUME_DIR
else
  gksu umount $VOLUME_DIR
  zenity --notification --text="USB already removed"
fi

This script can be left on desktop to run (double click), or you can assign it to the ‘open script’ when an external device is found.

If you are using KDE (KUbuntu) instead of Gnome Desktop, the script might need to be modified slightly, like using kdialog instead of zenity. Your mileage may vary , though :-) .

./.

About DucQuoc.wordpress.com

A brother, husband and father...
This entry was posted in Coding, Linux. Bookmark the permalink.

1 Response to Ubuntu mount UFD

  1. Pingback: Kubernetes Minikube Windows | DucQuoc's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s