You are not logged in.

#1 2013-12-31 03:24:42

Hurricane
Member
Registered: 2012-10-18
Posts: 77

[SOLVED]How exactly are USB drives mounted?

When I plug in a USB drive, Cinnamon brings up the device in Nemo so I can see its files. The location it's mounted at is /run/media/<username>/<long string I assume to be a UUID>/. How is it that I can mount it again at another directory and use it from there? Also, when I unmount it from the second directory, is it already safe to remove it or do I need to unmount it from the first one as well?

Last edited by Hurricane (2014-01-01 18:52:25)


Computers are extra dumb, which is why it takes extra smart people to make them work.

Offline

#2 2013-12-31 03:43:39

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: [SOLVED]How exactly are USB drives mounted?

I can't answer exactly how you're able to mount the disk in two separate places at once (that's what you seem to be implying), but I can certainly wonder why on earth you'd want or bother to.  As long as your user account owns the filesystem on the external disk, you can copy files to and from it through the /run mount point.

Offline

#3 2013-12-31 04:02:54

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,803

Re: [SOLVED]How exactly are USB drives mounted?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2013-12-31 04:27:14

D4ve
Member
Registered: 2012-08-02
Posts: 209

Re: [SOLVED]How exactly are USB drives mounted?

Haha, made my day. Nice one smile

I'm not sure, but isn't it the decision of udisks2 (or udev?) how or where it mounts the device?

Last edited by D4ve (2013-12-31 04:27:43)

Offline

#5 2013-12-31 11:26:06

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED]How exactly are USB drives mounted?

You seem to lack some understanding about your own system. If your USB devices are automounted when you plug them in, that's because you configured your system to do that. The fact that you are asking how that works should worry you IMO.

For example, my usb devices also get automounted, to /media/<device_label>. This happens because I installed udiskie, and it autoruns when I start my X session. Udiskie uses udisks, which explain why my devices are mounted under /media, and not under /run, which is used by udisks2, as D4ve mentioned. If I want to (which I definitely don't), I can also manually mount the same usb device to any other mountpoint, just like you did.

Offline

#6 2013-12-31 16:02:48

tajjada
Member
Registered: 2013-12-24
Posts: 5

Re: [SOLVED]How exactly are USB drives mounted?

You can always mount or unmount any of your disk drives with the "mount" and "umount" commands. Use "lsblk" to figure out which disk is which.

In your case, it seems that your GUI (Cinnamon or whatever) is configured to automatically mount your disk for you in the location inside /run/media. Nothing stops you from mounting and unmounting it manually as you wish, wherever you wish.

As for having the same data accessible in two different locations/mountpoints, Linux has a nice feature called bind mounts. It is the closest you can get to "mounting the same device in two different places at once".

For example, if you have a filesystem on /dev/sda2 which you want to access under both /run/media/<user>/<uuid> and, say, /mnt/MyFS, you can do the following:

# mount /dev/sda2 /run/media/<user>/<uuid>                 # or let your GUI or whatever other tool do that for you.
# mount --bind /run/media/<user>/<uuid> /mnt/MyFS

You can use the --bind option to make any data "accessible in two places at once".

Offline

#7 2013-12-31 17:30:03

xtraroot
Member
Registered: 2013-12-17
Posts: 59

Re: [SOLVED]How exactly are USB drives mounted?

If it's mounted on more than one place, you'd have to unmount it in those places if you've done file transfers and want to make sure it's safe to remove. You only mentioned one place that it's mounted though?

Last edited by xtraroot (2013-12-31 17:31:13)

Offline

#8 2014-01-01 17:08:27

nd7rmn8
Member
Registered: 2013-12-08
Posts: 9

Re: [SOLVED]How exactly are USB drives mounted?

cant you place the relevant info by uuid in your /etc/fstab, and then when it automounts, it should mount to that location specified.  twas what i did back in my ubuntu days...


i just cant stop thinking about how much smarter id be if i would have started reading years ago instead of skimming to find the answer...

tl;dr, meh

Offline

#9 2014-01-01 17:31:52

Hurricane
Member
Registered: 2012-10-18
Posts: 77

Re: [SOLVED]How exactly are USB drives mounted?

This is actually along the lines of what I was looking for, lmao.

nd7rmn8 wrote:

cant you place the relevant info by uuid in your /etc/fstab, and then when it automounts, it should mount to that location specified.  twas what i did back in my ubuntu days...

That's the way I had it on my 8.04. I remember having to set that myself though.

xtraroot wrote:

If it's mounted on more than one place, you'd have to unmount it in those places if you've done file transfers and want to make sure it's safe to remove. You only mentioned one place that it's mounted though?

I had it mounted at that default location and then I had mounted it onto ~/mnt (I recreated /mnt in my home directory)

tomk wrote:

You seem to lack some understanding about your own system. If your USB devices are automounted when you plug them in, that's because you configured your system to do that. The fact that you are asking how that works should worry you IMO.

I never configured my system to do that. When I used Arch and XFCE, I don't remember USB drives being automatically mounted. I had to do it myself. Cinnamon apparently does it automatically. What I wanted to know was why, if it does it automatically, does mount not give me an error about trying to mount the same partition again in a different place.

Thanks for your answers everybody.


Computers are extra dumb, which is why it takes extra smart people to make them work.

Offline

Board footer

Powered by FluxBB