Three methods for viewing disk mounting in linux

Source: Internet
Author: User
This article mainly introduces three methods for viewing disk mounting in linux. For more information, see

Method 1: run the df command, for example:

Copy codeThe code is as follows:
Orientalson:/home # df
Filesystem 1K-blocks Used Available Use % Mounted on
/Dev/sda2 15213032 8043668 7169364 53%/
Udev 514496 104 514392 1%/dev
/Dev/mapper/vg_test-lv_test
511980 32840 479140 7%/home/mt
Orientalson:/home #

The Mount point/home/mt shown above is not in the same line as the volume mounted by her. it is very troublesome to use shell script for analysis.

Method 2: run the mount command, mount-l. The disadvantage of this method is that there is no volume size, but the mount point and the mounted volume are in the same row. For example:

Copy codeThe code is as follows:
Orientalson:/home # mount-l
/Dev/sda2 on/type reiserfs (rw, acl, user_xattr) []
Proc on/proc type proc (rw)
Sysfs on/sys type sysfs (rw)
Debugfs on/sys/kernel/debug type debugfs (rw)
Udev on/dev type tmpfs (rw)
Devpts on/dev/pts type devpts (rw, pattern = 0620, gid = 5)
Securityfs on/sys/kernel/security type securityfs (rw)
/Dev/mapper/vg_test-lv_test on/home/mt type reiserfs (rw) []
Orientalson:/home #

Method 3: view the file/etc/mtab. The principle is that this file is basically updated every time a new volume is mounted. you can use this file to view the mount points and mounted volumes. This method is a little clearer than mount-l, but sometimes it is unreliable.

Copy codeThe code is as follows:
Orientalson:/home # cat/etc/mtab
/Dev/sda2/reiserfs rw, acl, user_xattr 0 0
Proc/proc rw 0 0
Sysfs/sys sysfs rw 0 0
Debugfs/sys/kernel/debug debugfs rw 0 0
Udev/dev tmpfs rw 0 0
Devpts/dev/pts devpts rw, mode = 0620, gid = 5 0 0
Securityfs/sys/kernel/security securityfs rw 0 0
/Dev/mapper/vg_test-lv_test/home/mt reiserfs rw 0 0
Orientalson:/home #

As mentioned above, this file will basically be updated, but it is not always updated. If the-n option is used during mounting, the/etc/mtab file will not mount the volume information.


Copy codeThe code is as follows:
Orientalson:/home # umount/home/mt
Orientalson:/home # mount-n/dev/vg_test/lv_test/home/mt
Orientalson:/home # cat/etc/mtab
/Dev/sda2/reiserfs rw, acl, user_xattr 0 0
Proc/proc rw 0 0
Sysfs/sys sysfs rw 0 0
Debugfs/sys/kernel/debug debugfs rw 0 0
Udev/dev tmpfs rw 0 0
Devpts/dev/pts devpts rw, mode = 0620, gid = 5 0 0
Securityfs/sys/kernel/security securityfs rw 0 0
Orientalson:/home #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.