mmdefragfs command

Reduces disk fragmentation by increasing the number of full free blocks available to the file system.

Synopsis

mmdefragfs Device [-i] [-u BlkUtilPct] [-P PoolName] 
 [-N {Node[,Node...] | NodeFile | NodeClass}] 
 [--pit-continues-on-error] [--qos QosClass]

Availability

Available on all IBM Storage Scale editions.

Description

Use the mmdefragfs command to reduce fragmentation of a file system. The mmdefragfs command moves existing file system data within a disk to make more efficient use of disk blocks. The data is migrated to unused sub-blocks in partially allocated blocks, thereby increasing the number of free full blocks.

The mmdefragfs command can be run against a mounted or unmounted file system. However, best results are achieved when the file system is unmounted. When a file system is mounted, allocation status may change causing retries to find a suitable unused sub-block.

Note: On a file system that has a very low level of fragmentation, negative numbers can be seen in the output of mmdefragfs for free sub-blocks. This indicates that the block usage has in fact increased after running the mmdefragfs command. If negative numbers are seen, it does not indicate a problem and you do not need to rerun the mmdefragfs command.

Parameters

Device
The device name of the file system to have fragmentation reduced. File system names need not be fully-qualified. fs0 is as acceptable as /dev/fs0.

This must be the first parameter.

-P PoolName
Specifies the pool name to use.
-N {Node[,Node...] | NodeFile | NodeClass}
Specifies the nodes that can be used in this disk defragmentation. This parameter supports all defined node classes. The default is all or the current value of the defaultHelperNodes parameter of the mmchconfig command.

For general information on how to specify node names, see Specifying nodes as input to GPFS commands.

--pit-continues-on-error
Allows the mmdefragfs command to continue defragmenting the remaining files, if errors are encountered in the parallel inode traverse (PIT) phase that performs defragmentation of subblocks. An output file is generated if an error occurs in the PIT phase. The location of the file that logs the errors is displayed in the command output.
Note:
  • The mmdefragfs command continues to run only if the error is reported in the PIT phase of the command execution. If the error is reported in other phases of command execution, the command stops running.
  • The --pit-continues-on-error option works only if the minimum release level of the IBM Storage Scale cluster is 5.1.1 or later.

The --pit-continues-on-error option allows the command to skip fatal errors encountered during the PIT phase and continue with the file system scan. If fatal errors are encountered, the command fails at the end of the scan and generates an output file that lists all the problematic files that had the fatal errors. Based on such output file, users can take additional actions to handle these problematic files before rerunning the command.

If --pit-continues-on-error is not used, the command run fails if a fatal error is encountered. Any error that is not included in the next table is considered as a fatal error.

Table 1. Non-fatal errors that can be encountered during the PIT phase
Non-fatal error Code Description
E_COMPRESS_NOT_ALLOWED 840 File compression is not allowed.
E_COMPRESS_HYPERALLOC 799 Compression of a file in hyperalloc mode is not allowed.
E_NOREPLGRP 219 Not enough replicas could be created because the desired degree of replication is larger than the number of failure groups.
E_NOREPLSPC 220 Not enough replicas could be created because there was not enough space left in one of the failure groups.
E_NOBALSPC 221 There was not enough space left on one of the disks to properly balance the file according to the current stripe method.
E_NOBALAVAIL 222 The file could not be properly balanced because one or more disks are unavailable.
E_ADDR_BROKEN 226 All replicas were on disks that have since been deleted from the stripe group.
E_ALL_UNAVAIL 218 A replicated read or write failed because none of the replicas were available.
E_ENC_CTX_NOT_READY 786 Encryption context is not ready.
--qos QosClass
Specifies the Quality of Service for I/O operations (QoS) class to which the instance of the command is assigned. If you do not specify this parameter, the instance of the command is assigned by default to the maintenance QoS class. This parameter has no effect unless the QoS service is enabled. For more information, see the topic mmchqos command. Specify one of the following QoS classes:
maintenance
This QoS class is typically configured to have a smaller share of file system IOPS. Use this class for I/O-intensive, potentially long-running IBM Storage Scale commands, so that they contribute less to reducing overall file system performance.
other
This QoS class is typically configured to have a larger share of file system IOPS. Use this class for administration commands that are not I/O-intensive.
For more information, see Setting the Quality of Service for I/O operations.

Options

-i
Specifies to query the current disk fragmentation state of the file system. Does not perform the actual defragmentation of the disks in the file system.
-u BlkUtilPct
The average block utilization goal for the disks in the file system. The mmdefragfs command reduces the number of allocated blocks by increasing the percent utilization of the remaining blocks. The command automatically goes through multiple iterations until BlkUtilPct is achieved on all of the disks in the file system or until no progress is made in achieving BlkUtilPct from one iteration to the next, at which point it exits.

Exit status

0
Successful completion.
nonzero
A failure has occurred.

Security

You must have root authority to run the mmdefragfs command.

The node on which the command is issued must be able to execute remote shell commands on any other node in the cluster without the use of a password and without producing any extraneous messages. For more information, see Requirements for administering a GPFS file system.

