An important activity of a system administrator is to monitor file system use on a regular basis. There are three useful commands available for this task:

  • df - Displays the number of free disk blocks
  • du - Summarizes disk use
  • quot - Summarizes file system ownership

Use the df command to display the amount of disk space used in file systems. This command lists the amount of used and available space and the amount of the file system’s total capacity being used.

The format for the df command is:

df -option resource

The table lists some of the more common options used with the df command.

Partial Listing of Options for the df Command

Option

Description

-a

Reports on all file systems, including those with entries in the /etc/mnttab file for which the ignore option is set

-b

Prints the total number of Kbytes free

-e

Prints only the number of files free

-k

Displays disk allocation in Kbytes

-h

Acts like the -k option, except that sizes are in a more readable format, for example, 14K, 234M, 2.7G, or 3.0T

-l

Reports on local file systems only

-F FSType

Specifies the file system type on which to operate. This is intended for use on unmounted file systems.

To display the capacity of file systems, perform the command:

# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0     849518  113485  676567    15%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                  596608     360  596248     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
/dev/dsk/c0t0d0s6    3007086 2317518  629427    79%    /usr
fd                         0       0       0     0%    /dev/fd
/dev/dsk/c0t0d0s3    1785654   92508 1639577     6%    /var
swap                  596352     104  596248     1%    /var/run
swap                  596568     320  596248     1%    /tmp
/dev/dsk/c0t0d0s7     424239    1046  380770     1%    /export/home
/dev/dsk/c1t3d0s7    3099093    3097 3065006     1%    /data

The same file system displayed with the -h option would appear in human-readable format.

# df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0t0d0s0      830M   111M   661M    15%    /
/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                   583M   360K   582M     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
/dev/dsk/c0t0d0s6      2.9G   2.2G   615M    79%    /usr
fd                       0K     0K     0K     0%    /dev/fd
/dev/dsk/c0t0d0s3      1.7G    90M   1.6G     6%    /var
swap                   582M   104K   582M     1%    /var/run
swap                   583M   320K   582M     1%    /tmp
/dev/dsk/c0t0d0s7      414M   1.0M   372M     1%    /export/home
/dev/dsk/c1t3d0s7      3.0G   3.0M   2.9G     1%    /data

The table defines the fields displayed by the df -k command.

Fields for the df -k Command

Field

Definition

Filesystem

The mounted file system

kbytes

The size of the file system in Kbytes (1024 bytes)

used

The number of Kbytes used

avail

The number of Kbytes available

capacity

The percentage of file system capacity used

Mounted on

The mount point

The amount of space that is reported as used and avail is typically less than the amount of total space in the file system. A fraction of space, from 1 to 10 percent, is reserved in each file system as the minfree value.

When all of the reported space on the file system is in use, the file system capacity is displayed as 100 percent. Regular users receive the message “File System Full” and cannot continue working. The reserved space is available to the root user, who can then delete or back up files in the file system.

The df -k command can be used with the device as the resource to show available space on the device:

# df -k /dev/dsk/c0t1d0s6
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t1d0s6    17153338       9 16810225     0%    
#
Note: This command does not work on a partition without a file system, but does work on a partition with an unmounted file system.

Use the du command to display the number of disk blocks used by directories and files. Each disk block consists of 512 bytes.

The format for the du command is:

du -options directory

The table describes the options for the du command.

Options for the du Command

Option

Description

-k

Displays disk use in Kbytes.

-s

Displays only the summary in 512-byte blocks. Using the s and k options together shows the summary in Kbytes.

-a

Displays the number of blocks used by all files in addition to directories within the specified directory hierarchy.

To display disk usage in kilobytes, perform the command:

