第一種方法:使用df命令,例如:
orientalson:/home # dfFilesystem1K-blocksUsed Available Use% Mounted on/dev/sda2152130328043668 7169364 53% /udev514496104514392 1% /dev/dev/mapper/vg_test-lv_test51198032840479140 7% /home/mtorientalson:/home #
上面顯示的掛載點/home/mt和她掛載的卷不在同一行,使用shell腳本分析非常麻煩。
第二種方法:使用mount命令,mount-l,這種方法的缺陷在于沒有卷的大小,但是掛載點和掛載的卷在同一行。例如:
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,mode=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 #
第三種方法:查看文件/etc/mtab。原理是,每新掛載一個卷基本上都會更新這個文件的,那么自然可以通過這個文件來查看掛載點和掛職的卷。這種方法比mount-l稍微清晰了一點,但是,有時候是不可靠的。
orientalson:/home #cat /etc/mtab/dev/sda2 / reiserfs rw,acl,user_xattr 00proc /proc proc rw 0 0sysfs /sys sysfs rw 0 0debugfs /sys/kernel/debug debugfs rw 0 0udev /dev tmpfs rw 0 0devpts /dev/pts devpts rw,mode=0620,gid=5 0 0securityfs /sys/kernel/security securityfs rw 0 0/dev/mapper/vg_test-lv_test /home/mt reiserfs rw 0 0orientalson:/home #
上面已經說了基本上會更新這個文件,但是并不總是更新這個問題。如果掛載時使用了-n選項,那么/etc/mtab文件里面就不會新掛載卷的信息。
orientalson:/home # umount /home/mtorientalson:/home # mount -n /dev/vg_test/lv_test /home/mtorientalson:/home # cat /etc/mtab/dev/sda2 / reiserfs rw,acl,user_xattr 00proc /proc proc rw 0 0sysfs /sys sysfs rw 0 0debugfs /sys/kernel/debug debugfs rw 0 0udev /dev tmpfs rw 0 0devpts /dev/pts devpts rw,mode=0620,gid=5 0 0securityfs /sys/kernel/security securityfs rw 0 0orientalson:/home #
新聞熱點
疑難解答