Mount USB flash drive via command line as it would be mounted automatically after the stick pluged in under Linux

When you insert a flash stick into USB port the following happens:

  1. The file system of each USB drive partition is detected automatically
  2. Partitions are mounted automatically to a temporary path like /media/bob/7B57-DCAA with proper options
  3. The path is owned by currently logged in user (in GUI)
  4. The path is deleted automatically after umount /media/bob/7B57-DCAA command execution

Is there a simple command which does the same without having to manually create the path, to detect FS type, to mount the partition, to give proper permissions/ownership and to delete the path after umount?

UPDATE

Currently, I'm using Linux Mint 17 Qiana (Cinnamon) but other distros/window managers are also interesting.

2 Answers

This depends highly on your window manager. For gnome it is pretty easy and doesn't even need root:

# gnome-mount /dev/sdxy

Unfortunately, KDE has no helper/wrapper like gnome and invokes udisks directly, which is the way you wanna do it in KDE (root required):

# sudo udisks --mount /dev/sdxy

EDIT: gnome-mount is of course highly outdated, as it uses HAL. The new way would be to use gvfs:

# gvfs-mount -d /dev/sdxy
5

I personally use pmount for this task. You don't have to run it as root either.

sudo apt-get install pmount
pmount /dev/sdX
pumount /dev/sdX

Just seems to work.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like