Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to understand what mounting is. It is used in different contexts and situations and I can't find resources which:

  1. Describe the mount concept
  2. Explain the actions taken by the computer/OS/utility when a mount is performed
  3. How and in which situations mount is used
  4. Which features in the Linux mount command are of frequent use and some examples

( I hear mount applied to diverse entities directories, flash drives, network card, etc )

share|improve this question
1  
This is not a real question. I mean, it is so broad, to answer it one had to write an essay spanning several letter pages. Please try to state it in a way that a clear answer becomes possible. –  fschmitt Oct 18 '10 at 13:38
    
Well, you don't need to give a complete answer, maybe some pointers, insight, the common sense understanding etc, anything will do, for the clueless:) –  Vass Oct 18 '10 at 14:32
1  
This is very similar to What is meant by mounting a device in Linux?, but I suppose it asks a bit more –  Michael Mrozek Oct 18 '10 at 14:56
    
If we were to answer this question, would we be doing your homework for you? –  Craig Turner Jan 14 '11 at 20:56
    
no, its not for homework, I graduated a long time ago, look at my profile page and my webpage link to check that out. –  Vass Jan 14 '11 at 20:56
add comment

2 Answers 2

up vote 10 down vote accepted

As fschnitt points out, a comprehensive answer to this would likely be a chapter in a systems administration manual, so I'll try just to sketch the basic concepts. Ask new questions if you need more detail on specific points.

In UNIX, all files in the system are organized into a single directory tree structure (as opposed to Windows, where you have a separate directory tree for each drive).

There is a "root" directory, which is denoted by /, which corresponds to the top directory on the main drive/partition (in the Windows world, this would be C:). Any other directory and file in the system can be reached from the root, by walking down sub-directories.

How can you make other drives/partitions visible to the system in such a unique tree structure? You mount them: mounting a drive/partition on a directory (e.g., /media/usb) means that the top directory on that drive/partition becomes visible as the directory being mounted. Example: if I insert a USB stick in Windows I get a new drive, e.g., F:; if in Linux I mount it on directory /media/usb, then the top directory on the USB stick (what I would see by opening the F: drive in Windows) will be visible in Linux as directory /media/usb. In this case, the /media/usb directory is called a "mount point".

Now, drives/partitions/etc. are traditionally called "(block) devices" in the UNIX world, so you always speak of mounting a device on a directory. By abuse of language, you can just say "mount this device" or "unmount that directory".

I think I've only covered your point 1., but this could get you started for more specific questions.

Further reading: * http://ultra.pr.erau.edu/~jaffem/tutorial/file_system_basics.htm

share|improve this answer
    
so, when a flash drive is mounted into /media/usb, the OS maps commands like 'ls' from this directory to the flash drive to get the output? –  Vass Oct 18 '10 at 14:45
    
@Vass yes, that is precisely what happens. –  Riccardo Murri Oct 18 '10 at 15:16
add comment

In Unix everything is a file.

These files are organized in a tree structure, beginning at the root /.

Your filesystem or filesystems will then be mounted at the appropriate places in your / according your /etc/fstab file. This file contains information about your filesystems, which device they belong to and to which point they will get mounted to - the mountpoint.

Thats the "mount concept".

It is not limited to disks and other blockdevices, here are some examples involving mount:

  • Mount a representation of your running kernel under /proc
  • Mount a special log partition (other device, "logfriendly" filesystem) under /var/log
  • Install different systems and mount just one home directory
  • Mount remote directories for example via NFS to your system
  • Mount a image of a cd to a specific directory
share|improve this answer
    
then in the directory you mounted something too, you can 'cd' into there and see all the files? –  Vass Oct 18 '10 at 14:43
    
Yes. You can "cd into" your mountpoint and see the files :-) –  echox Oct 18 '10 at 14:48
    
can you 'mount' a directory to another directory? can you mount an input stream into a directory? what are some things other than devices you can mount? –  Vass Oct 18 '10 at 17:19
    
you can't mount a directory into another, but there are hardlinks and symlinks for that. you can't mount an input stream directly, because theres no filesystem behind an input stream. you can mount it indirectly with an appropriate kernelmodule, see the last point I mentioned (cdimage). For the last point, see my examples and FuseFS. –  echox Oct 18 '10 at 19:35
    
Kernel ----> Filesystem Module ----> Device / Application / Whatever –  echox Oct 18 '10 at 19:36
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.