IBM Books

IBM General Parallel File System for AIX: Administration and Programming Reference

Querying and reducing file system fragmentation

Disk fragmentation within a file system is an unavoidable condition. When a file is closed after it has been written to, the last logical block of data is reduced to the actual number of subblocks required thus creating a fragmented block. In order to write to a file system, free full blocks of disk space are required. Due to fragmentation, it is entirely possible to have the situation where the file system is not full, but an insufficient number of free full blocks are available to write to the file system. Replication can also cause the copy of the fragment to be distributed among disks in different failure groups. The mmdefragfs command can be used to query the current fragmented state of the file system and reduce the fragmentation of the file system.

In order to reduce the fragmentation of a file system, the mmdefragfs command migrates fragments to free space in another fragmented disk block of sufficient space, thus creating a free full block. There is no requirement to have a free full block in order to run the mmdefragfs command. The execution time of the mmdefragfs command depends on the size and allocation pattern of the file system. For a file system with a large number of disks, the mmdefragfs command will run through several iterations of its algorithm, each iteration compressing a different set of disks. Execution time is also dependent upon how fragmented the file system is. The less fragmented a file system, the shorter time for the mmdefragfs command to execute.

The fragmentation of a file system can be reduced on all disks which are not suspended or stopped. If a disk is suspended or stopped, the state of the disk, not the utilization information, will be displayed as output for the mmdefragfs command.

The mmdefragfs command can be run on both a mounted or an unmounted file system, but achieves best results on an umounted file system. Running the command on a mounted file system can cause conflicting allocation information and consequent retries to find a new free subblock of the correct size to store the fragment in.

Querying file system fragmentation using mmdefragfs

To query the current status of the amount of fragmentation for a file system, specify the file system name along with the -i option on the mmdefragfs command. For example, to display the current fragmentation information for file system fs0, enter:

mmdefragfs fs0 -i

The system displays information similar to:

"fs0"    10304 inodes:    457 allocated / 9847 free
 
                         free subblk    free 
disk            disk size  in full  subblk in      %       %
name          in nSubblk   blocks   fragments free blk blk util
--------------- --------- --------- --------- --------  -------
gpfs68n1          4390912   4270112       551   97.249   99.544
gpfs69n1          4390912   4271360       490   97.277   99.590
                --------- --------- ---------           -------
(total)           8781824   8541472      1041            99.567

See the mmdefragfs Command for complete usage information.

Reducing file system fragmentation using mmdefragfs

You can reduce the amount of fragmentation for a file system by issuing the mmdefragfs command, with or without a desired block utilization goal. For example, to reduce the amount of fragmentation for file system fs0 with a goal of 99% utilization, enter:

mmdefragfs fs0 -u 99

The system displays information similar to:

WARNING: "fs0" is mounted on 1 nodes(s) and in use on 1 node(s)
 
Start processing: iteration 1
Processing Pass 1 of 1
Disk Name gpfs57n7 gpfs60n8
   6 % complete
  12 % complete
  17 % complete
  22 % complete
  27 % complete
  32 % complete
  38 % complete
  43 % complete
  49 % complete
  56 % complete
  63 % complete
  70 % complete
  75 % complete
  81 % complete
  87 % complete
  92 % complete
  98 % complete
                       free subblk                 free
  disk                  in full                subblk in         %            %
  name                  blocks        blk      fragments      free blk     blk util
                   before     after freed   before    after  before after before after 
  ---------------  ---------------- ------- ---------------- ------------ ------------
  gpfs57n7          39424     40064    20     1347      589  68.75 69.87  92.48 96.59
  gpfs60n8          50688     51456    24     1555      593  72.26 73.36  92.01 96.83 
                    ---------------------  ---------------- 
  (total)           90112     91520    44     2902     1182 

See the mmdefragfs Command for complete usage information.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]