If you have recently tried to mount a filesystem in Ubuntu Lucid or Ubuntu Maverick from the command line in a Gnome friendly way you have probably run into some trouble.  The pre-Lucid methods involved the use of gnome-mount or pmount, but both of these utilities rely on HAL (the Hardware Abstraction Layer) which has been deprecated in favor of new functionality in udev, the Linux kernel, and gvfs.

You might ask why someone wouldn’t just want to use plain old mount and fstab to handle mounting.  Mount and fstab work great for behind the scenes filesystems you never need to unplug (such as external hard drives for automatic backups), but if you like to eject/safely remove/unmount your devices from the graphical interface in Ubuntu you will be out of luck.  Also, the mount command requires superuser privileges while the graphical methods in Ubuntu do not.

The solution is apparently the new gvfs-mount command, available through the gvfs-bin package.  While documentation on this utility is scant (no manpage!), devices can be mounted by executing:

gvfs-mount -d /dev/<devicename>

Note:  When I execute this command from a terminal, I am greeted by 4 “Critical” warnings about various failures.  Surprisingly, this does not mean the command didn’t work.  Check your Desktop or /mount for your device.

This command can be executed by non-root users, and the mounting appears to be handled in exactly the same manner as the graphical method (desktop shortcut, mounting as /mount/<disk label or UUID>).  Filesystems mounted with this command can be unmounted with a right-click from the Desktop or though the side pane in Nautilus.

Unmounting from the command line can be accomplished with this command:

gvfs-mount -u /media/<disk label or UUID>

For some reason, the -d switch with the /dev/<devicename> path does not appear to work.

Hopefully you have found this helpful.  If you found this useful, or if you have some tips on using gvfs-mount, or if you have a better way of doing this, please leave me a comment!