Previous Page
Next Page

Information on File Systems

The df command gives you capacity information on each mounted file system. The output of df and fsck is often misunderstood. This section goes into more detail about these two commands and describes their output so that you can better understand the information displayed. I begin with the fsck command. Remember, run fsck only on unmounted file systems, as shown in the following example. Type the following:

umount /mnt
fsck /dev/rdsk/c2t1d0s1

The system responds with this:

** /dev/rdsk/c2t1d0s1
** Last Mounted on /mnt
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
2 files, 9 used, 4099509 free (13 frags, 512437 blocks, 0.0% fragmentation)

fsck first reports some things related to usage, as shown in Table 1.25.

Table 1.25. fsck Output




Number of files in the file system


Number of data blocks used


Number of data blocks free (fragments and whole blocks)


Fragment Size A fragment is one data block in size, and a block consists of a number of data blocks, typically eight.

Then fsck reports more details of the free space, as shown in Table 1.26.

Table 1.26. fsck Output




The number of free fragments (from fragmented blocks)


The number of free blocks (whole unfragmented blocks)

% fragmentation

Free fragments as a percentage of the whole disk size

Fragmentation does not refer to fragmentation in the sense of a file's disk blocks being inefficiently scattered across the whole file system, as you see in a Microsoft Windows file system.

In Solaris, a high percentage of fragmentation implies that much of the free space is tied up in fragments. In the previous example, fragmentation was 0%. High fragmentation affects creation of new filesespecially those larger than a few data blocks. Typically, high fragmentation is caused by creating large numbers of small files.

Now let's review the output from the df command:

mount /dev/dsk/c2t1d0s1 /mnt
df -k /mnt

The system responds with this:

File system            kbytes    used   avail capacity  Mounted on
/dev/dsk/c2t1d0s1    4103598    4089 3894330     1%    /mnt

The 4103598 value in the output represents the total file system size in kilobytes. It includes the 5% minfree that you specified earlier with the tunefs command. The output is summarized in Table 1.27.

Table 1.27. Output from df



4089KB used

The amount of space used in the file system.

3894330KB available

Space available in the file system. This value is equal to the file system size minus the minfree% minus the space used (4103598 5% 4089). Because logging is enabled on this file system, a small amount of space is used for logging. The log size is 1MB per 1GB of space up to a max of 64MB.

1% capacity

Space used as a percentage, calculated as follows: kilobytes used/(kilobytes available minfree%).

Controlling User Disk Space Usage

Quotas let system administrators control the size of UFS file systems by limiting the amount of disk space that individual users can acquire. Quotas are especially useful on file systems where user home directories reside. After the quotas are in place, they can be changed to adjust the amount of disk space or number of inodes that users can consume. Additionally, quotas can be added or removed as system needs change. Also, quota status can be monitored. Quota commands enable administrators to display information about quotas on a file system or search for users who have exceeded their quotas.

After you have set up and turned on disk and inode quotas, you can check for users who exceed their quotas. You can also check quota information for entire file systems by using the commands listed in Table 1.28.

Table 1.28. Commands to Check Quotas




Displays the quotas and disk usage within a file system for individual users on which quotas have been activated


Displays the quotas and disk usage for all users on one or more file systems

You won't see quotas in use much today because the cost of disk space continues to fall. In most cases, the system administrator simply watches disk space to identify users who might be using more than their fair share. As you saw in this section, you can easily do this by using the du command. On a large system with many users, however, disk quotas can be an effective way to control disk space usage.

Another option for managing user space is the use of soft partitions described in Chapter 10. With soft partitions, each user's home directory can be created within its own disk partition and would be limited to the space allocated to that partition.

The quot Command

Use the quot command to display how much disk space, in kilobytes, is being used by users. You do not need to implement disk quotas to use this command. The quot command can only be run by root. The syntax for the quot command is

quot -options <file system>

The quot command has two options:


Reports on all mounted file systems


Includes the number of files

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

quot -af

The system responds with the following output:

/dev/rdsk/c0t0d0s0 (/):
68743    4370   root
 162       18   lp
  31       14   uucp
   1        1   adm
/dev/rdsk/c0t0d0s6 (/usr):
1270388 50748   root
 1254      19   lp
 766       15   uucp
  10        3   bin
   1        1   adm
/dev/rdsk/c0t0d0s1 (/var):
63327    5232   root
  208       9   adm
   22      27   lp
   16      17   uucp
    4       4   daemon
    4       8   nobody
    2       2   smmsp
    1       3   bill
    1       1   bin
/dev/rdsk/c0t0d0s5 (/opt):
 2608     253   root
    2       2   lp
/dev/rdsk/c0t0d0s7 (/export/home):
  212     131   root
   68      56   wcalkins
   58      39   bill
    5       5   sradmin
    4       4   jer
    4       4   jradmin
    2       2   tom

The columns of information displayed 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

quot -f /dev/dsk/c0t0d0s7

The system responds with the following:

 212     131   root
  68      56   wcalkins
  58      39   bill
   5       5   sradmin
   4       4   jer
   4       4   jradmin
   2       2   tom

Previous Page
Next Page