di(1)

Name
di - disk information

Synopsis
di [-AacghHjklLmnPqRtZ] [-B block-size] [-d display-size] [-f format] [-I include-fstyp-list] [-s sort-type] [-x exclude-fstyp-list] [-X debug-level] [-z zone-name] [file [...]]

If file is specified, the usage information for the partition on which file is located is printed.

Unless the -a flag is specified, the following mounted filesystems will not normally be displayed: filesystems with total space <= 0; loopback filesystems that are duplicates of other normally mounted filesystems (filesystem type of 'lofs', 'none', or 'nullfs'); loopback filesystems that are part of a zone (Solaris); filesystems for which the system's ignore flag is set; filesystems that have a device name of 'tmpfs', 'cgroup' or 'swap'; filesystems that have a device name starting with '/System/' or 'com.apple.TimeMachine.' (both MacOS).

Filesystems that the user does not have permissions to access will not be displayed at all.

Several options may be specified to control the output of di:

-A  Print all fields (used for debugging).

-a  (compatibility: --all)
    Prints all mounted devices (normally, those with a total space of zero are not printed e.g. /dev/proc, /dev/fd).

-B  block-size (compatibility: --block-size, -b)
    Change the base block size from 1024 (default) to the size specified. block-size may be either: k - 1024 bytes or si - 1000 bytes.

    Use the -d option to change the display size.

    block-size may be specified in the same manner as the BLOCK_SIZE environment variable, and will set both the block size and the display size.

-c  (alias: --csv-output)
    Comma separated values are output. The titles are output as the format string specifiers. Totals are turned off. See also the -n flag.

-C  (alias: --csv-tabs)
    Values are output with tab separators. See also the -c option.

-d  display-size (alias: --display-size)
    Display the usage in units specified by display-size. The display size is calculated based on the block size (-B). display-size may be one of: k - kilobytes (POSIX), m - megabytes, g - gigabytes, t - terabytes, p - petabytes, e - exabytes, z - zettabytes, y - yottabytes, r - ronnabytes, q - quettabytes, h - human readable, H - human readable alternative.

    The human readable format scales the sizes displayed and appends a suffix (e.g. 48.0k, 3.4M). Sizes within a line may scale to different units.

    The human readable alternative scales all the sizes in each individual line to the same unit size (the largest needed).

    If di is compiled without multi-precision support, the larger units may not work correctly or may be inaccurate.

-f  format Use the specified format string format. See the Format Strings section.

-g  (alias for: -dg)
    Display sizes in gigabytes.

-h  (alias for: -dh)
    Display partition sizes in human readable format. Sizes within a line may scale to different unit sizes.

--help
    Display some basic usage information.

-H  (alias for: -dH; compatibility: --human-readable)
    Display partition sizes in human readable alternative format. All sizes in each individual line are scaled to the same unit size.

-I  include-fstype-list (compatibility: -F, --type)
    Include only the filesystem types listed in include-fstyp-list. The list is a comma separated list of filesystem types. Multiple -I options may be specified. If the 'fuse' filesystem type is specified, all fuse* filesystems will be included.
    e.g. -I nfs,tmpfs or -I nfs -I tmpfs.

--inodes
    Ignored. Use the -f option.

-j  (alias: --json-output)
    The data is output as an array of JSON objects. Totals are turned off. Use of format specifiers that specify the same field will result in duplicated field names. (e.g. p, 1, 2)

    Possible JSON identifiers are: scaling, blocksize, partitions, filesystem, mount, fstype, options, size, used, free, available, percused, percfree, inodes, inodesused, inodesfree, percinodesused.

    Example Output:
            {
              "scaling" : "human",
              "blocksize" : "1024",
              "partitions" : [
                {
                  "filesystem" : "/dev/nvme0n1p7",
                  "mount" : "/",
                  "size" : "19.1G",
                  "used" : "11.0G",
                  "available" : "7.0G",
                  "percused" : "63%",
                  "fstype" : "ext4"
                }
              ]
            }

-k  (alias for: -dk)
    Display sizes in Kbytes.

-l  (compatibility: --local)
    Display only local filesystems.

-L  Turn off check for duplicate filesystems (loopback (lofs/none) mounts).

-m  (alias for: -dm)
    Display sizes in megabytes.

-n  Do not print a header line above the list of filesystems. Useful when parsing the output of di.

--no-sync
    Ignored.

-P  (compatibility: --portability)
    Output format is POSIX standard. A 1024 byte block size and a display size of kilobytes (-d k) is the default.

--print-type
    Ignored. Use the -f option.

-q  Disable quota checks.

-R  (alias: --dont-resolve-symlinks)
    Do not resolve symlinks (for mount points that have a trailing UUID).

-s  sort-type
    Use sort-type to sort the output. The output of di is normally sorted by mount point. The following sort flags may be used to change the sort order:

    m - by mount point (default)
    n - leave unsorted (as it appears in the mount table)
    s - by filesystem
    T - by total space
    f - by free space
    a - by available space
    t - by filesystem type
    r - reverse the sort order; This will apply to all sort flags following this sort flag.

    These sort options may be combined in any order. e.g.:
    di -stsrm # by type, device name, reversed mount;
    di -strsrm # by type, reversed device-name, mount.

--si
    An alias for -dh -Bsi.

--sync
    Ignored.

