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 /home2 
fsck /dev/rdsk/c0t0d0s6 

The system responds with this:

** /dev/rdsk/c0t0d0s0 
** Last Mounted on /home2 
** Phase 1 - Check Blocks and Sizes 
** Phase 2 - Check Pathnames 
** Phase 3 - Check Connectivity 
** Phase 4 - Check Reference Counts 
** Phase 5 - Check Cyl groups 
5 files, 19 used, 95975 free (15 frags, 11995 blocks,  0.0% fragmentation) 

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

Table 14.17. fsck Output
Field Description
files Number of files in the file system
used Number of data blocks used
free Number of data blocks free (fragments and whole blocks)

Note

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 14.18.

Table 14.18. fsck Output
Field Description
frags The number of free fragments (from fragmented blocks)
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 DOS 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 percent. High fragmentation affects creation of new files—especially those larger than a few data blocks. Typically, high fragmentation is caused by creating large numbers of small files. The solution is to either create a larger file system or decrease the block size (finer granularity).

For example, in a file system that creates predominantly 5KB files on an 8KB block size, many 3KB fragments are free and are never used. In the extreme case, this would result in a file system that is effectively full, despite only 5/8 of the file system being used. If the block size is decreased to 4KB, which is the smallest block size available in Solaris 9, the file system is improved. The solution is summarized in Table 14.19.

Table 14.19. Block Sizes
Block Size Typical Pattern
8KB blocks Many 5KB fragment blocks and 3KB fragments are wasted.
4KB blocks This scheme uses many full blocks plus one full fragment block per four full blocks, which is much better.

Note

The sun4u architecture does not support the 4096 block size.


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

mount /dev/dsk/c0t0d0s6 /home2 
df  -k /home2 

The system responds with this:

Filesystem               Kbytes    used    avail     capacity     Mounted on 
/dev/dsk/c0t0d0s6        95994     19      91176     1%           /home2 

The 95994 value in the output represents the total file system size in kilobytes. It includes the 5 percent minfree that you specified earlier with the tunefs command. The solution is summarized in Table 14.20.

Table 14.20. Output from df
Field Description
19KB used The amount of space used in the file system.
91176KB available Space available in the file system. This value is equal to the file system size minus the minfree% minus the space used (95994 — 5 percent — 19).
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 the 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 I-nodes 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 I-node 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 14.21.

Table 14.21. Commands to Check Quotas
Command Description
quota Displays the quotas and disk usage within a file system for individual users on which quotas have been activated
repquota 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset