From 785f7b7adeb375545dbbdc1232d02cc5ab9820af Mon Sep 17 00:00:00 2001 From: mtunique Date: Wed, 21 Jan 2015 22:26:43 +0800 Subject: [PATCH 1/3] merge origin/master --- ...Answers--How to check disk space on Linux with df command.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md b/sources/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md index ef10342238..b6595f555c 100644 --- a/sources/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md +++ b/sources/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md @@ -1,7 +1,7 @@ translating by mtunique Linux FAQs with Answers--How to check disk space on Linux with df command ================================================================================ -> **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命令来查看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? 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. From f44993845aedc2a8a27bd072d0a7e2e6fe0e1034 Mon Sep 17 00:00:00 2001 From: mtunique Date: Wed, 28 Jan 2015 00:21:35 +0800 Subject: [PATCH 2/3] translated Linux FAQs with Answers--How to check disk space on Linux with df command --- ...eck disk space on Linux with df command.md | 158 ------------------ 1 file changed, 158 deletions(-) delete mode 100644 sources/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md diff --git a/sources/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md b/sources/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md deleted file mode 100644 index b6595f555c..0000000000 --- a/sources/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md +++ /dev/null @@ -1,158 +0,0 @@ -translating by mtunique -Linux FAQs with Answers--How to check disk space on Linux with df command -================================================================================ -> **问题**: 我知道在Linux上我可以用df命令来查看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? - -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. - -![](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**. - -### 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 -h - ----------- - - Filesystem Size Used Avail Use% Mounted on - /dev/mapper/ubuntu-root 909G 565G 299G 66% / - none 4.0K 0 4.0K 0% /sys/fs/cgroup - udev 3.9G 4.0K 3.9G 1% /dev - tmpfs 785M 1.2M 784M 1% /run - none 5.0M 0 5.0M 0% /run/lock - none 3.9G 63M 3.8G 2% /run/shm - none 100M 48K 100M 1% /run/user - /dev/sda1 228M 98M 118M 46% /boot - -### Display Inode Usage ### - -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. - - $ df -i - ----------- - - Filesystem Inodes IUsed IFree IUse% Mounted on - /dev/mapper/ubuntu-root 60514304 1217535 59296769 3% / - none 1004417 13 1004404 1% /sys/fs/cgroup - udev 1000623 552 1000071 1% /dev - tmpfs 1004417 608 1003809 1% /run - none 1004417 11 1004406 1% /run/lock - none 1004417 288 1004129 1% /run/shm - 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 -h --total - ----------- - - Filesystem Size Used Avail Use% Mounted on - /dev/mapper/ubuntu-root 909G 565G 299G 66% / - none 4.0K 0 4.0K 0% /sys/fs/cgroup - udev 3.9G 4.0K 3.9G 1% /dev - tmpfs 785M 1.2M 784M 1% /run - none 5.0M 0 5.0M 0% /run/lock - none 3.9G 62M 3.8G 2% /run/shm - none 100M 48K 100M 1% /run/user - /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 - ----------- - - Filesystem Type 1K-blocks Used Available Use% Mounted on - /dev/mapper/ubuntu-root ext4 952893348 591583292 312882844 66% / - none tmpfs 4 0 4 0% /sys/fs/cgroup - udev devtmpfs 4002492 4 4002488 1% /dev - tmpfs tmpfs 803536 1196 802340 1% /run - none tmpfs 5120 0 5120 0% /run/lock - none tmpfs 4017668 60176 3957492 2% /run/shm - 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 " option. You can use this option multiple times to include more than one file system types. - - $ df -t ext2 -t ext4 - ----------- - - Filesystem 1K-blocks Used Available Use% Mounted on - /dev/mapper/ubuntu-root 952893348 591583380 312882756 66% / - /dev/sda1 233191 100025 120725 46% /boot - -To exclude a specific file system type, use "-x " option. You can use this option multiple times as well. - - $ 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 / - ----------- - - Filesystem 1K-blocks Used Available Use% Mounted on - /dev/mapper/ubuntu-root 952893348 591583528 312882608 66% / - ----------- - - $ df /home/dev - ----------- - - 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. - - $ df -a - ----------- - - Filesystem 1K-blocks Used Available Use% Mounted on - /dev/mapper/ubuntu-root 952893348 591578716 312887420 66% / - proc 0 0 0 - /proc - sysfs 0 0 0 - /sys - none 4 0 4 0% /sys/fs/cgroup - none 0 0 0 - /sys/fs/fuse/connections - none 0 0 0 - /sys/kernel/debug - none 0 0 0 - /sys/kernel/security - udev 4002492 4 4002488 1% /dev - devpts 0 0 0 - /dev/pts - tmpfs 803536 1196 802340 1% /run - none 5120 0 5120 0% /run/lock - none 4017668 58144 3959524 2% /run/shm - none 102400 48 102352 1% /run/user - none 0 0 0 - /sys/fs/pstore - cgroup 0 0 0 - /sys/fs/cgroup/cpuset - cgroup 0 0 0 - /sys/fs/cgroup/hugetlb - /dev/sda1 233191 100025 120725 46% /boot - vmware-vmblock 0 0 0 - /run/vmblock-fuse - --------------------------------------------------------------------------------- - -via: http://ask.xmodulo.com/check-disk-space-linux-df-command.html - -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://xmodulo.com/visualize-disk-usage-linux.html From 743040498a7bde86504080532f931cf31c5cd461 Mon Sep 17 00:00:00 2001 From: mtunique Date: Wed, 28 Jan 2015 00:23:25 +0800 Subject: [PATCH 3/3] move 20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md --- ...eck disk space on Linux with df command.md | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 translated/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md diff --git a/translated/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md b/translated/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md new file mode 100644 index 0000000000..6b1d65ca8b --- /dev/null +++ b/translated/tech/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md @@ -0,0 +1,156 @@ +Linux有问必答:在Linux下如何用df命令检查磁盘空间? +================================================================================ +> **问题**: 我知道在Linux上我可以用df命令来查看磁盘使用空间。你能告诉我df命令的实际例子使我可以最大限度得利用它吗? + +对于磁盘存储方面,有很多命令行或基于GUI的工具,它可以告诉你关于当前磁盘空间的使用情况。这些工具用各种人们可读的格式展示磁盘利用率的详细信息,比如易于理解的总结,详细的统计信息或直观的[可视化报告][1]。如果你只想知道不同文件系统有多少空闲的磁盘空间,那么df命令可能是你所需要的。 + +![](https://farm9.staticflickr.com/8632/15505309473_51bffec3f1_b.jpg) + +df命令可以展示任何“mounted”文件系统的磁盘利用率。该命令可以用不同的方式调用。这里有一些**有用的** df **命令例子**. + +### 用人们可读的方式展示 ### + +默认情况下,df命令用1K为块来展示磁盘空间,这不容易解释。“-h”参数使df用更可读的方式打印磁盘空间(例如 100K,200M,3G)。 + + $ df -h + +---------- + + Filesystem Size Used Avail Use% Mounted on + /dev/mapper/ubuntu-root 909G 565G 299G 66% / + none 4.0K 0 4.0K 0% /sys/fs/cgroup + udev 3.9G 4.0K 3.9G 1% /dev + tmpfs 785M 1.2M 784M 1% /run + none 5.0M 0 5.0M 0% /run/lock + none 3.9G 63M 3.8G 2% /run/shm + none 100M 48K 100M 1% /run/user + /dev/sda1 228M 98M 118M 46% /boot + +### 展示Inode使用情况 ### + +当你监视磁盘使用情况时,你必须注意的不仅仅是磁盘空间还有“inode”的使用情况。在Linux中,inode是用来存储特定文件的元数据的一种数据结构,在创建一个文件系统时,inode的预先定义数量将被分配。这意味着,一个文件系统可能耗尽空间不只是因为大文件用完了所有可用空间,也可能是因为很多小文件用完了所有可能的inode。用“-i”选项展示inode使用情况。 + + $ df -i + +---------- + + Filesystem Inodes IUsed IFree IUse% Mounted on + /dev/mapper/ubuntu-root 60514304 1217535 59296769 3% / + none 1004417 13 1004404 1% /sys/fs/cgroup + udev 1000623 552 1000071 1% /dev + tmpfs 1004417 608 1003809 1% /run + none 1004417 11 1004406 1% /run/lock + none 1004417 288 1004129 1% /run/shm + none 1004417 28 1004389 1% /run/user + /dev/sda1 124496 346 124150 1% /boot + +### 展示磁盘总利用率 ### + +默认情况下, df命令显示磁盘的单个文件系统的利用率。如果你想知道的所有文件系统的总磁盘使用量,增加“ --total ”选项。 + $ df -h --total + +---------- + + Filesystem Size Used Avail Use% Mounted on + /dev/mapper/ubuntu-root 909G 565G 299G 66% / + none 4.0K 0 4.0K 0% /sys/fs/cgroup + udev 3.9G 4.0K 3.9G 1% /dev + tmpfs 785M 1.2M 784M 1% /run + none 5.0M 0 5.0M 0% /run/lock + none 3.9G 62M 3.8G 2% /run/shm + none 100M 48K 100M 1% /run/user + /dev/sda1 228M 98M 118M 46% /boot + total 918G 565G 307G 65% - + +### 展示文件系统类型 ### + +默认情况下,df命令不现实文件系统类型信息。用“-T”选项来添加文件系统信息到输出中。 + + $ df -T + +---------- + + Filesystem Type 1K-blocks Used Available Use% Mounted on + /dev/mapper/ubuntu-root ext4 952893348 591583292 312882844 66% / + none tmpfs 4 0 4 0% /sys/fs/cgroup + udev devtmpfs 4002492 4 4002488 1% /dev + tmpfs tmpfs 803536 1196 802340 1% /run + none tmpfs 5120 0 5120 0% /run/lock + none tmpfs 4017668 60176 3957492 2% /run/shm + none tmpfs 102400 48 102352 1% /run/user + /dev/sda1 ext2 233191 100025 120725 46% /boot + +### 包含或排除特定的文件系统类型 ### + +如果你想知道特定文件系统类型的剩余空间,用“-t ”选项。你可以多次使用这个选项来包含更多的文件系统类型。 + + $ df -t ext2 -t ext4 + +---------- + + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/ubuntu-root 952893348 591583380 312882756 66% / + /dev/sda1 233191 100025 120725 46% /boot + +排除特定的文件系统类型,用“-x ”选项。同样,你可以用这个选项多次。 + + $ df -x tmpfs + +### 显示一个具体的挂载点磁盘使用情况 ### + +如果你用df指定一个挂载点,它将报告挂载在那个地方的文件系统的磁盘使用情况。如果你指定一个普通文件(或一个目录)而不是一个挂载点,df将现实包含这个文件(或目录)的文件系统的磁盘利用率。 + + $ df / + +---------- + + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/ubuntu-root 952893348 591583528 312882608 66% / + +---------- + + $ df /home/dev + +---------- + + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/ubuntu-root 952893348 591583528 312882608 66% / + +### 现实虚拟文件系统的信息 ### + +如果你想显示所有已经存在的文件系统(包括虚拟文件系统)的磁盘空间信息,用“-a”选项。这里,虚拟文件系统是指没有相对应的物理设备的假的文件系统,例如,tmpfs,cgroup虚拟文件系统或FUSE文件安系统。这些虚拟文件系统大小为0,不用“-a”选项将不会被报告出来。 + + $ df -a + +---------- + + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/ubuntu-root 952893348 591578716 312887420 66% / + proc 0 0 0 - /proc + sysfs 0 0 0 - /sys + none 4 0 4 0% /sys/fs/cgroup + none 0 0 0 - /sys/fs/fuse/connections + none 0 0 0 - /sys/kernel/debug + none 0 0 0 - /sys/kernel/security + udev 4002492 4 4002488 1% /dev + devpts 0 0 0 - /dev/pts + tmpfs 803536 1196 802340 1% /run + none 5120 0 5120 0% /run/lock + none 4017668 58144 3959524 2% /run/shm + none 102400 48 102352 1% /run/user + none 0 0 0 - /sys/fs/pstore + cgroup 0 0 0 - /sys/fs/cgroup/cpuset + cgroup 0 0 0 - /sys/fs/cgroup/hugetlb + /dev/sda1 233191 100025 120725 46% /boot + vmware-vmblock 0 0 0 - /run/vmblock-fuse + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/check-disk-space-linux-df-command.html + +译者:[mtunique](https://github.com/mtunique) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://xmodulo.com/visualize-disk-usage-linux.html