DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Managing system performance

Managing disk resource usage

You need to monitor disk use carefully to prevent running out of disk space. There are ways that you can make better use of the disk space you have, or recover used space. You might also consider adding additional hard disks to your system to increase the amount of disk space available.

Managing disk space

Make better use of the disk space on your system by:

Monitoring filesystem use

You can use the df(C) command to monitor filesystem use. In general, filesystems should have at least 10 to 15 percent of their capacity available. If available space falls below 10 percent, filesystem fragmentation increases and performance is degraded.

The default system configuration is set up so the filesystem blocks are allocated in an optimum way for most environments.

Balancing filesystem space: moving user directories

You can also control filesystem space by balancing the load between filesystems. To do this, user directories often need to be moved. It is best to group users with common interests in the same filesystem.

To balance filesystem space:

  1. Determine which user directories you want to move and notify the users.


    NOTE: Be sure to notify users of moves well enough in advance so they can program around the expected change. Make sure they are not logged in to the system when you move their directories.

  2. Use the find(C) and cpio(C) commands to move directories and manipulate the filesystem tree. Move groups of users with a single cpio command to avoid unlinking and duplicating linked files.

    Example: Move directory trees userx and usery from filesystem fs1 to fs2 where there is more space available.

       cd /fs1
       find userx usery -print -depth | cpio -pdm /fs2
    

  3. Verify that the copy was made.

  4. Create new default login directories for userx and usery by running
       /usr/sbin/usermod -d /fs2/userx userx
       /usr/sbin/usermod -d /fs2/usery usery
    

  5. Remove the old default login directories by running
       rm -rf /fs1/userx /fs1/usery
    

  6. Send electronic mail to userx and usery to notify them that their login directories have been moved and their pathname dependencies may need to be changed.

Controlling directory size

Very large directories are inefficient and they can affect performance. If a directory becomes bigger than 10K (twenty 512-byte blocks or about 600 entries of average name length), then directory searches can cause performance problems. For larger block sizes, bigger directories are less of a problem, but they should be watched carefully. The find command can locate large directories.

   find / -type d -size +20 -print


NOTE: The size argument to the find command is in 512-byte blocks.

For all the available filesystem types, removing files from a directory does not make that directory smaller. When a file is removed from a directory, the space is left in the directory and is available for new files added to the directory.

Locating and deleting inactive files

You can reduce directory size by locating inactive files, backing them up, and then deleting them.

To locate and delete files:

  1. Use the find command to locate inactive files.

    Example:

       find / -mtime +90 -atime +90 -print > files
    
    where files contains the names of files neither written to nor accessed within a specified time period, here 90 days (``+90'').

  2. Notify users that files will be deleted; give enough warning for the users to save or delete their files.

  3. Delete the inactive files.

Reorganizing a single directory

Before you begin

Before you reorganize a directory, use the ``Locating and deleting inactive files'' procedure to remove files that are no longer useful.

To reorganize a single directory:

  1. Move the current directory to another temporary directory.

    Example:

       mv /home/bob /home/obob
    

  2. Create or make the new directory.

    Example:

       mkdir /home/bob
    

  3. In the old directory, use the find and cpio commands to copy the files into the new directory.

    Example:

       cd /home/obob
       find . -print | cpio -plm ../bob
    

  4. Remove the temporary directory.

    Example:

       cd ..
       rm -rf obob
    

Changing the maximum file size

If you install an application such as a database program that creates very large files, you may need to increase the maximum file size that the system can handle.

The maximum file size for the system is determined by the parameters SFSZLIM and HFSZLIM.

To increase the maximum file size:

  1. Edit the values of the parameters SFSZLIM and HFSZLIM.

    Make the two values identical, unless you have a good reason to do otherwise. HFSZLIM must not be less than SFSZLIM.

    Example: To change the maximum file size to 1000000 bytes (10MB) change the values of HFSZLIM and SFSZLIM to 0xA00000 (the 0x denotes hexadecimal).

  2. Rebuild the operating system.

Reorganizing a filesystem


NOTE: If you have only one disk and you've accepted all the default values during installation, ignore this information. If you have more than one disk and you are running a heavily used filesystem, the following information might be useful.

A file consists of multiple disk blocks, which may or may not be contiguous. Files that consist of contiguous disk blocks can be accessed more efficiently than those that aren't. A heavily used filesystem composed of noncontiguous disk blocks might produce performance problems. You can make your filesystem more efficient by rearranging the files to make the constituent blocks contiguous, which also has the effect of shrinking your directories. You cannot reorganize the root filesystem.

Reorganizing a vxfs filesystem


NOTE: The following procedure is provided as a way to clean up a severely fragmented and disorganized filesystem. Because this procedure is cumbersome, we don't recommend using it unless your filesystem is causing severe performance problems.

To reorganize a vxfs filesystem:

  1. Make sure the filesystem you want to clean up is mounted and is not being used by any users or processes.

  2. Back up the filesystem to a spare disk or cartridge tape, or any other available medium. Use the cpio(C) or tar(C) command.

  3. Unmount the filesystem.

  4. To create a filesystem identical to the original, get the syntax of the mkfs command line used to create the original filesystem, and run it again. The output of the mkfs command with the -m option is the original command syntax. By evaluating it (with eval), you redirect this output such that the command is executed again. Use the eval routine:
       eval `mkfs -F file_sys_type -m device`
    

    Example:

       eval `mkfs -F vxfs -m /dev/dsk/c0b0t0d0sc`
    
    

  5. Mount the new (empty) filesystem.

  6. Restore the contents from the backup copy.

Selecting a filesystem type

The choice of filesystem type can affect the performance of your system. The default filesystem type provided during installation is the VERITAS filesystem (vxfs) with a logical block size of 1K (1024 bytes) for filesystems up to 8GB. For most applications, this should provide the best balance of performance and reliability because vxfs offers speedy system boot and shutdown and fast recovery from system outages such as power failures. However, some applications may perform better using other filesystem types. For detailed information about the vxfs filesystem type, see ``Managing the VxFS filesystem''.

If you want to change the filesystem type for an existing filesystem, the procedure is the same as for reorganizing a filesystem: backup the filesystem and then remake it.

Depending on the average size of the files, you might also want to change either the logical block size or the filesystem type of the filesystem. vxfs uses logical block sizes of 2K (2048 bytes), 4K (4096 bytes), and 8K (8192 bytes), in addition to the default size of 1024-byte blocks.

Selecting a logical block size for a vxfs filesystem

vxfs allocates storage in extents that are collections of one or more blocks, so there are no fragments with vxfs. Because vxfs does allocation and I/O in multiple-block extents, keeping the logical block size as small as possible increases performance and reduces wasted space for most workloads. For the most efficient space utilization, best performance, and least fragmentation, use the smallest block size available on the system. The smallest block size available is 1K, which is the default block size for vxfs filesystems created on the system.

For a vxfs filesystem, select a logical block size of 1K, 2K, 4K, or 8K bytes; the default is 1024-byte blocks for a filesystem smaller than 8GB.


Next topic: Monitoring system performance
Previous topic: Identifying heavily loaded system resources

© 2007 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 05 June 2007