Debian / コマンド / df
ディスクの使用状況を表示するファイルシステムごとに、デバイス名、全容量、使用容量、残り容量、使用割合、マウント先を表示する。
% df -k Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/sd0s1a 118959 71251 38192 65% / /dev/sd0s1f 3540086 2488705 768175 76% /usr /dev/sd0s1e 197951 19640 162475 11% /var procfs 4 4 0 100% /proc /dev/cd0c 662942 662942 0 100% /cdromオプション:
- k - 512バイト単位ではなく、1キロバイト単位で表示
- i - i-node の消費量も表示
i-node はファイルを作成するたびに必ず一つ必要となる。i-node を全て使いつくすと、ディスク容量に空きがあっても新たなファイルを作成できなくなる。iused・ifree・%iused が i-node に関わる情報で、それぞれ「使用中の i-node」「未使用の i-node」「i-node の使用率」である。
Filesystem 1K-blocks Used Avail Capacity iused ifree %iused Mounted on /dev/ad0s1a 37352396 16260170 18104036 47% 363569 4464589 8% / devfs 1 1 0 100% 0 0 100% /dev procfs 4 4 0 100% 1 0 100% /proc linprocfs 4 4 0 100% 1 0 100% /usr/compat/linux/proc
- H - 人間が読みやすい単位で表示
% df -H Filesystem Size Used Avail Capacity Mounted on /dev/ad0s1a 38G 17G 19G 47% / devfs 1.0K 1.0K 0B 100% /dev procfs 4.1K 4.1K 0B 100% /proc linprocfs 4.1K 4.1K 0B 100% /usr/compat/linux/proc
普通 df コマンドをオプションなしで実行すると、容量が 512 バイト単位で表示されてしまい わかりにくいので、上の例のように -k オプションを使うとよい。また、-k オプションの代わりに環境変数 BLOCKSIZE を設定しておく手もある。
- help (df --help)
-a, --all include filesystems having 0 blocks
--block-size=SIZE use SIZE-byte blocks
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)
-H, --si likewise, but use powers of 1000 not 1024
-i, --inodes list inode information instead of block usage
-k, --kilobytes like --block-size=1024
-l, --local limit listing to local filesystems
-m, --megabytes like --block-size=1048576
--no-sync do not invoke sync before getting usage info (default)
-P, --portability use the POSIX output format
--sync invoke sync before getting usage info
-t, --type=TYPE limit listing to filesystems of type TYPE
-T, --print-type print filesystem type
-x, --exclude-type=TYPE limit listing to filesystems not of type TYPE
-v (ignored)
--help display this help and exit
--version output version information and exit