System Administration Guide: Advanced Administration

Displaying Information About Files and Disk Space

This table summarizes the commands available for displaying information about file size and disk space.

Command 

Description 

Man Page 

df

Reports the number of free disk blocks and files 

df(1M)

du

Summarizes disk space allocated to each subdirectory 

du(1)

find -size

Searches recursively through a directory based on the size specified with the -size option

find(1)

ls -lh

Lists the size of a file in the power of 1024 scaling 

ls(1)

ProcedureHow to Display Information About Files and Disk Space

  1. Display information about how disk space is used by using the df command.


    $ df [directory]  [-h] [-t]
    df

    With no options, lists all mounted file systems and their device names, the number of 512-byte blocks used, and the number of files.

    directory

    Specifies the directory whose file system you want to check.

    -h

    Displays disk space in the power of 1024 scaling.

    -t

    Displays the total blocks as well as the blocks used for all mounted file systems.


Example 6–1 Displaying Information About File Size and Disk Space

In the following example, all the file systems listed are locally mounted except for /usr/dist.


$ df
/                  (/dev/dsk/c0t0d0s0 ):  101294 blocks   105480 files
/devices           (/devices          ):       0 blocks        0 files
/system/contract   (ctfs              ):       0 blocks 2147483578 files
/proc              (proc              ):       0 blocks     1871 files
/etc/mnttab        (mnttab            ):       0 blocks        0 files
/etc/svc/volatile  (swap              ):  992704 blocks    16964 files
/system/object     (objfs             ):       0 blocks 2147483530 files
/usr               (/dev/dsk/c0t0d0s6 ):  503774 blocks   299189 files
/dev/fd            (fd                ):       0 blocks        0 files
/var/run           (swap              ):  992704 blocks    16964 files
/tmp               (swap              ):  992704 blocks    16964 files
/opt               (/dev/dsk/c0t0d0s5 ):   23914 blocks     6947 files
/export/home       (/dev/dsk/c0t0d0s7 ):   16810 blocks     7160 files


Example 6–2 Displaying File Size Information in 1024 Bytes on a System With a UFS Root File System

In the following example, file system information for a system with a UFS root file system is displayed in 1024 bytes.


$ df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0t0d0s0      249M   200M    25M    90%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   485M   376K   485M     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
/dev/dsk/c0t0d0s6      3.2G   2.9G   214M    94%    /usr
fd                       0K     0K     0K     0%    /dev/fd
swap                   485M    40K   485M     1%    /var/run
swap                   485M    40K   485M     1%    /tmp
/dev/dsk/c0t0d0s5       13M   1.7M    10M    15%    /opt
/dev/dsk/c0t0d0s7      9.2M   1.0M   7.3M    13%    /export/home

Although /proc and /tmp are local file systems, they are not UFS file systems. /proc is a PROCFS file system, /var/run and /tmp are TMPFS file systems, and /etc/mnttab is an MNTFS file system.



Example 6–3 Displaying File Size Information in 1024 Bytes on a System With a ZFS Root File System

In the following example, file system information for a system with a Oracle Solaris ZFS root file system is displayed in 1024 bytes.


Filesystem             size   used  avail capacity  Mounted on
rpool/ROOT/s1008be      67G   4.6G    58G     8%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   1.9G   1.5M   1.9G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap1.so.1
                        63G   4.6G    58G     8% /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap1.so.1
                        63G   4.6G    58G     8% /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
rpool/ROOT/s1008be/var
                        67G    73M    58G     1%    /var
swap                   1.9G    32K   1.9G     1%    /tmp
swap                   1.9G    40K   1.9G     1%    /var/run
rpool/export            67G    20K    58G     1%    /export
rpool/export/home       67G    18K    58G     1%    /export/home


Example 6–4 Displaying Total Number of Blocks and Files Allocated for a File System

The following example shows a list of all mounted file systems, device names, total 512-byte blocks used, and the number of files. The second line of each two-line entry displays the total number of blocks and files that are allocated for the file system.


$ df -t
/                  (/dev/dsk/c0t0d0s0 ):   101294 blocks   105480 files
                                  total:   509932 blocks   129024 files
/devices           (/devices          ):        0 blocks        0 files
                                  total:        0 blocks      113 files
/system/contract   (ctfs              ):        0 blocks 2147483578 files
                                  total:        0 blocks       69 files
/proc              (proc              ):        0 blocks     1871 files
                                  total:        0 blocks     1916 files
/etc/mnttab        (mnttab            ):        0 blocks        0 files
                                  total:        0 blocks        1 files
/etc/svc/volatile  (swap              ):   992608 blocks    16964 files
                                  total:   993360 blocks    17025 files
/system/object     (objfs             ):        0 blocks 2147483530 files
                                  total:        0 blocks      117 files
/usr               (/dev/dsk/c0t0d0s6 ):   503774 blocks   299189 files
                                  total:  6650604 blocks   420480 files
/dev/fd            (fd                ):        0 blocks        0 files
                                  total:        0 blocks       31 files
/var/run           (swap              ):   992608 blocks    16964 files
                                  total:   992688 blocks    17025 files
/tmp               (swap              ):   992608 blocks    16964 files
                                  total:   992688 blocks    17025 files
/opt               (/dev/dsk/c0t0d0s5 ):    23914 blocks     6947 files
                                  total:    27404 blocks     7168 files
/export/home       (/dev/dsk/c0t0d0s7 ):    16810 blocks     7160 files
                                  total:    18900 blocks     7168 files