Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mount from command line like the Nautilus does? [closed]

Tags:

linux

mount

gnome

On my Ubuntu linux box I can easily mount USB connected drives or CDROM clicking on devices icons that I can found on the Desktop.

For example if I click on a USB connected drive icon the following things happen:

  • a /media/LABEL directory is automatically created (where LABEL is the label of the disk and may vary from disk to disk)
  • the filesystem on the device is mounted on /media/LABEL

This process is significantly different from mounting using the mount command. In particular:

  • you don't need to be root (or you don't need to modify /etc/fstab to allow ordinary user to mount the device)
  • the /media/LABEL directory is automatically created
  • the name of the directory changes according the volume label.

There is a command line command that behaves like the Gnome GUI mounting facilities does?

like image 258
Andrea Francia Avatar asked Jan 27 '09 13:01

Andrea Francia


People also ask

What is Mount unmount command?

The mount command mounts a storage device or filesystem, making it accessible and attaching it to an existing directory structure. The umount command "unmounts" a mounted filesystem, informing the system to complete any pending read or write operations, and safely detaching it.

Where does Nautilus mount network shares?

It's close enough – the location is /run/user/1000/gvfs , which is a FUSE mount that exposes all virtual Gvfs mounts inside.


2 Answers

What you are looking for is gio mount (it recently replaced gvfs-mount, which replaced gnome-mount).

There is a man page here or you can just type gio help mount for the details

The basic usage is:

gio mount --list --detail to get a list of mounted and mountable volumes

gio mount [-u] <volume> to [un]mount it, e.g. gio mount smb://server/share or gio mount WINDOWS.

Sadly, there seems to be a bug that results in a "Error mounting location: volume doesn't implement mount" message trying to mount by volume name, but gvfs-mount -d /dev/<devicename> might work.

like image 150
mwx Avatar answered Sep 20 '22 22:09

mwx


In modern distributions, HAL is no longer used. The pmount still exists, but it is deprecated. Use:

udisks --mount /dev/sdXN 

Answer Update:

The udisksctl command is being used as an alternative to the udisks command. This can be used the same way, -b is just to be appended to define the block device.

udisksctl mount -b /dev/sdXN 
like image 20
noname Avatar answered Sep 20 '22 22:09

noname