[xubuntu-users] Xubuntu 14.10 auto remounts a safely removed drive
Ralf Mardorf
ralf.mardorf at rocketmail.com
Fri Oct 31 08:28:39 UTC 2014
I wrote scripts to mount and unmount by label. IMO giving devices a
label is a nice way to go.
[rocketmouse at archlinux ~]$ cat /usr/local/sbin/lmount
#!/bin/sh
# /usr/local/sbin/lmount
case $1 in
-r|-w) mkdir -p /mnt/$2
if [ -e "/media/$2" ] ; then :
else
ln -s /mnt/$2 /media/$2
fi
case $1 in
-r) mount -rL$2 /mnt/$2;;
-w) mount -wL$2 /mnt/$2 -o noatime;;
esac ;;
-u) umount "$(blkid -L$2)"
rm /media/$2; rmdir /mnt/$2;;
--help|-h) echo
echo "Usage of /usr/local/sbin/lmount"
echo
echo "mount read-only"
echo " lmount -r <label>"
echo "mount read/write noatime"
echo " lmount -w <label>"
echo "unmount"
echo " lmount -u <label>"
echo ;;
esac
exit
[rocketmouse at archlinux ~]$ cat /usr/local/bin/llmount
#!/bin/sh
# /usr/local/bin/llmount
exec sudo lmount $*
While Thunar usually uses gvfs, it might be a good idea to remove gvfs,
when using green drives, because it will wake them up again and a
again and shorten the live of a green drive rapidly.
[rocketmouse at archlinux ~]$ cat /usr/local/bin/tmount #!/bin/sh
# /usr/local/bin/tmount
case $1 in
--help|-h) echo
echo "Usage of /usr/local/bin/tmount"
echo
echo "mount read-only"
echo " tmount -r <label>"
echo "mount read/write noatime"
echo " tmount -w <label>"
echo "unmount"
echo " tmount -u <label>"
echo; exit;;
-u) gksudo "lmount $*";;
*) gksudo "lmount $*"; thunar /mnt/$2; gksudo "lmount -u $2";;
esac
exit
Such a script could be used by a launcher.
Those who don't want to use the command line (or a launcher), but also
not gvfs, GUI's as e.g. rodent provide mounting and unmounting by mouse
click. For rodent it's Right click > Go > Mount Point and the available
devices are listed.
When using command line other command, resp. additional scripts for
mounting and unmounting e.g. optical devices are needed.
More information about the xubuntu-users
mailing list