linux文件系统常用命令
1. df(disk free) 命令报告文件系统磁盘空间利用率,使用-T选项显示特定的磁盘分区的文件系统类型,-h人类可读方式显示。
[root@Qiuyuetao ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext4 19G 12G 6.3G 65% /
tmpfs tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 ext4 190M 65M 116M 36% /boot
2.fsck(file system check) 命令可以用来检测与修复文件系统,也可以输出指定磁盘分区的文件系统类型。-N 参数禁用检查文件系统错误,只是显示会做什么。
[root@Qiuyuetao ~]# fsck -N /dev/sda1
fsck from util-linux-ng 2.17.2
[/sbin/fsck.ext4 (1) -- /boot] fsck.ext4 /dev/sda1
3.lsblk (list block)命令显示块设备信息,当使用-f选项时,会打印分区的文件系统类型
[root@Qiuyuetao ~]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sr0 iso9660 CentOS 7 x86_64
sda
├─sda1 ext4 b5717723-fe1c-4add-81f2-e0015dd5753a /boot
├─sda2 ext4 9de67bcd-2282-4533-8f30-2657ed4e0f0c /
└─sda3 swap 6e49b772-f74f-4ba3-8a5c-e699cbc25053 [SWAP]
4.mount 命令是挂载文件系统用的,不带任何参数运行时,它会打印包含文件系统类型在内的磁盘分区的信息。
[root@Qiuyuetao ~]# 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)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw
5.blkid (block id) 命令用来找出或打印块设备属性。
[root@Qiuyuetao ~]# blkid
/dev/sda1: UUID="b5717723-fe1c-4add-81f2-e0015dd5753a" TYPE="ext4"
/dev/sda2: UUID="9de67bcd-2282-4533-8f30-2657ed4e0f0c" TYPE="ext4"
/dev/sda3: UUID="6e49b772-f74f-4ba3-8a5c-e699cbc25053" TYPE="swap"
6.file命令会识别文件类型,使用-s参数启用读取块设备或字符设备,-L启用符号链接跟随。
[root@Qiuyuetao ~]# file -Ls /dev/sda1
/dev/sda1: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (huge files)
7.fstab (filesystem table)文件是一个文件系统信息(比如挂载点、文件系统类型、挂载选项、开机自动挂载等等)文件
root@master:/# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/ubuntu-vg/ubuntu-lv during curtin installation
/dev/disk/by-id/dm-uuid-LVM-a5K9XoLAu0uXV6qFjsYCc7f6dBPR1uzWIjKigCdgTEDoF1Ux00QAeMglUGK87Swd / ext4 defaults,noauto 0 0
# /boot was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/2e36047b-e86c-4b95-b64f-d491c634e941 /boot ext4 defaults,noauto 0 0
##/swap.img none swap sw 0 0