Df commands for Linux disk management and instance usage (View disk space usage)

Source: Internet
Author: User
Tags inode usage
In linux, the df command is used to check the disk space usage of the file system of the linux server. You can use this command to obtain the disk space occupied and the remaining space.

1. command format:

Df [option] [file]

2. command functions:

Displays the available space of the specified disk file. If no file name is specified, the available space of all mounted file systems will be displayed. By default, the disk space is displayed in 1KB. unless the environment variable POSIXLY_CORRECT is specified, the disk space is displayed in 512 bytes.

3. command parameters:

Required parameters:

-A list of all file systems

-H: easy reading mode display

-H is equal to "-h", but the formula is 1 K = 1000, instead of 1 K = 1024.

-I: displays inode information.

The-k block is 1024 bytes.

-L only displays the local file system

-The m block is 1048576 bytes.

-- No-sync ignore the sync command

-P output format is POSIX

-- Sync: run the sync command before obtaining disk information.

-T file system type

Select parameters:

-- Block-size = <区块大小> Block size

-T <文件系统类型> Only display the disk information of the selected file system

-X <文件系统类型> The disk information of the selected file system is not displayed.

-- Help: displays help information.

-- Version: displays version information.

4. example:

Instance 1: displays disk usage

Command: df

Output:


Copy codeThe code is as follows:
[Root @ CT1190 log] # df
File System 1 K-block used available % mount point
/Dev/sda7 19840892 890896 17925856 5%/
/Dev/sda9 203727156 112797500 80413912 59%/opt
/Dev/sda8 4956284 570080 4130372 13%/var
/Dev/sda6 19840892 1977568 16839184 11%/usr
/Dev/sda3 988116 23880 913232 3%/boot
Tmpfs 16473212 0 16473212 0%/dev/shm

Note:

In linux, column 1st of the output list of the df command represents the path name of the device file corresponding to the file system (usually the partition on the hard disk ); column 2nd shows the number of data blocks (1024 bytes) contained in the partition. column 3 and 4 indicate the number of used and available data blocks, respectively. The user may be surprised that the sum of the blocks in column 3 and 4 is not equal to the number of blocks in column 3. This is because by default, each partition leaves a small amount of space for the system administrator to use. Even if the common user space is full, the administrator can still log on and leave the workspace required to solve the problem. The Use % column in the list indicates the percentage of space used by normal users. even if the number reaches 100%, the partition still has space for the system administrator. Finally, the Mounted on column indicates the mount point of the file system.

Instance 2: displays disk usage in inode mode

Command: df-I

Output:


Copy codeThe code is as follows:
[Root @ CT1190 log] # df-I
File system Inode (I) used (I) available (I) used % mount point
/Dev/sda7 5124480 5560 5118920 1%/
/Dev/sda9 52592640 50519 52542121 1%/opt
/Dev/sda8 1280000 8799 1271201 1%/var
/Dev/sda6 5124480 80163 5044317 2%/usr
/Dev/sda3 255232 34 255198 1%/boot
Tmpfs 4118303 1 4118302 1%/dev/shm

Note:

Instance 3: displays disks of the specified type.

Command: df-t ext3

Output:


Copy codeThe code is as follows:
[Root @ CT1190 log] # df-t ext3
File System 1 K-block used available % mount point
/Dev/sda7 19840892 890896 17925856 5%/
/Dev/sda9 203727156 93089700 100121712 49%/opt
/Dev/sda8 4956284 570104 4130348 13%/var
/Dev/sda6 19840892 1977568 16839184 11%/usr
/Dev/sda3 988116 23880 913232 3%/boot

Note:

Example 4: list the I node usage of each file system

Command: df-ia

Output:


Copy codeThe code is as follows:
[Root @ CT1190 log] # df-ia
File system Inode (I) used (I) available (I) used % mount point
/Dev/sda7 5124480 5560 5118920 1%
/Proc 0 0-/proc
Sysfs 0 0 0-/sys
Devpts 0 0 0-/dev/pts
/Dev/sda9 52592640 50519 52542121 1%/opt
/Dev/sda8 1280000 8799 1271201 1%/var
/Dev/sda6 5124480 80163 5044317 2%/usr
/Dev/sda3 255232 34 255198 1%/boot
Tmpfs 4118303 1 4118302 1%/dev/shm
None 0 0 0-/proc/sys/fs/binfmt_misc

Note:

Instance 5: list file system types

Command: df-T

Output:


Copy codeThe code is as follows:
Root @ CT1190 log] # df-T
File system type 1 K-block used available % mount point
/Dev/sda7 ext3 19840892 890896 17925856 5%/
/Dev/sda9 ext3 203727156 93175692 100035720 49%/opt
/Dev/sda8 ext3 4956284 570104 4130348 13%/var
/Dev/sda6 ext3 19840892 1977568 16839184 11%/usr
/Dev/sda3 ext3 988116 23880 913232 3%/boot
Tmpfs 16473212 0 16473212 0%/dev/shm

Note:

Instance 6: display the current disk space and usage more easily

Command: df-h

Output:


Copy codeThe code is as follows:
[Root @ CT1190 log] # df-h
File system capacity used available % mount point
// Dev/sda7 19G 871 M 18G 5%/
/Dev/sda9 195G 89G 96G 49%/opt
/Dev/sda8 4.8G 557 M 4.0G 13%/var
/Dev/sda6 19G 1.9G 17G 11%/usr
/Dev/sda3 965 M 24 M 892 M 3%/boot
Tmpfs 16G 0 16G 0%/dev/shm
[Root @ CT1190 log] # df-H
File system capacity used available % mount point
/Dev/sda7 21G 913 M 19G 5%/
/Dev/sda9 209G 96G 103G 49%/opt
/Dev/sda8 5.1G 584 M 4.3G 13%/var
/Dev/sda6 21G 2.1G 18G 11%/usr
/Dev/sda3 1.1G 25 M 936 M 3%/boot
Tmpfs 17G 0 17G 0%/dev/shm
[Root @ CT1190 log] # df-lh
File system capacity used available % mount point
// Dev/sda7 19G 871 M 18G 5%/
/Dev/sda9 195G 89G 96G 49%/opt
/Dev/sda8 4.8G 557 M 4.0G 13%/var
/Dev/sda6 19G 1.9G 17G 11%/usr
/Dev/sda3 965 M 24 M 892 M 3%/boot
Tmpfs 16G 0 16G 0%/dev/shm
[Root @ CT1190 log] # df-k
File System 1 K-block used available % mount point
/Dev/sda7 19840892 890896 17925856 5%/
/Dev/sda9 203727156 93292572 99918840 49%/opt
/Dev/sda8 4956284 570188 4130264 13%/var
/Dev/sda6 19840892 1977568 16839184 11%/usr
/Dev/sda3 988116 23880 913232 3%/boot
Tmpfs 16473212 0 16473212 0%/dev/shm

Note:

-H displays the current disk space and usage more easily.

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

-K displays disk usage in units

-L displays the disk space usage of the local partition. if the nfs server has a remote server disk, add-l to df and the system displays the results after filtering the nsf drive.

-I: displays inode usage. Linux uses a pointer-like method to manage disk space shadows. this is also a key application.

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.