Can anyone explain the output of mount?

15,737

Solution 1

Running mount without arguments will output a list of filesystems mounted according to the table of mounted filesystems in /etc/mtab. The /etc/mtab file is typically maintained by mount and umount, although in some environments (such as live CDs) /etc/mtab may be a symlink to /proc/self/mounts.

The kernel maintains the information of mounted filesystems in the current mount namespace in /proc/[pid]/mounts. Traditionally, the Linux kernel exposed all mounts via /proc/mounts, but since the introduction of per-process mount namespaces in kernel version 2.4.19, /proc/mounts is a symlink to /proc/self/mounts. The format of these files is documented in the manual page for fstab.

Note that as /etc/mtab is maintained by user space programs, it is entirely possible for the contents of /etc/mtab and /proc/self/mounts to differ. This can occur if filesystems are mounted or unmounted directly via the mount() and umount() system calls, without going through the mount and umount programs. Differences between separate mount namespaces can also cause discrepancies between /etc/mtab and /proc/self/mounts.

Each line in the mount output is of the form:

fs_spec on fs_file type fs_vfstype (fs_mntopts)

where

  • fs_spec describes the block device or remote filesystem to be mounted.

  • fs_file describes the mount point for the filesystem.

  • fs_vfstype describes the type of the filesystem.

    A list of filesystems the current kernel supports is exposed via /proc/filesystems. Detailed documentation for each filesystem can be found in the Linux kernel tree.

  • fs_mntopts describes the mount options associated with the filesystem.

    Filesystem independent options are listed in the mount manual page. For filesystem specific options consult the kernel tree documentation for that filesystem.

Solution 2

by default the mount command displays a list of media devices currently mounted on the system.There are four pieces of information the mount command provides:

  • The device location of the media
  • The mount point in the virtual directory where the media is mounted
  • The file-system type
  • The access status of the mounted media

as in your example output of mound command in the first row:

  • /dev/sda2 is the device location
  • / is the mount point where your media is mounted
  • ext4 the file system type
  • (rw) access status which is (read and write)

there may be many other options as in other rows of your example for the forth column which you can find in detail in this atricle: http://en.wikipedia.org/wiki/Fstab

Solution 3

At first you need to know differences between Virtual Filesystems and Physical Filesystems (check google).

proc, sysfs, tmpfs,devpts, sun_rpc and gvfs-fuse-daemon are Virtual filesystems.

/dev/sda1 and /dev/sda3 are media devices: physical filesystems.

proc: proc is a Virtual filesystems for managing processes, you can see every PID and another resources.

sysfs: is another Virtual filesystem managed by the kernel; it assists proc, though not in PIDs but in hardware and another resources.

/dev/pts : on GNU/Linux, you have virtual terminals and real terminals, for real terminals you can access via: /dev/tty1, /dev/tty2, /dev/tty2 swtich via CTRL+ALT+F1..8 But for virtual terminals, you have /dev/pts/ directory, it contains /dev/pts/0, 1, 2 and so on each digit for one virtual terminal.

/dev/shm : shm is abbreviation of SHared Memory, it's a place of sharing data.

RPC : Remote Procedure call.

tmpfs : When the kernel needs space for each task, mount it type. Such as /tmp

NOTE: At first, read about Virtual filesystems then read about mounting.

Share:
15,737

Related videos on Youtube

user2720323
Author by

user2720323

Updated on September 18, 2022

Comments

  • user2720323
    user2720323 over 1 year

    I'm getting the following output when the mount command is executed.

    [root@]# mount
    /dev/sda2 on / type ext4 (rw)
    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    tmpfs on /dev/shm type tmpfs (rw)
    /dev/sda1 on /boot type ext4 (rw)
    /dev/sda3 on /home type ext4 (rw)
    none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
    sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
    gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
    

    I'm not able to understand the output of this command. Can anyone give the explanation for this output?

    • cjm
      cjm over 10 years
      It tells you what devices are mounted in what locations, and what type of filesystem it has. What exactly don't you understand?
    • user2720323
      user2720323 over 10 years
      what are the different filesystems in Linux ?
    • slm
      slm over 10 years
  • Mat
    Mat over 10 years
    "logical" filesystems isn't the usual term. "Virtual" filesystems is more common.
  • clerksx
    clerksx over 10 years
    @MohsenPahlevanzadeh That's not the meaning of "vfs" (you've invented your own, this isn't the definition used in Linux kernel development), "virtual filesystem" is the standard name for this.
  • PersianGulf
    PersianGulf over 10 years
    Ohi read wikipedia, sorry for wrong info, i updated my post.
  • Thomas Nyman
    Thomas Nyman over 10 years
    @MohsenPahlevanzadeh You should also use the term "namespace" carefully because in the context of the Linux kernel the term is heavily associated with kernel namespaces. You also mention that proc shows every PID, but it this is not strictly true since PID namespaces were introduced in 2.6.24. When certain conditions are met, proc only shows resources associated with processes in the current PID namespace.
  • PersianGulf
    PersianGulf over 10 years
    I updated......!
  • Stéphane Chazelas
    Stéphane Chazelas over 10 years
    Traditionally, and still the case on most systems, the information comes from /etc/mtab which mount/umount maintain. Some Linux distributions replace /etc/mtab with a symlink to /proc/self/mount but not all do.
  • Thomas Nyman
    Thomas Nyman over 10 years
    @StephaneChazelas Thanks for your comment. I edited the answer accordingly and added a note on the implications.
  • rpthms
    rpthms about 10 years
    The terminals accessed by CTRL+ALT+F1..F8 are not real terminals but "virtual consoles".
  • Maria
    Maria about 9 years
    ok I edited the answer :)
  • Anthon
    Anthon about 9 years
    That's much better.