Linux DF command View hard drive footprint

Source: Internet
Author: User
Tags readable disk usage

1. Command format:

DF [Options] [file]

2. Command function:

Displays the available space for the specified disk file. If no file name is specified, the free space for all currently mounted file systems will be displayed. By default, disk space is displayed in 1KB, unless the environment variable posixly_correct is specified, which is displayed in 512-byte units
3. Command parameters:

Necessary parameters:
-A All File system list
-h easy to read mode display
-H equals "-H," but the formula, 1k=1000, not 1k=1024
-I display inode information
-K block is 1024 bytes
-l display only local file system
-M block is 1048576 bytes
--no-sync Ignore sync command
-P output format is POSIX
--sync to perform the sync command before obtaining disk information
-T File system type

Select parameters:

--block-size=< Chunk Size > specified block size
-t< file System type > display only disk information for selected file systems
-x< file System type > do not display disk information for the selected file system
--HELP Display Help information
--version Display version Information

In the command line, enter the following command:

Df-h

You can then see the following parameters:

[Root@li411-50 ~]# Df-h
FileSystem Size Used Avail use% mounted on
/dev/xvda 47G 29G 18G 63%/
Tmpfs 499M 108K 499M 1%/DEV/SHM
[Root@li411-50 ~]#
In the above argument:/dev/xvda is the hard drive occupancy

And Tmpfs is the virtual space.


Sample

In the following example, DF displays information about all the file systems that are already mounted on the local system:
www.111cn.net@linux:~$ DF
FileSystem 1k-blocks Used Available use% mounted on
/dev/sda6 284234328 21624120 248148820 9%/
None 4 0 4 0%/sys/fs/cgroup
Udev 1944100 4 1944096 1%/dev
Tmpfs 390968 1184 389784 1%/run
None 5120 0 5120 0%/run/lock
None 1954836 22956 1931880 2%/RUN/SHM
None 102400 102348 1%/run/user
www.111cn.net@linux:~$

The following example invokes DF through the-l and-H options to generate a readable list of local file systems, in megabytes and GB.

www.111cn.net@linux:~$ df-lh
filesystem      size  Used Avail Use% Mounted on
/dev/sda6      272g  21g  237g  9%/
none             4.0k    0  4.0k  0%/sys/fs/cgroup
udev             1.9g  4.0k  1.9g  1%/dev
Tmpfs           382m  1.2m  381m  1%/run
none             5.0m    0  5.0m  0%/run/lock
none            1.9g  23M  1.9G  2%/RUN/SHM
none            100m  52K  100M  1%/run/ User
www.111cn.net@linux:~$
The following example shows the/partition information, and the partition is in megabytes (MB):

www.111cn.net@linux:~$ DF-BM/
FileSystem 1m-blocks Used Available use% mounted on
/dev/sda6 277573M 21118M 242333M 9%/
gopain@gopain:~$

Displays information about NFS file systems:

www.111cn.net@linux:~$ df-ht NFS
Df:no File Systems processed
www.111cn.net@linux:~$


Example 2: Lists the usage of the I node of each file system.

$ df-ia
FileSystem inodes iused ifree iused% mounted on
/dev/hda2 352256 75043 277213 21%/
None 0 0 0 0%/proc
localhost: (pid221) 0 0 0 0%/net

Example 3: Lists the type of file system.

$ df-t
FileSystem Type 1k-blocks Used Available use% mounted on
/dev/hda2 ext2 1361587 1246405 44824 97%/

The file system in this case is a ext2 type of

[Root@rac1 ~]# DF
FileSystem 1k-blocks Used Available use% mounted on
/DEV/SDA1 3020140 2333952 532772 82%/
None 213320 0 213320 0%/dev/shm
/dev/sda2 4633108 1818088 2579668 42%/u01
/dev/sde1 524272 81104 443168 16%/OCFS

