5

Let's say I run the df command to show something about the file system(s) in my CentOS.

# df
Filesystem                      1K-blocks    Used Available Use% Mounted on
/dev/mapper/vg_centos64-lv_root  47114616 3524484  41196840   8% /
tmpfs                             1954400     232   1954168   1% /dev/shm
/dev/sda1                          495844   39901    430343   9% /boot
/dev/sr0                          4363088 4363088         0 100% /media/CentOS_6.5_Final
#

  [Transcribed from this screenshot image.]

I can see a LVM /dev/mapper/vg_centos64-lv_root mounted to /, a partition /dev/sda1 mounted to /boot, and a CDROM device /dev/sr0 mounted to /media/CentOS_6.5_Final.

And I can see them (filesystems) in Nautilus.  They look like either a file or a directory. Please see below:

Nautilus (File Browser) view of mapper directory,
showing vg_centos64-lv_root

Nautilus (File Browser) view of dev directory, showing sda1 and sr0

From my point of view, it is really confusing that blending all the things (I mean the thing like partition sda1 and the things like device sr0) into the filesystem.  And what the mount is doing looks like pointing a "file" to another "directory".  So it really looks like that the same thing has two addresses to be accessed.  Why is the Linux file system designed like this?  Please correct me if there is something wrong with what I thought.

I also want to know whether I should access from the file system or the mount point if I want, because both are pointing to the same thing.

3
  • See also unix.stackexchange.com/questions/3192/… Commented Jun 29, 2016 at 22:27
  • @Gilles Yes, I have not too much problem to understand the answer you shared with me, except one thing. for the command mount /dev/cdrom /media/cdrom. the previous device /dev/cdrom just looks exactly the same with the mount point /media/cdrom. They are both a directory or file in the linux. as I can found them in the file explorer. So how can I recognize from each other ? Let's say there is a directory or file like /dev/xxxx . Is that a device or mount point ? Any document say about this convention? Thanks.
    – Joe.wang
    Commented Jun 30, 2016 at 1:22
  • /dev/xxx is a device. It is a special file that represents some hardware (or more generally something managed by the kernel). A mount point is a directory. Using the same name for the directory and for the device is a simple way to make it clear what device is accessed through the directory. Commented Jun 30, 2016 at 5:32

1 Answer 1

2

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

More about this topic you can find at the following url: - http://ultra.pr.erau.edu/~jaffem/tutorial/file_system_basics.htm

2
  • I think to mount an address to another address looks weird. How can I recognize which one is a block device, which one is a mount point?
    – Joe.wang
    Commented Jun 29, 2016 at 9:39
  • Is there convention about to recognize which is something different from mount point?
    – Joe.wang
    Commented Jun 29, 2016 at 10:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .