df 文件磁盘使用情况

功能:

可以接受路径参数,主要是通过该路径所在的文件系统,来了解对应文件系统的磁盘使用情况.

格式:

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

df [选项]...[文件]

选项:

-a, --all include dummy file systems  // 包含所有的文件系统
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,
'-BM' prints sizes in units of 1,048,576 bytes;
see SIZE format below
--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)
-H, --si likewise, but use powers of 1000 not 1024
-i, --inodes list inode information instead of block usage
-k like --block-size=1K
-l, --local limit listing to local file systems
--no-sync do not invoke sync before getting usage info (default)
--output[=FIELD_LIST] use the output format defined by FIELD_LIST,
or print all fields if FIELD_LIST is omitted.
-P, --portability use the POSIX output format
--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

-h:控制大小的显示为易读的方式
-k控制输出的磁盘大小单位为:K

实例:

1.1 df展示

1
2
3
4
5
6
7
8
[root@localhost ~]# df
Filesystem      1K-blocks    Used Available Use% Mounted on
/dev/vda1       41151808 1797652  37240724   5% /
devtmpfs          239068       0    239068   0% /dev
tmpfs             249664       0    249664   0% /dev/shm
tmpfs             249664     436    249228   1% /run
tmpfs             249664       0    249664   0% /sys/fs/cgroup
tmpfs              49936       0     49936   0% /run/user/0 

Filesystem //文件系统的名称

1K-blocks  // blocks个数

used   // 使用的容量

Available  //可用的容量

use% //用了多少的百分比

Mounted on //挂载点

1.2 -a 选项 显示所有的文件系统

经常使用的命令有 

df -i :查看文件磁盘的 inodes号

df -h:查看文件磁盘使用的大小

df -l :只显示本地文件系统信息

df -T:显示文件系统类型

df -t:只显示指定类型的文件系统

df -x:显示指定类型外的文件系信息

df --help : 可以查看df命令可以使用的参数

一般磁盘满了有两种情况:

1. inodes号满了,2. 服务器的真实数据满了 

解决方法,参考:https://jingyan.baidu.com/article/0bc808fcbd57145bd485b9d7.html

原文地址:https://www.cnblogs.com/xianglei_/p/12173210.html