df查看磁盘信息

编程

[root@CentOS7 ~]# df --help

Usage: df [OPTION]... [FILE]...

Show information about the file system on which each FILE resides,

or all file systems by default.

Mandatory arguments to long options are mandatory for short options too.

-a, --all include dummy file systems # 包含虚拟文件系统

-B, --block-size=SIZE use SIZE-byte blocks

--direct show statistics for a file instead of mount point

--total produce a grand total

-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G) # 格式化容量信息,使用m,g等单位

-H, --si likewise, but use powers of 1000 not 1024 # 参数相同,但在计算时是以1000 Bytes为换算单位而非1024 Bytes

-i, --inodes list inode information instead of block usage # 展示inode信息

-k like --block-size=1K

-l, --local limit listing to local file systems

--no-sync do not invoke sync before getting usage info (default)

-P, --portability use the POSIX output format # 使用POSIX的输出格式

--sync invoke sync before getting usage info

-t, --type=TYPE limit listing to file systems of type TYPE # 只展示指定文件系统类型的信息

-T, --print-type print file system type # 输出文件类型

-x, --exclude-type=TYPE limit listing to file systems not of type TYPE # 不展示指定文件系统类型的信息

-v (ignored)

--help display this help and exit

--version output version information and exit

Display values are in units of the first available SIZE from --block-size,

and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.

Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

SIZE may be (or may be an integer optionally followed by) one of following:

KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.

Report df bugs to bug-coreutils@gnu.org

GNU coreutils home page: <http://www.gnu.org/software/coreutils/>

General help using GNU software: <http://www.gnu.org/gethelp/>

For complete documentation, run: info coreutils "df invocation"

测试

# -h 测试

[root@CentOS7 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/centos-root 18G 1.6G 16G 9% /

devtmpfs 479M 0 479M 0% /dev

tmpfs 489M 0 489M 0% /dev/shm

tmpfs 489M 6.7M 483M 2% /run

tmpfs 489M 0 489M 0% /sys/fs/cgroup

/dev/sda1 497M 123M 375M 25% /boot

tmpfs 98M 0 98M 0% /run/user/0

# -t 测试

[root@CentOS7 ~]# df -hTP -t xfs

Filesystem Type Size Used Avail Use% Mounted on

/dev/mapper/centos-root xfs 18G 1.6G 16G 9% /

/dev/sda1 xfs 497M 123M 375M 25% /boot

# -x 测试

[root@CentOS7 ~]# df -hTP -x xfs

Filesystem Type Size Used Avail Use% Mounted on

devtmpfs devtmpfs 479M 0 479M 0% /dev

tmpfs tmpfs 489M 0 489M 0% /dev/shm

tmpfs tmpfs 489M 6.7M 483M 2% /run

tmpfs tmpfs 489M 0 489M 0% /sys/fs/cgroup

tmpfs tmpfs 98M 0 98M 0% /run/user/0

# -i 测试

[root@CentOS7 ~]# df -hi

Filesystem Inodes IUsed IFree IUse% Mounted on

/dev/mapper/centos-root 18M 30K 18M 1% /

devtmpfs 120K 382 120K 1% /dev

tmpfs 123K 1 123K 1% /dev/shm

tmpfs 123K 461 122K 1% /run

tmpfs 123K 13 123K 1% /sys/fs/cgroup

/dev/sda1 500K 330 500K 1% /boot

tmpfs 123K 1 123K 1% /run/user/0

# -a 测试

[root@CentOS7 ~]# df -ha

Filesystem Size Used Avail Use% Mounted on

rootfs - - - - /

sysfs 0 0 0 - /sys

proc 0 0 0 - /proc

devtmpfs 479M 0 479M 0% /dev

securityfs 0 0 0 - /sys/kernel/security

tmpfs 489M 0 489M 0% /dev/shm

devpts 0 0 0 - /dev/pts

tmpfs 489M 6.7M 483M 2% /run

tmpfs 489M 0 489M 0% /sys/fs/cgroup

cgroup 0 0 0 - /sys/fs/cgroup/systemd

pstore 0 0 0 - /sys/fs/pstore

cgroup 0 0 0 - /sys/fs/cgroup/cpuset

cgroup 0 0 0 - /sys/fs/cgroup/devices

cgroup 0 0 0 - /sys/fs/cgroup/cpu,cpuacct

cgroup 0 0 0 - /sys/fs/cgroup/memory

cgroup 0 0 0 - /sys/fs/cgroup/freezer

cgroup 0 0 0 - /sys/fs/cgroup/hugetlb

cgroup 0 0 0 - /sys/fs/cgroup/perf_event

cgroup 0 0 0 - /sys/fs/cgroup/blkio

cgroup 0 0 0 - /sys/fs/cgroup/net_cls

configfs 0 0 0 - /sys/kernel/config

/dev/mapper/centos-root 18G 1.6G 16G 9% /

systemd-1 - - - - /proc/sys/fs/binfmt_misc

mqueue 0 0 0 - /dev/mqueue

hugetlbfs 0 0 0 - /dev/hugepages

debugfs 0 0 0 - /sys/kernel/debug

/dev/sda1 497M 123M 375M 25% /boot

binfmt_misc 0 0 0 - /proc/sys/fs/binfmt_misc

tmpfs 98M 0 98M 0% /run/user/0

# -P 测试

[root@CentOS7 ~]# df -hP

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/centos-root 18G 1.6G 16G 9% /

devtmpfs 479M 0 479M 0% /dev

tmpfs 489M 0 489M 0% /dev/shm

tmpfs 489M 6.7M 483M 2% /run

tmpfs 489M 0 489M 0% /sys/fs/cgroup

/dev/sda1 497M 123M 375M 25% /boot

tmpfs 98M 0 98M 0% /run/user/0

以上是 df查看磁盘信息 的全部内容, 来源链接: utcz.com/z/512000.html

回到顶部