df 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-df
핵심 정리
- 파일 시스템의 전체 공간, 여유 공간, 사용률, inode 사용량, 마운트 위치를 보여 줍니다. 기본 단위는 512바이트 블록입니다.
- 자주 쓰는 형태:
df -g(GB 단위),df -m,df -k,df -g /home(그 경로의 파일 시스템),df -P(POSIX 형식, 한 줄에 하나라 스크립트용). - 기본 출력 열은
Filesystem, 블록 수,Free,%Used,Iused,%Iused,Mounted on입니다. 공간이 남아도%Iused가 100%면 파일을 더 만들 수 없습니다. - 꽉 찬 JFS2 파일 시스템은
chfs -a size=+1G /fs로 늘립니다. 어떤 파일이 공간을 쓰는지는du로 봅니다. - NFS 같은 원격 파일 시스템은 일부 값이 빈칸일 수 있고, NFSv4는
nfs4cl을 씁니다. System V판/usr/sysv/bin/df도 있습니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (두 버전의 내용이 같음) |
| 원문 | IBM Commands Reference — 5.3 Volume 2, 6.1 Volume 2 |
| 파일 | /usr/bin/df, /usr/sysv/bin/df, /etc/filesystems, /etc/vfs |
| 관련 명령어 | du, lsfs, chfs, fsck, nfs4cl |
목적
파일 시스템의 공간 정보를 보고합니다. 이 문서는 AIX df와 System V판 df를 함께 설명합니다.
영어 원문
Reports information about space on file systems. This document describes the AIX df command as well as the System V version of df.
구문
df [ [ -P ] | [ -I | -M | -i | -t | -v ] ] [ -k ] [ -m ] [ -g ] [ -s ] [ FileSystem ... | File ... ]
System V df의 구문은 아래 System V df 절에 있습니다.
설명
df 명령은 파일 시스템의 전체 공간과 쓸 수 있는 공간을 보여 줍니다. FileSystem 매개변수는 파일 시스템이 있는 장치 이름, 마운트한 디렉터리, 파일 시스템의 상대 경로 이름입니다. File 매개변수는 마운트 지점이 아닌 파일이나 디렉터리로, 주면 그 파일이 있는 파일 시스템의 정보를 보여 줍니다. 둘 다 없으면 지금 마운트한 모든 파일 시스템의 정보를 보여 줍니다. 기본 단위는 512바이트 블록입니다.
공간 통계는 statfs 시스템 호출로 얻지만, -s를 주면 VFS별 파일 시스템 도우미에서 얻습니다. -s에 인수가 없고 도우미가 통계를 얻지 못하면 statfs 값을 씁니다. df를 실행하는 동안 파일 시스템이 바뀌는 등 예외적인 경우에는 값이 정확하지 않을 수 있습니다.
참고: NFS 같은 일부 원격 파일 시스템은 df가 필요한 정보를 모두 주지 않으며, 서버가 주지 않는 값은 빈칸으로 나옵니다.
df는 NFSv4 파일 시스템을 완전히 지원하지 않습니다. 블록과 공간 정보는 nfs4cl 명령으로 봅니다.
영어 원문
The df command displays information about total space and available space on a file system. The FileSystem parameter specifies the name of the device on which the file system resides, the directory on which the file system is mounted, or the relative path name of a file system. The File parameter specifies a file or a directory that is not a mount point. If the File parameter is specified, the df command displays information for the file system on which the file or directory resides. If you do not specify the FileSystem or File parameter, the df command displays information for all currently mounted file systems. File system statistics are displayed in units of 512-byte blocks by default.
The df command gets file system space statistics from the statfs system call. However, specifying the -s flag gets the statistics from the virtual file system (VFS) specific file system helper. If you do not specify arguments with the -s flag and the helper fails to get the statistics, the statfs system call statistics are used. Under certain exceptional conditions, such as when a file system is being modified while the df command is running, the statistics displayed by the df command might not be accurate.
Note: Some remote file systems, such as the Network File System (NFS), do not provide all the information that the df command needs. The df command prints blanks for statistics that the server does not provide.
The df command does not fully support NFSv4 filesystems. Use the nfs4cl command to extract block and space information.
플래그
| 플래그 | 설명 |
|---|---|
-g |
GB 단위로 보여 줍니다. 값은 소수로 나옵니다. |
-i |
사용한 inode 수와 사용률을 보여 줍니다. 마운트한 파일 시스템이면 기본 출력입니다. |
-I |
전체 블록 수, 사용한 공간, 여유 공간, 사용률, 마운트 위치를 보여 줍니다. |
-k |
1024바이트 블록 단위로 보여 줍니다. |
-m |
MB 단위로 보여 줍니다. 값은 소수로 나옵니다. |
-M |
마운트 위치를 둘째 열에 보여 줍니다. |
-P |
POSIX 이식 형식으로 보여 줍니다. 머리글은 Filesystem 512-blocks Used Available Capacity Mounted on이며, -k, -m, -g를 함께 주면 512-blocks가 그 단위로 바뀝니다. 파일 시스템마다 한 줄에 파일 시스템, 전체, 사용, 여유, 사용률, 마운트 위치 순으로 나옵니다. |
-s |
명령줄에 준 마운트하지 않은 JFS·JFS2 파일 시스템의 통계를 보여 줍니다. 인수가 없거나, 마운트되어 있거나, 파일이면 그 인수에는 효과가 없습니다. 마운트 지점이나 장치를 주고, /etc/filesystems에 있어야 하며, 장치 읽기 권한이 필요합니다. |
-t |
할당한 전체 공간을 함께 보여 줍니다. |
-v |
지정한 파일 시스템의 모든 정보를 보여 줍니다. |
-m, -g의 값은 소수 둘째 자리로 반올림합니다. -k, -m, -g를 둘 이상 주면 마지막 것을 따릅니다.
영어 원문
-g— Displays statistics in units of GB blocks. The output values for the file system statistics would be in floating point numbers as value of each unit in bytes is significantly high.-i— Displays the number of used inodes and the percentage of inodes in use for the file system. This output is the default when the specified file system is mounted.-I— Displays information on the total number of blocks, the used space, the free space, the percentage of used space, and the mount point for the file system.-k— Displays statistics in units of 1024-byte blocks.-m— Displays statistics in units of MB blocks. The output values for the file system statistics would be in floating point numbers as value of each unit in bytes is significantly high.-M— Displays the mount point information for the file system in the second column.-P— Displays information on the file system in POSIX portable format. When the-Pflag is specified, the header line appears similar to:Filesystem 512-blocks Used Available Capacity Mounted on\nIf the-k,-mor-gflag is specified in addition to the-Pflag, the column heading 512-blocks is replaced by the respective units, depending on which of these flags is used with the-Pflag. File system statistics are displayed on one line in the following order: FileSystem, TotalSpace, UsedSpace, FreeSpace, UsedPercentage, MountPoint-s— Displays statistics on unmounted JFS or Enhanced JFS file systems by the command line arguments. If there are no arguments specified, the-sflag has no effect. If the file systems specified by the argument are currently mounted or an argument is a file, the-sflag has no effect for that particular argument. To collect statistics on unmounted file systems, an argument must be a JFS or Enhanced JFS file system mount point or device, the file system must be listed in /etc/filesystems, and the user must have read access to the device.-t— Includes figures for total allocated space in the output.-v— Displays all information for the specified file system.
The values of the output parameters with the flags -m and -g would be rounded off to nearest second decimal digit. If all or any two of the -k, -m and -g flags are specified, the last one specified takes effect.
종료 상태
| 값 | 뜻 |
|---|---|
| 0 | 성공 |
| 0보다 큼 | 오류 |
영어 원문
This command returns the following exit values:
- 0 — Successful completion.
>0— An error occurred.
예제
- 마운트한 모든 파일 시스템을 봅니다.
$ df
Filesystem 512-blocks Free %Used Iused %Iused Mounted on
/dev/hd0 19368 9976 48% 4714 5% /
/dev/hd1 24212 4808 80% 5031 19% /usr
/dev/hd2 9744 9352 4% 1900 4% /site
/dev/hd3 3868 3856 0% 986 0% /usr/venus
- 그 밖의 예:
| 명령 | 하는 일과 출력 예 |
|---|---|
df -k /test |
/test를 1024바이트 블록으로: /dev/lv11 16384 15824 4% 18 1% /tmp/ravi1 |
df -m /test |
MB 단위(소수 둘째 자리): /dev/lv11 16.00 15.46 4% 18 1% /tmp/ravi1 |
df -g /test |
GB 단위: /dev/lv11 0.02 0.02 0% 18 1% /tmp/ravi1 |
cd /; df . |
현재 디렉터리가 있는 파일 시스템: /dev/hd4 19368 9976 48% 4714 5% / |
자주 쓰는 형태:
df -g # 모든 파일 시스템(GB)
df -g | awk '$4+0 >= 90' # 사용률 90% 이상
df -i /var # inode 사용률
df -Pg | column -t # 스크립트용 POSIX 형식
영어 원문
- To display information about all mounted file systems, enter:
df
If your system has the /, /usr, /site, and /usr/venus file systems mounted, the output from the df command resembles the following: Filesystem 512-blocks Free %Used Iused %Iused Mounted on /dev/hd0 19368 9976 48% 4714 5% / /dev/hd1 24212 4808 80% 5031 19% /usr /dev/hd2 9744 9352 4% 1900 4% /site /dev/hd3 3868 3856 0% 986 0% /usr/venus
- To display information about /test file system in 1024-byte blocks, enter:
df -k /test Filesystem 1024 blocks Free %Used Iused %Iused Mounted on /dev/lv11 16384 15824 4% 18 1% /tmp/ravi1
This displays the file system statistics in 1024-byte disk blocks.
- To display information about /test file system in MB blocks, enter:
df -m /test Filesystem MB blocks Free %Used Iused %Iused Mounted on /dev/lv11 16.00 15.46 4% 18 1% /tmp/ravi1
This displays file system statistics in MB disk blocks rounded off to nearest 2nd decimal digit.
- To display information about the /test file system in GB blocks, enter:
df -g /test Filesystem GB blocks Free %Used Iused %Iused Mounted on /dev/lv11 0.02 0.02 0% 18 1% /tmp/ravi1
This displays file system statistics in GB disk blocks rounded off to nearest 2nd decimal digit.
- To display available space on the file system in which your current directory resides, enter:
cd/ df .
The output from this command resembles the following: Device 512-blocks free %used iused %iused Mounted on /dev/hd4 19368 9976 48% 4714 5% /
파일
| 파일 | 설명 |
|---|---|
/etc/filesystems |
알려진 파일 시스템과 그 특성 |
/etc/vfs |
가상 파일 시스템 유형 설명 |
영어 원문
- /etc/filesystems — Lists the known file systems and defines their characteristics.
- /etc/vfs — Contains descriptions of virtual file system types.
System V df Command
AIX에는 System V판 df가 /usr/sysv/bin/df로 따로 들어 있습니다. 출력 형식과 플래그가 AIX df와 다릅니다.
영어 원문
목적
빈 디스크 블록 수와 파일 수를 보고합니다.
영어 원문
Reports number of free disk blocks and files.
구문
/usr/sysv/bin/df [ -a ] [ -l ] [ [ [ -e ] [ -g ] [ -n ] ] | [ [ -i ] [ -v ] ] | -t ] [ FileSystem ... ] [ File ... ]
설명
df는 파일 시스템의 전체 공간과 쓸 수 있는 공간을 보여 줍니다. 단위는 512바이트 블록입니다.
영어 원문
The df command displays information about total space and available space on a file system. File system statistics are displayed in units of 512-byte blocks
플래그
| 플래그 | 설명 |
|---|---|
-a |
기본 동작으로, 마운트 위치, 장치 이름, 빈 블록 수, 사용한 inode(파일) 수를 보여 줍니다. |
-e |
빈 파일 수만 보여 줍니다. |
-g |
statvfs 구조체 전체를 보여 줍니다. -a, -e, -i, -n, -t, -v보다 우선하며, 쓸 수 있는·전체·빈 블록은 512바이트 단위입니다. |
-i |
전체 inode 수, 빈 inode 수, 사용한 inode 수, 사용률을 보여 줍니다. |
-l |
로컬 파일 시스템만 보고합니다. |
-n |
파일 시스템 유형을 보여 줍니다. |
-t |
할당한 전체 블록 수를 보고합니다. |
-v |
사용한 블록과 빈 블록 수, 사용률을 보고합니다. |
영어 원문
-a— Performs the default operation and prints the mount point, the device name, number of free blocks and number of used inodes (files).-e— Print only the number of free files.-g— Print the entire statvfs structure. This option overrides the-a,-e,-i,-n,-tand-voptions. The numbers for available, total, and free blocks are reported in 512 byte blocks.-i— Displays the total number of inodes, the number of free inodes, the number of used inodes, and the percentage of inodes in use.-l— Reports on local file systems only.-n— Prints the type of filesystem.-t— Causes total allocated block figures to be reported.-v— Reports percent of blocks used as well as the number of blocks used and free.
매개변수
| 매개변수 | 설명 |
|---|---|
| File | 마운트 지점이 아닌 파일이나 디렉터리. 주면 그 파일이 있는 파일 시스템의 정보를 보여 줍니다. |
| FileSystem | 파일 시스템이 있는 장치 이름, 마운트한 디렉터리, 파일 시스템의 상대 경로. |
둘 다 없으면 지금 마운트한 모든 파일 시스템의 정보를 보여 줍니다.
영어 원문
- File — The File parameter specifies a file or a directory that is not a mount point. If the File parameter is specified, the df command displays information for the file system on which the file or directory resides.
- FileSystem — The FileSystem parameter specifies the name of the device on which the file system resides, the directory on which the file system is mounted, or the relative path name of a file system.
- Note: If the FileSystem or File parameter is not specified, the df command displays information for all
currently mounted file systems.
종료 상태
| 값 | 뜻 |
|---|---|
| 0 | 성공 |
| 0보다 큼 | 오류 |
영어 원문
0 The command completed successfully
0 An error occurred.
예제
| 명령 | 하는 일 |
|---|---|
/usr/sysv/bin/df |
마운트한 모든 파일 시스템. 예: / (/dev/hd4 ): 19656 blocks 1504 files |
/usr/sysv/bin/df . |
현재 디렉터리가 있는 파일 시스템 |
/usr/sysv/bin/df -i |
모든 파일 시스템의 inode 사용·여유·전체·사용률. 예: / /dev/hd4 1504 6688 8192 19% |
/usr/sysv/bin/df -v /tmp |
/tmp의 전체·사용·빈 블록 수 |
/usr/sysv/bin/df -n |
파일 시스템 유형 |
/usr/sysv/bin/df -i -l |
로컬 파일 시스템의 inode 정보 |
/usr/sysv/bin/df -g |
모든 파일 시스템의 statvfs 구조체 정보 |
/usr/sysv/bin/df -e |
파일 시스템마다 빈 파일 수 |
영어 원문
- To display information about all mounted file systems, enter:
/usr/sysv/bin/df
The output looks similar to the following: / (/dev/hd4 ): 19656 blocks 1504 files /usr (/dev/hd2 ): 1139904 blocks 20254 files /var (/dev/hd9var ): 23096 blocks 512 files /tmp (/dev/hd3 ): 2464 blocks 204 files /home (/dev/hd1 ): 44208 blocks 146 files /proc (/proc ): 0 blocks 0 files /opt (/dev/hd10opt ): 13880 blocks 310 files
To display information about the file system in which your current directory resides, enter:
/usr/sysv/bin/df .To display the total number of inode, the number of free inodes and the number of available inodes in all mounted file systems, enter:
/usr/sysv/bin/df -i
The output looks similar to the following: Mount Dir Filesystem iused avail itotal %iused / /dev/hd4 1504 6688 8192 19% /usr /dev/hd2 20254 127202 147456 14% /var /dev/hd9var 512 3584 4096 13% /tmp /dev/hd3 204 5940 6144 4% /home /dev/hd1 146 14190 14336 2% /proc /proc 0 0 0 0 /opt /dev/hd10opt 310 5834 6144 6%
To display the total number of blocks , the number of used blocks and the number of free blocks on a the /tmp file system, enter:
/usr/sysv/bin/df -v /tmpTo display the type of filesystem, enter:
/usr/sysv/bin/df -nTo display inode information on all local filesystems, enter:
/usr/sysv/bin/df -i -lTo display the statvfs structure information on all the filesystems, enter:
/usr/sysv/bin/df -gTo display the number of free files on filesystems, enter:
/usr/sysv/bin/df -e
파일
| 파일 | 설명 |
|---|---|
/usr/sysv/bin/df |
System V df 명령 |
/etc/filesystems |
파일 시스템 정보 |
영어 원문
- /usr/sysv/bin/df — Contains the System V df command.
- /etc/filesystems — Contains filesystem information.
Related reference:
- fsck Command
Related information:
- filesystems file
- File systems
리눅스(GNU)와 다른 점
리눅스 df(GNU coreutils)는 기본 단위가 1KB이며 -h(사람이 읽기 쉬운 단위), -T(유형), -i(inode), -P를 씁니다. AIX df에는 -h가 없어 -g나 -m을 씁니다. 또 AIX 기본 출력은 inode 열(Iused, %Iused)을 함께 보여 주지만, GNU df는 -i를 줘야 inode를 보여 줍니다.