Managing Disk Use (Tasks)
This chapter describes how to optimize disk space by locating unused files and large directories.
This is a list of the step-by-step instructions in this chapter.
"How to Display the Size of Directories, Subdirectories, and Files"
"How to Display the User Ownership of Local UFS File Systems"
Displaying Information About Files and Disk Space
This table summarizes the commands available for displaying information about file size and disk space.
Command | Man Page | Description |
---|---|---|
df | df(1M) | Reports the number of free disk blocks and files. |
du | du(1) | Summarizes disk space allocated to each subdirectory. |
find -size | find(1) | Searches recursively through a directory based on the size specified with the -size option. |
ls -lh | ls(1) | Lists the size of a file in the power of 1024. |
How to Display Information About Files and Disk Space
Display information about how disk space is used by using the df command.
$ df [directory] [-h] [-t] [-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. |
-t | Displays the total blocks as well as the blocks used for all mounted file systems. |
Examples--Displaying Information About File Size and Disk Space
In the following example, all the file systems listed are locally mounted except for /usr/dist, which is mounted remotely from the system venus.
$ df / (/dev/dsk/c0t0d0s0 ): 287530 blocks 92028 files /usr (/dev/dsk/c0t0d0s6 ): 1020214 blocks 268550 files /proc (/proc ): 0 blocks 878 files /dev/fd (fd ): 0 blocks 0 files /etc/mnttab (mnttab ): 0 blocks 0 files /var/run (swap ): 396016 blocks 9375 files /tmp (swap ): 396016 blocks 9375 files /opt (/dev/dsk/c0t0d0s5 ): 381552 blocks 96649 files /export/home (/dev/dsk/c0t0d0s7 ): 434364 blocks 108220 files /usr/dist (venus:/usr/dist ):14750510 blocks 2130134 files |
In the following example, file system information is displayed in 1024 bytes.
$ df -h Filesystem size used avail capacity Mounted on /dev/dsk/c0t0d0s0 1.9G 58M 1.8G 4% / /dev/dsk/c0t0d0s6 2.5G 765M 1.7G 1% /usr /proc 0K 0K 0K 0% /proc fd 0K 0K 0K 0% /dev/fd mnttab 0K 0K 0K 0% /etc/mnttab swap 2.1G 24K 2.1G 1% /var/run swap 2.1G 0K 2.1G 0% /tmp /dev/dsk/c0t0d0s5 1.9G 12M 1.8G 1% /opt /dev/dsk/c0t0d0s7 1.9G 10K 1.8G 1% /export/home |
Note - 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 a MNTFS file system.
The following example shows a list of all mounted file systems, device names, total 512-byte blocks used, and number of files. The second line of each two-line entry displays the total number of blocks and files allocated for the file system.
$ df -t / (/dev/dsk/c0t0d0s0 ): 287530 blocks 92028 files total: 385614 blocks 96832 files /usr (/dev/dsk/c0t0d0s6 ): 1020214 blocks 268550 files total: 2381102 blocks 300288 files /proc (/proc ): 0 blocks 879 files total: 0 blocks 924 files /dev/fd (fd ): 0 blocks 0 files total: 0 blocks 72 files /etc/mnttab (mnttab ): 0 blocks 0 files total: 0 blocks 1 files /var/run (swap ): 396112 blocks 9375 files total: 396112 blocks 9395 files /tmp (swap ): 396112 blocks 9375 files total: 396128 blocks 9395 files /opt (/dev/dsk/c0t0d0s5 ): 381552 blocks 96649 files total: 385614 blocks 96832 files /export/home (/dev/dsk/c0t0d0s7 ): 434364 blocks 108220 files total: 434382 blocks 108224 files /usr/dist (venus:/usr/dist ): 14750510 blocks 2130134 files total: 41225162 blocks 2482176 files |