[SOLVED]How to mount using gvfs/udisks

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
thkang

[SOLVED]How to mount using gvfs/udisks

Post by thkang »

on most file managers (thunar, caja, nautilus), usually on the left pane, there are 'devices' group and 'network' group.
double-clicking an entry in any group will make that entry to be mounted.

'devices' group contains usb drives or partitions that aren't automatically mounted on boot.
they are mounted to /run/media/..
'network' group contains samba shares.
they are mounted to /run/user/USERNAME/gvfs/..

here's the question : What is the full command used by file managers to mount those drives/shares? I want to mount them as they are mounted by those file managers.
I know how to mount them with `mount` command but it requires root privilege unless I add 'user' option to an entry in /etc/fstab. And I can't add 'user' to all thumbdrives and samba shares on network.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
CaptainMark

Re: How do i mount as file manager does, in command-line?

Post by CaptainMark »

I believe the automounting on the system is handled by udisks instead of the mount command so check out "man udisks" in a terminal for some help with that, alternatively for better automatic control you should be looking at "man fstab" which is the boot mounting configuration. There are plenty of guides online for that so do a quick google and see how you get on

Quick Tip: Add the "noauto" option to a fstab line so it can be mounted by root at any time
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: How do i mount as file manager does, in command-line?

Post by altair4 »

To mount a samba share:

Code: Select all

gvfs-mount smb://server-name/share-name
To stick with the gvfs method, to mount a partition:

Code: Select all

gvfs-mount -d /dev/sdxy
But most folks mount partitions with udisks:

Code: Select all

udisks --mount /dev/sdxy
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
thkang

Re: How do i mount as file manager does, in command-line?

Post by thkang »

I did some searching on this myself. Thanks anyway for your comprehensive answers.

to mount partitions into /media/USERNAME (not /media), use udisksctl.

udisksctl mount -b /dev/sda1
udisksctl unmount -b /dev/sda1

Code: Select all

$ udisksctl mount -b /dev/sda1
Mounted /dev/sda1 at /media/thkang/xxx
$ udisksctl unmount -b /dev/sda1
Unmounted /dev/sda1.
Locked

Return to “Beginner Questions”