Examples

  1. To query the fragmentation state of file system fs0, issue this command:
    mmdefragfs fs0 -i
    The system displays information similar to:
    disk            disk size  in full  subblk in      %       %
    name          in nSubblk   blocks   fragments free blk blk util
    --------------- --------- --------- --------- --------  -------
    nsd32              327680    277504     12931   84.688   96.054
    nsd33              327680    315232       580   96.201   99.823
    nsd21              327680    301824      2481   92.109   99.243
    nsd34              327680    275904     13598   84.199   95.850
    nsd30              327680    275808     13380   84.170   95.917
    nsd19              327680    278496     12369   84.990   96.225
    nsd31              327680    276224     12012   84.297   96.334
                    --------- --------- ---------           -------
    (total)           2293760   2000992     67351            97.064
  2. To reduce fragmentation of the file system fs0 on all defined, accessible disks that are not stopped or suspended, issue this command:
    mmdefragfs fs0 
    The system displays information similar to:
                         free subblk           free
      disk                in full            subblk in       %            %
      name               blocks    blk       framents     free blk     blk util
                  before     after freed   before after before after before after
     ----------  ------------------------ ------------- ------------ ------------
      gpfs57nsd    28896     29888     31    1462   463  50.39 52.12  94.86 98.31
      gpfs60nsd    41728     43200     46    1834   362  59.49 61.59  93.55 98.66
                 ---------------------  --------------               -----------
     (total)      70624     73088    77     3296      825             93.63 98.84
  3. To reduce fragmentation of all files in the fs1 file system until the disks have 100% full block utilization, issue this command:
    mmdefragfs fs1 -u 100
    The system displays information similar to:
    Defragmenting file system 'fs1'...
    
    Defragmenting until full block utilization is 98.00%, currently 97.07%
     27.35 % complete on Tue May 26 14:25:42 2009    (    617882 inodes       4749 MB)
     82.65 % complete on Tue May 26 14:26:02 2009    (   1867101 inodes      10499 MB)
     89.56 % complete on Tue May 26 14:26:23 2009    (   2023206 inodes      14296 MB)
     90.01 % complete on Tue May 26 14:26:43 2009    (   2033337 inodes      17309 MB)
     90.28 % complete on Tue May 26 14:27:03 2009    (   2039551 inodes      19779 MB)
     91.17 % complete on Tue May 26 14:27:23 2009    (   2059629 inodes      23480 MB)
     91.67 % complete on Tue May 26 14:27:43 2009    (   2070865 inodes      26760 MB)
     92.51 % complete on Tue May 26 14:28:03 2009    (   2089804 inodes      29769 MB)
     93.12 % complete on Tue May 26 14:28:23 2009    (   2103697 inodes      32649 MB)
     93.39 % complete on Tue May 26 14:28:43 2009    (   2109629 inodes      34934 MB)
     95.47 % complete on Tue May 26 14:29:04 2009    (   2156805 inodes      36576 MB)
     95.66 % complete on Tue May 26 14:29:24 2009    (   2160915 inodes      38705 MB)
     95.84 % complete on Tue May 26 14:29:44 2009    (   2165146 inodes      40248 MB)
     96.58 % complete on Tue May 26 14:30:04 2009    (   2181719 inodes      41733 MB)
     96.77 % complete on Tue May 26 14:30:24 2009    (   2186053 inodes      43022 MB)
     96.99 % complete on Tue May 26 14:30:44 2009    (   2190955 inodes      43051 MB)
     97.20 % complete on Tue May 26 14:31:04 2009    (   2195726 inodes      43077 MB)
     97.40 % complete on Tue May 26 14:31:24 2009    (   2200378 inodes      43109 MB)
     97.62 % complete on Tue May 26 14:31:44 2009    (   2205201 inodes      43295 MB)
     97.83 % complete on Tue May 26 14:32:05 2009    (   2210003 inodes      43329 MB)
     97.85 % complete on Tue May 26 14:32:25 2009    (   2214741 inodes      43528 MB)
     97.86 % complete on Tue May 26 14:32:55 2009    (   2221888 inodes      43798 MB)
     97.87 % complete on Tue May 26 14:33:35 2009    (   2231453 inodes      44264 MB)
     97.88 % complete on Tue May 26 14:34:26 2009    (   2243181 inodes      45288 MB)
     100.00 % complete on Tue May 26 14:35:10 2009
    
                   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
    ---------- ----------------------- ----------------- ------------ ------------
    nsd32        277504   287840   323    12931     2183  84.69 87.84  96.05 99.33
    nsd33        315232   315456     7      580      185  96.20 96.27  99.82 99.94
    nsd21        301824   303616    56     2481      666  92.11 92.66  99.24 99.80
    nsd34        275904   285920   313    13598     3159  84.20 87.26  95.85 99.04
    nsd30        275840   285856   313    13348     2923  84.18 87.24  95.93 99.11
    nsd19        278592   288832   320    12273     1874  85.02 88.14  96.25 99.43
    nsd31        276224   284608   262    12012     3146  84.30 86.86  96.33 99.04
               ----------------------- -----------------               ------------
    (total)     2001120  2052128  1594    67223    14136               97.07 99.38
    
    Defragmentation complete, full block utilization is 99.04%.

See also

Location

/usr/lpp/mmfs/bin