This command shows the usage of all partitions on the server. It also includes several useful parameters to help format the output:
-a displays all partitions of the system, and does not display 0-block partitions normally by default

[Root@rac1 ~]# Df-a
FileSystem 1k-blocks Used Available use% mounted on
/DEV/SDA1 3020140 2333952 532772 82%/
None 0 0 0-//proc
None 0 0 0-/sys
None 0 0 0-/dev/pts
None 213320 0 213320 0%/dev/shm
/dev/sda2 4633108 1818096 2579660 42%/u01
None 0 0 0-/proc/sys/fs/binfmt_misc
SUNRPC 0 0 0-/var/lib/nfs/rpc_pipefs
Configfs 0 0 0-/config
Ocfs2_dlmfs 0 0 0-/DLM
/dev/sde1 524272 81104 443168 16%/OCFS
Oracleasmfs 0 0 0-/dev/oracleasm

-H more Current disk space and usage to be displayed in a more readable way

[Root@rac1 ~]# Df-h
FileSystem Size Used Avail use% mounted on
/DEV/SDA1 2.9G 2.3G 521M 82%/
None 209M 0 209M 0%/dev/shm
/dev/sda2 4.5G 1.8G 2.5G 42%/u01
/dev/sde1 512M 80M 433M 16%/OCFS

The-h parameter is the same on the H-root, but in the radical, 1000 instead of 1024 is used for capacity conversion

[Root@rac1 ~]# Df-h
FileSystem Size Used Avail use% mounted on
/DEV/SDA1 3.1G 2.4G 546M 82%/
None 219M 0 219M 0%/dev/shm
/dev/sda2 4.8G 1.9G 2.7G 42%/u01
/dev/sde1 537M 84M 454M 16%/OCFS

-K displays disk usage in units

[Root@rac1 ~]# Df-k
FileSystem 1k-blocks Used Available use% mounted on
/DEV/SDA1 3020140 2333952 532772 82%/
None 213320 0 213320 0%/dev/shm
/dev/sda2 4633108 1818152 2579604 42%/u01
/dev/sde1 524272 81104 443168 16%/OCFS

-L Displays the disk space usage of the local partition, and if the server NFS the remote server's disk, then the system displays the results after the NSF drive is filtered after DF plus-l
-I displays the usage of the inode. Linux uses a pointer-like approach to managing disk space innuendo. This is also a more critical application.

Instance

To view the system disk devices, which are in kilobytes by default:

Bash/shell code copies content to clipboard 1. [Root@linserv-1 ~]# DF

2. File system                1k-block          use      usable% mount point
  
3./dev/sda2             146294492  28244432 110498708  21%/  
4./dev/sda1              1019208      62360    904240   7%/boot  
5.tmpfs                   1032204          0   1032204   0%/dev/shm  
6./dev/sdb1             2884284108 218826068 2518944764   8%/data1  
Use the-H option to display in units above KB, with high readability:

Bash/shell code copies content to clipboard 1. [Root@linserv-1 ~]# Df-h

2. The file system capacity has been used available with% mount point
3./dev/sda2 140G 27G 106G 21%/
4./DEV/SDA1 996M 61M 884M 7%/boot
5.tmpfs 1009M 0 1009M 0%/dev/shm
6./DEV/SDB1 2.7T 209G 2.4T 8%/data1
View all file systems:

Bash/shell code copies content to clipboard 1. [Root@linserv-1 ~]# Df-a

2. The file system 1k-block has been used available with% mount points
3./dev/sda2 146294492 28244432 110498708 21%/
4.proc 0 0 0-//proc
5.sysfs 0 0 0-/sys
6.devpts 0 0 0-/dev/pts
7./DEV/SDA1 1019208 62360 904240 7%/boot
8.tmpfs 1032204 0 1032204 0%/dev/shm
9./DEV/SDB1 2884284108 218826068 2518944764 8%/data1
10.none                          0         0          0  - /proc/sys/fs/binfmt_misc

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.