Mount Point Question

All Gurus once were Newbies
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. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
User avatar
JayBird707
Level 3
Level 3
Posts: 112
Joined: Sat Jan 30, 2016 9:56 pm

Mount Point Question

Post by JayBird707 » Thu Mar 24, 2016 5:56 pm

As a new user I've been experimenting. I've been modifying my fstab to learn some things. In the process I have some empty folders where I was mounting a drive. When I'm logged in I can't delete these folders and I guess I have to switch to root to get rid of them. Can you please tell me if I’m correct. Thanks.
Dell Studio 1737 Laptop: HP6300 SFF Desktop: HP8000 USFF Desktop: Intel NUC NUC7CJYH Mini All on Linux Mint!
Image

Mute Ant
Level 14
Level 14
Posts: 5135
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: Mount Point Question

Post by Mute Ant » Thu Mar 24, 2016 6:46 pm

"I have to switch to root" Not always. If root made them, root still owns them, and you have to be root to delete them. With nothing mounted, they revert to being just a folder again.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".

ajgreeny
Level 4
Level 4
Posts: 453
Joined: Mon Nov 19, 2007 3:27 pm

Re: Mount Point Question

Post by ajgreeny » Thu Mar 24, 2016 6:51 pm

Tell us what these folders are that you can not delete as user.

Anything in your home is normally owned by that user and can be changed, edited, renamed or deleted; anything in the root filesystem will not normally be owned by you so will not be able to be changed, edited, renamed or deleted by the user but only by root, or with sudo command when using Mint.

User avatar
JayBird707
Level 3
Level 3
Posts: 112
Joined: Sat Jan 30, 2016 9:56 pm

Re: Mount Point Question

Post by JayBird707 » Fri Mar 25, 2016 1:50 pm

Thank you for waking me up. The folders are in /media/jeffrey not in /home/jeffrey so the folders belong to root.
Dell Studio 1737 Laptop: HP6300 SFF Desktop: HP8000 USFF Desktop: Intel NUC NUC7CJYH Mini All on Linux Mint!
Image

User avatar
ganamant
Level 4
Level 4
Posts: 383
Joined: Sun Mar 29, 2015 4:08 pm

Re: Mount Point Question

Post by ganamant » Fri Mar 25, 2016 2:59 pm

You can also chown (as root) the directory you are experimenting on, so your regular user can create and delete subdirectories there. You'll still have to edit /etc/fstab as root, though. Or you could back up the original /etc/fstab (e.g. to /etc/fstab.bak) and then make a soft link called /etc/fstab that points to a file that your regular user owns. If you mess anything up, and you shut yourself off from the computer, you can boot from a live CD and copy the backup back to /etc/fstab.

I always follow the rule to make a backup before I start any work on system files, and this has saved the day a few times already.

User avatar
JayBird707
Level 3
Level 3
Posts: 112
Joined: Sat Jan 30, 2016 9:56 pm

Re: Mount Point Question

Post by JayBird707 » Fri Mar 25, 2016 6:18 pm

Very ironic you mention chown. I just took an old drive and started experimenting with LVM. I found out the hard way that each lv created is root controlled and you need to chown to work with them. I'm a little confused again with regard to mount points. I created mount points for the two lv's I created. They show up in the filesystem where I put them but I thought they would appear as devices in the file manager. Am I incorrect in that assumption? Do I have to get them in fstab to show up as devices in file manager?

Oh and by the way I do have a backup fstab it was one of the first things i was playing with.
Dell Studio 1737 Laptop: HP6300 SFF Desktop: HP8000 USFF Desktop: Intel NUC NUC7CJYH Mini All on Linux Mint!
Image

User avatar
WharfRat
Level 21
Level 21
Posts: 13383
Joined: Thu Apr 07, 2011 8:15 pm

Re: Mount Point Question

Post by WharfRat » Fri Mar 25, 2016 8:49 pm

I'm probably going to confuse you further, but a mountpoint can be any linux folder. As a matter of fact your '/' file tree is a mountpoint.

There's a command line utility that will let you know if a 'folder' is a 'mountpoint'

Code: Select all

[bill@rosa] ~/script $ mountpoint /
/ is a mountpoint
[bill@rosa] ~/script $ 
As you can see / is a mountpount. It's a mountpoint by virtue of a filesystem being attached (mounted) to it.

By default /mnt is not a mountpoint

Code: Select all

[bill@rosa] ~/script $ mountpoint /mnt
/mnt is not a mountpoint
[bill@rosa] ~/script $ 
However if I attach a filesystem to it with the mount command

Code: Select all

[bill@rosa] ~/script $ sudo mount /dev/sda5 /mnt
[bill@rosa] ~/script $ mountpoint /mnt
/mnt is a mountpoint
[bill@rosa] ~/script $ 
it's now a mountpoint.

So in simplistic terms a folder is a mountpoint if a filesystem is attached (mounted) to it, otherwise it's just plain folder :wink:
ImageImage

User avatar
ganamant
Level 4
Level 4
Posts: 383
Joined: Sun Mar 29, 2015 4:08 pm

Re: Mount Point Question

Post by ganamant » Thu Mar 31, 2016 2:38 am

JayBird707 wrote:I thought they would appear as devices in the file manager. Am I incorrect in that assumption? Do I have to get them in fstab to show up as devices in file manager?
A mountpoint will not show up as a device file because it is not a device file. It is a normal directory, whether you use it as a mountpoint or not.

A partition name, such ad /dev/sda5, is a device file, on the other hand, but the mountpoint for it is not. I hope this makes sense.

You cannot cd into a device file, but you can cd into the directory where you have mounted it. And you can only mount some devices, but not others, such as /dev/random.

User avatar
LinuxJim
Level 5
Level 5
Posts: 659
Joined: Tue Jan 26, 2016 8:01 pm
Location: Oregon, USA

Re: Mount Point Question

Post by LinuxJim » Thu Mar 31, 2016 3:08 am

ganamant wrote:
JayBird707 wrote:I thought they would appear as devices in the file manager. Am I incorrect in that assumption? Do I have to get them in fstab to show up as devices in file manager?
A mountpoint will not show up as a device file because it is not a device file. It is a normal directory, whether you use it as a mountpoint or not.

A partition name, such ad /dev/sda5, is a device file, on the other hand, but the mountpoint for it is not. I hope this makes sense.

You cannot cd into a device file, but you can cd into the directory where you have mounted it. And you can only mount some devices, but not others, such as /dev/random.
To expand a bit - everything in Linux is a 'file' - and I mean everything - there are no 'devices' in the sense that other operating systems implement 'devices'. This is an important concept in Unix/Linux - that 'everything is a file'.

There is only one logical filesystem, that begins at the root '/'. Everything is found underneath it, accessed as a file - processes, memory, the kernel, hardware ports, 'devices', and regular files. The keyboard, mouse, and screen are files that can be read/written to in the filesystem. You can map a physical device (such as a disk drive) into this one logical filesystem so that it appears as a file (or set of files). It is not accessed as a separate device - it is accessed as a particular 'mount point' or folder within the logical filesystem. /dev/sda is a file that represents an entire disk drive, while /dev/sda1 is another file that represents one partition on that disk drive. Mounting /dev/sda1 allows the contents of that partition to be accessed from whatever spot in the filesystem that you decide to mount it.

File managers like Nemo and Caja confuse the issue by presenting icons for 'devices', when there is no such thing in Linux. The icons are merely aliases for a specific location in the (one) filesystem. It does make things look familiar for those coming from other operating systems, though, so your question is understandable.

Post Reply

Return to “Newbie Questions”