Merge pull request #2318 from mtunique/master

【翻译完成】20150121 Linux FAQs with Answers--How to check disk space on Linux with df command
This commit is contained in:
geekpi 2015-01-28 13:07:40 +08:00
commit d462e9c237

View File

@ -1,17 +1,16 @@
translating by mtunique
Linux FAQs with Answers--How to check disk space on Linux with df command
Linux有问必答在Linux下如何用df命令检查磁盘空间
================================================================================
> **Question**: I know I can use df command to check a file system's disk space usage on Linux. Can you show me practical examples of the df command so that I can make the most out of it?
> **问题**: 我知道在Linux上我可以用df命令来查看磁盘使用空间。你能告诉我df命令的实际例子使我可以最大限度得利用它吗
As far as disk storage is concerned, there are many command-line or GUI-based tools that can tell you about current disk space usage. These tools report on detailed disk utilization in various human-readable formats, such as easy-to-understand summary, detailed statistics, or [intuitive visualization][1]. If you simply want to know how much free disk space is available for different file systems, then df command is probably all you need.
对于磁盘存储方面有很多命令行或基于GUI的工具它可以告诉你关于当前磁盘空间的使用情况。这些工具用各种人们可读的格式展示磁盘利用率的详细信息比如易于理解的总结详细的统计信息或直观的[可视化报告][1]。如果你只想知道不同文件系统有多少空闲的磁盘空间那么df命令可能是你所需要的。
![](https://farm9.staticflickr.com/8632/15505309473_51bffec3f1_b.jpg)
The df command can report on disk utilization of any "mounted" file system. There are different ways this command can be invoked. Here are some **useful** df **command examples**.
df命令可以展示任何“mounted”文件系统的磁盘利用率。该命令可以用不同的方式调用。这里有一些**有用的** df **命令例子**.
### Display in Human-Readable Format ###
### 用人们可读的方式展示 ###
By default, the df command reports disk space in 1K blocks, which is not easily interpretable. The "-h" parameter will make df print disk space in a more human-readable format (e.g., 100K, 200M, 3G).
默认情况下df命令用1K为块来展示磁盘空间这不容易解释。“-h”参数使df用更可读的方式打印磁盘空间例如 100K200M3G
$ df -h
@ -27,9 +26,9 @@ By default, the df command reports disk space in 1K blocks, which is not easily
none 100M 48K 100M 1% /run/user
/dev/sda1 228M 98M 118M 46% /boot
### Display Inode Usage ###
### 展示Inode使用情况 ###
When you monitor disk usage, you must watch out for not only disk space, but also "inode" usage. In Linux, inode is a data structure used to store metadata of a particular file, and when a file system is created, a pre-defined number of inodes are allocated. This means that a file system can run out of space not only because big files use up all available space, but also because many small files use up all available inodes. To display inode usage, use "-i" option.
当你监视磁盘使用情况时你必须注意的不仅仅是磁盘空间还有“inode”的使用情况。在Linux中inode是用来存储特定文件的元数据的一种数据结构在创建一个文件系统时inode的预先定义数量将被分配。这意味着一个文件系统可能耗尽空间不只是因为大文件用完了所有可用空间也可能是因为很多小文件用完了所有可能的inode。用“-i”选项展示inode使用情况。
$ df -i
@ -45,10 +44,9 @@ When you monitor disk usage, you must watch out for not only disk space, but als
none 1004417 28 1004389 1% /run/user
/dev/sda1 124496 346 124150 1% /boot
### Display Disk Usage Grant Total ###
By default, the df command shows disk utilization of individual file systems. If you want to know the total disk usage over all existing file systems, add "--total" option.
### 展示磁盘总利用率 ###
默认情况下, df命令显示磁盘的单个文件系统的利用率。如果你想知道的所有文件系统的总磁盘使用量增加“ --total ”选项。
$ df -h --total
----------
@ -64,9 +62,9 @@ By default, the df command shows disk utilization of individual file systems. If
/dev/sda1 228M 98M 118M 46% /boot
total 918G 565G 307G 65% -
### Display File System Types ###
### 展示文件系统类型 ###
By default, the df command does not show file system type information. Use "-T" option to add file system types to the output.
默认情况下df命令不现实文件系统类型信息。用“-T”选项来添加文件系统信息到输出中。
$ df -T
@ -82,9 +80,9 @@ By default, the df command does not show file system type information. Use "-T"
none tmpfs 102400 48 102352 1% /run/user
/dev/sda1 ext2 233191 100025 120725 46% /boot
### Include or Exclude a Specific File System Type ###
### 包含或排除特定的文件系统类型 ###
If you want to know free space of a specific file system type, use "-t <type>" option. You can use this option multiple times to include more than one file system types.
如果你想知道特定文件系统类型的剩余空间,用“-t <type>”选项。你可以多次使用这个选项来包含更多的文件系统类型。
$ df -t ext2 -t ext4
@ -94,13 +92,13 @@ If you want to know free space of a specific file system type, use "-t <type>" o
/dev/mapper/ubuntu-root 952893348 591583380 312882756 66% /
/dev/sda1 233191 100025 120725 46% /boot
To exclude a specific file system type, use "-x <type>" option. You can use this option multiple times as well.
排除特定的文件系统类型,用“-x <type>”选项。同样,你可以用这个选项多次。
$ df -x tmpfs
### Display Disk Usage of a Specific Mount Point ###
### 显示一个具体的挂载点磁盘使用情况 ###
If you specify a mount point with df, it will report disk usage of the file system mounted at that location. If you specify a regular file (or a directory) instead of a mount point, df will display disk utilization of the file system which contains the file (or the directory).
如果你用df指定一个挂载点它将报告挂载在那个地方的文件系统的磁盘使用情况。如果你指定一个普通文件或一个目录而不是一个挂载点df将现实包含这个文件或目录的文件系统的磁盘利用率。
$ df /
@ -118,9 +116,9 @@ If you specify a mount point with df, it will report disk usage of the file syst
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/ubuntu-root 952893348 591583528 312882608 66% /
### Display Information about Dummy File Systems ###
### 现实虚拟文件系统的信息 ###
If you want to display disk space information for all existing file systems including dummy file systems, use "-a" option. Here, dummy file systems refer to pseudo file systems which do not have corresponding physical devices, e.g., tmpfs, cgroup virtual file system or FUSE file systems. These dummy filesystems have size of 0, and are not reported by df without "-a" option.
如果你想显示所有已经存在的文件系统(包括虚拟文件系统)的磁盘空间信息,用“-a”选项。这里虚拟文件系统是指没有相对应的物理设备的假的文件系统例如tmpfscgroup虚拟文件系统或FUSE文件安系统。这些虚拟文件系统大小为0不用“-a”选项将不会被报告出来。
$ df -a
@ -150,7 +148,7 @@ If you want to display disk space information for all existing file systems incl
via: http://ask.xmodulo.com/check-disk-space-linux-df-command.html
译者:[译者ID](https://github.com/译者ID)
译者:[mtunique](https://github.com/mtunique)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出