-t  (compatibility: --total)
    Print a totals line below the list of filesystems. Only the main pool of pooled filesystems (zfs, advfs, apfs) are added to the total. Pooled filesystems that do not have pool information available (btrfs) will not total up correctly.

It is up to the user to exclude (using the -x option) read-only filesystems (cdfs, iso9660), swap-based (memfs, mfs, tmpfs) filesystems and user (fuse*) filesystems. Excluding the 'fuse' filesystem will exclude all fuse* filesystems.

-v  Ignored.

--version
    Display the di version.

-w  (backwards compatibility)
    Ignored. The following argument is ignored.

-W  (backwards compatibility)
    Ignored. The following argument is ignored.

-x  exclude-fstype-list (compatibility: --exclude-type)
    Exclude the filesystem types listed in exclude-fstyp-list. The list is a comma separated list of filesystem types. Multiple -x options may be specified. If the 'fuse' filesystem type is excluded, all fuse* filesystems will be excluded. e.g. -x nfs,tmpfs or -x nfs -x tmpfs.

-X  level
    Set the program's debugging level to debug-level.

-z  zone-name
    Display the filesystems for the specified zone. The zone must be visible to the user.

-Z  (alias for: -z all)
    Display the filesystems for all visible zones.

Format Strings
The output of di may be specified via a format string. This string may be given either via the -f command line option or as part of the DI_ARGS environment variable. The format string may specify the following columns:

    m   Print the name of the mount point.

    M (backwards compatibility)
        Print the name of the mount point.

    s   Print the filesystem name (device name).

    S (backwards compatibility)
        Print the filesystem name.

    t   Print the filesystem type.

    T (backwards compatibility)
        Print the filesystem type.

    O   Print the filesystem mount options.

    Total Available

    b   Print the total space on the filesystem.

    B   Print the total space on the filesystem available for use by normal users.

    In Use

    u   Print the space in use on the filesystem (actual space used = total - free).

    c   Print the space not available for use by normal users (total - available). Note that this calculation does not work correctly on the 'apfs' filesystem.

    Free

    f   Print the amount of free (unused) space on the filesystem.

    v   Print the space available for use by normal users.

    Percentage Used

    p   Print the percentage of space not available for use by normal users (space not available for use / total disk space).

    1   Print the percentage of space in use (actual space used / total disk space).

    2   Print the percentage of space in use, BSD-style. Represents the percentage of user-available space in use. Note that values over 100% are possible (actual space used / disk space available to normal users).

    Percentage Free

    a   Print the percentage of space available for use by normal users (space available for use / total disk space).

    3   Print the percentage of space free (actual space free / total disk space).

    Inodes

    i   Print the total number of file slots (inodes) that can be created on the filesystem.

    U   Print the number of file slots in use.

    F   Print the number of file slots available.

    P   Print the percentage of file slots in use.

The default format string for di is smbuvpT.

The format string may also contain any other character not listed above. The character will be printed as is. e.g. di -f 'mbuvp|iUFP' will print the character '|' between the disk usage and the file slot usage. The command sequence:
    di -f 'mbuvp
    miUFP'
will print two lines of data for each filesystem.

Examples
As of version 5.0.0, di no longer supports 512-byte blocks. There may not be an exact match to 512-byte block output.

Various df equivalent format strings for System V release 4 are:
    /usr/bin/df -v di -P -f msbuf1
    /usr/bin/df -k di -d k -f sbcvpm
    /usr/ucb/df di -d k -f sbuv2m
GNU df:
    df di -dk -f SbuvpM
    df -T di -dk -f STbuvpM
    df -h -T di -dh -f STbuvpM
AIX df:
    df di -d k -f Sbf1UPM
    df -I di -d k -f Sbuf1M
    df -I -M di -d k -f SMbuf1
HP-UX bdf:
    bdf di -d k -f Sbuv2M
    bdf -i di -d k -f Sbuv2UFPM
MacOS df:
    bdf -k di -d k -f Sbuv2UFPM
    bdf -I -h di -d h -B si -f Sbuv2M
    bdf -Y -I -h di -d h -B si -f STbuv2M

If you like your numbers to add up/calculate the percentage correctly, try one of the following format strings:

    di -f SMbuf1T
    di -f SMbcvpT
    di -f SMBuv2T

Environment Variables
The DI_ARGS environment variable may be used to specify command line arguments. e.g. If you always want gigabytes displayed, set DI_ARGS equal to "-dg". Any command line arguments specified will override the DI_ARGS environment variable.

The POSIXLY_CORRECT, BLOCKSIZE, BLOCK_SIZE and DF_BLOCK_SIZE environment variables are honored when possible.

Environment variables are processed in the order: POSIXLY_CORRECT, BLOCKSIZE, BLOCK_SIZE, DF_BLOCK_SIZE, DI_ARGS.

See Also
df(1), libdi(3)

Bugs
Open a ticket at https://sourceforge.net/p/diskinfo-di/tickets/
Send bug reports to: brad.lanam.di @ gmail.com

Links
Home Page: https://diskinfo-di.sourceforge.io/
Wiki: https://sourceforge.net/p/diskinfo-di/wiki/Home/
Change Log: https://sourceforge.net/p/diskinfo-di/wiki/ChangeLog/

Author
Copyright 1994-2025 by Brad Lanam Pleasant Hill, CA