|
|
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.
Make better use of the disk space on your system by:
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.
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:
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
/usr/sbin/usermod -d /fs2/userx userx /usr/sbin/usermod -d /fs2/usery usery
rm -rf /fs1/userx /fs1/usery
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
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.
You can reduce directory size by locating inactive files, backing them up, and then deleting them.
To locate and delete files:
find / -mtime +90 -atime +90 -print > fileswhere files contains the names of files neither written to nor accessed within a specified time period, here 90 days (``+90'').
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:
Example:
mv /home/bob /home/obob
Example:
mkdir /home/bob
Example:
cd /home/obob find . -print | cpio -plm ../bob
Example:
cd .. rm -rf obob
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:
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).
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.
To reorganize a vxfs filesystem:
eval `mkfs -F file_sys_type -m device`
Example:
eval `mkfs -F vxfs -m /dev/dsk/c0b0t0d0sc`
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.
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.