# cd /opt
# du -k
3       ./SUNWits/Graphics-sw/xil/lib
4       ./SUNWits/Graphics-sw/xil
5       ./SUNWits/Graphics-sw
6       ./SUNWits
15      ./SUNWmlib/lib/sparcv8
15      ./SUNWmlib/lib/sparcv8plus
15      ./SUNWmlib/lib/sparcv8plus+vis
15      ./SUNWmlib/lib/sparcv8plus+vis2
15      ./SUNWmlib/lib/sparcv9
15      ./SUNWmlib/lib/sparcv9+vis
15      ./SUNWmlib/lib/sparcv9+vis2
120     ./SUNWmlib/lib
24      ./SUNWmlib/include
146     ./SUNWmlib
376     ./SUNWrtvc/bin
10      ./SUNWrtvc/examples/rtvc_capture_movie
24      ./SUNWrtvc/examples/rtvc_display
68      ./SUNWrtvc/examples/rtvc_video_conference
25      ./SUNWrtvc/examples/test
128     ./SUNWrtvc/examples
7       ./SUNWrtvc/man/man1
19      ./SUNWrtvc/man/man3
28      ./SUNWrtvc/man
533     ./SUNWrtvc
686     .

To display disk usage in human readable form, perform the command:

# du -h /opt |more
   3K   /opt/SUNWits/Graphics-sw/xil/lib
   4K   /opt/SUNWits/Graphics-sw/xil
   5K   /opt/SUNWits/Graphics-sw
   6K   /opt/SUNWits
  24K   /opt/SUNWmlib/include
  15K   /opt/SUNWmlib/lib/sparcv8
  15K   /opt/SUNWmlib/lib/sparcv8plus
  15K   /opt/SUNWmlib/lib/sparcv8plus+vis
  15K   /opt/SUNWmlib/lib/sparcv8plus+vis2
  15K   /opt/SUNWmlib/lib/sparcv9
  15K   /opt/SUNWmlib/lib/sparcv9+vis
  15K   /opt/SUNWmlib/lib/sparcv9+vis2
 120K   /opt/SUNWmlib/lib
 146K   /opt/SUNWmlib
 376K   /opt/SUNWrtvc/bin
  10K   /opt/SUNWrtvc/examples/rtvc_capture_movie
  24K   /opt/SUNWrtvc/examples/rtvc_display
  68K   /opt/SUNWrtvc/examples/rtvc_video_conference
  25K   /opt/SUNWrtvc/examples/test
 128K   /opt/SUNWrtvc/examples
   7K   /opt/SUNWrtvc/man/man1
  19K   /opt/SUNWrtvc/man/man3

To display disk usage including files, perform the command:

# du -ak /opt 
1       /opt/SUNWits/Graphics-sw/xil/lib/libxil.so
1       /opt/SUNWits/Graphics-sw/xil/lib/libxil.so.1
3       /opt/SUNWits/Graphics-sw/xil/lib
4       /opt/SUNWits/Graphics-sw/xil
(output removed for brevity)
19      /opt/SUNWrtvc/man/man3
1       /opt/SUNWrtvc/man/windex
28      /opt/SUNWrtvc/man
533     /opt/SUNWrtvc
686     /opt

To display only a summary of disk usage, perform the command:

# du -sk /opt
686     /opt

Use the quot command to display how much disk space, in kilobytes, is being used by users.

The format for the quot command is:

quot -options filesystemThe table describes the options for the quot command.

Options for the quot Command

Option

Description

-a

Reports on all mounted file systems

-f

Includes the number of files

To display disk space being used by users on all mounted file systems, perform the command:

# quot -af
/dev/rdsk/c0t0d0s0 (/):
112410   5246   root    
   31      12   uucp    
   11      11   lp      
    1       1   adm     
/dev/rdsk/c0t0d0s6 (/usr):
2313692 102415  root    
  806      15   uucp    
   11       4   bin     
    1       1   adm     

The columns represent kilobytes used, number of files, and owner, respectively.

To display a count of the number of files and space owned by each user for a specific file system, enter the following:

# quot -f /dev/dsk/c0t0d0s7
/dev/rdsk/c0t0d0s7 (/export/home):
    9       2   root 
   15      35   sue
   51      51   paul   
   23      25   jeff

The Solaris Management Console Usage Tool provides a graphical display of the available space for all mounted file systems.

To use the Solaris Management Console storage Usage Tool, launch the Solaris Management Console by typing smc& at a command line, or select it from the Application Manager Window. To locate the Usage Tool, select This Computer, then select Storage, then select Mounts and Shares on the Solaris Management Console.

The image shows the Management Tools: Solaris Management Console window with the disk usage information.

Related Posts:

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word