Previous Page
Next Page

Tuning File Systems

A situation might arise in which you want to change some of the parameters that were set when you originally created the file system. Perhaps you want to change the minfree value to free some additional disk space on a large disk drive. Using the tunefs command, you can modify the following file system parameters:

  • maxcontig

  • rotdelay

  • maxbpg

  • minfree

  • optimization

See Table 1.14 for a description of these options.

Table 1.14. The tunefs Command

Option

Description

-a <maxcontig>

Specifies the maximum number of contiguous blocks that are laid out before forcing a rotational delay (see the -d option). The default value is 1 because most device drivers require an interrupt per disk transfer. For device drivers that can chain several buffers into a single transfer, set this to the maximum chain length.

-d <rotdelay>

This option is obsolete in Solaris 10. The value is always set to 0.

-e <maxbpg>

Sets the maximum number of blocks that any single file can allocate from a cylinder group before it is forced to begin allocating blocks from another cylinder group. Typically, this value is set to approximately one quarter of the total blocks in a cylinder group. The intent is to prevent any single file from using up all the blocks in a single cylinder group. The effect of this limit is to cause big files to do long seeks more frequently than if they were allowed to allocate all the blocks in a cylinder group before seeking elsewhere. For file systems with exclusively large files, this parameter should be set higher.

-m <minfree>

Specifies the percentage of space held back from normal users (the minimum free space threshold). The default value is 10%; however, on large file systems, the minfree value is determined automatically.

-o <value>

Changes the optimization strategy for the file system. The value is either space or time. Use space to conserve space; use time to organize file layout and minimize access time. Generally, optimize a file system for time unless it is more than 90% full.

<special>/<file system>

Enters either the special device name (such as /dev/rdsk/c0t0d0s6) or the file system name (such as /home).


Caution

tunefs can destroy a file system in seconds. Always back up the entire file system before using tunefs.


The syntax for tunefs is as follows:

tunefs [ -a <maxcontig> ] [ -d <rotdelay> ] [ -e <maxbpg> ]
[ -m <minfree> ] [ -o [ <value> ] <special>/<file system>

The tunefs command is described in Table 1.14.

The file system does not need to be unmounted before using tunefs.

To change the minimum free space (minfree) on a file system from 10% to 5%, type the following:

tunefs -m5 /dev/rdsk/c0t0d0s6
minimum percentage of free space changes from 10% to 5%

The manual page of tunefs recommends that minfree be set at 10%; if you set the value under that, you lose performance. This means that 10% of the disk is unusable. This might not have been too bad in the days when disks were a couple hundred megabytes in size, but on a 9GB disk, you're losing 900MB of disk space. The mention of loss of performance in the manual page is misleading. With such large disk drives, you can afford to have minfree as low as 1%. This has been found to be a practical and affordable limit. In addition, performance does not become an issue because locating free blocks even within a 90MB area is efficient.

A rule of thumb is to use the default 10% minfree value for file systems up to 1GB and then adjust the minfree value so that your minfree area is no larger than 100MB. As for performance, applications do not complain about the lower minfree value. The one exception is the root (/) file system, in which the system administrator can use his judgment to allow more free space just to be conservative, in case root (/) ever becomes 100% full.

Note

Viewing the minfree Value On large file systems, the minfree is automatically determined so that disk space is not wasted. Use the mkfs -m command described next if you want to see the actual minfree value that newfs used.


Later, if you want to see what parameters were used when creating a file system, issue the mkfs command:

mkfs -m /dev/rdsk/c2t1d0s1

The system responds with this:

mkfs -F ufs -o nsect=135,ntrack=16,bsize=8192,fragsize=1024,cgsize=46,free=1,\
rps=120,nbpi=8179,opt=t,apc=0,gap=0,nrpos=8,maxcontig=128,mtb=n\
 /dev/rdsk/c2t1d0s1 8337600


Previous Page
Next Page