System Administration Guide
Chapter 2, Administering filesystems

Reducing disk fragmentation

Reducing disk fragmentation

If your system has been in use for some time, the constant creation and removal of files creates a situation called ``disk fragmentation''. This means that the files in the filesystem are written in small pieces on the hard disk, thus scattering the available disk space. Disk fragmentation increases access time and reduces filesystem efficiency.

NOTE: HTFS and DTFS filesystems attempt to cluster allocations for a particular file together on the disk, so disk fragmentation is less of a concern with these filesystem types.

To reduce disk fragmentation on EAFS, AFS, and S51K filesystems:

  1. Create a complete backup of all the files in the filesystem. See ``Running unscheduled filesystem backups''.

    WARNING: Be certain that you have a complete, accurate, and readable backup before you continue or you may lose your files.

  2. Remove all the files from the hard disk.

  3. Restore the files from the backup. See ``Restoring files or directories from backup media''.

This procedure rewrites all the files during the restore. Each file is written in one piece on the disk, thus consolidating the available disk space and reducing disk fragmentation. You also recover a small amount of space when you run this procedure.

Run this procedure about once a year on a heavily used system (less often on a lightly used system).