Mount with hal from command line

From SlackWiki
Revision as of 05:23, 4 June 2009 by Erik (talk | contribs) (Copy from old)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Manually mounting a device using HAL from the command line

If you're like me, you probably live in the command line and prefer it way over those nasty and uncomfortable file managers. But you also live in a world were people lends you their USB sticks / Portable HDs to copy something. Then, you've probably also felt that there must be a better way to mount than the typical "dmesg|tail ; mount -t vfat,ntfs-3g what where" (and "what" tipically is /dev/sda1 and "where" might be /mnt/hd or something).

The obvious solution to make that more streamlined is to use HAL. But part of HAL's ugliness is that there are only graphical tools to work with.

Well, fortunatelly for us, XFCE comes with a little handy tool called "exo-mount" (and "exo-unmount") which does the dirty job of figuring out the HAL weird device name (another piece of HAL's ugliness), use the appropiate /usr/libexec/hal-* command (maybe via a DBUS message, I don't know) to create the mount point and mount the device as well as unmount the device and delete the mount point.

The only problem is that you must still have lots of X/Gtk/Pango/... libraries installed (so it may not be a viable choice for an X-less system, but then you're probably not running a desktop but a server and shouldn't have HAL running).

The usage is relatively simple:

 exo-mount -d /dev/sda1 # The usual "what" is /dev/sda1

and voila (if you have HAL running, that is). It should be mounted under /media/<Volume name>.

To umount:

 exo-unmount -d /dev/sda1

And that's it... You still don't have console automounting (but there are many tutorials covering that, and personally I don't like it), but you're now using HAL to do your mount/unmount.