Decreasing the size of a compatibility mode aggregate

If a compatibility mode aggregate becomes too large, the administrator, or user that mounted the aggregate, can shrink the aggregate by using the zfsadm shrink command. Shrinking an aggregate releases a specified amount of free space from the VSAM linear data set.

For example, you have an aggregate that is 2000000 K in size. The size can be determined by using the zfsadm fsinfo command. This command also indicates the number of free 8 K blocks; in this example, it indicates 11000 free 8 K blocks, for a total of 88000 K. That number indicates that the new size of the aggregate must be in the range of approximately 1912008 K to 1999990 K. After the shrink operation is completed, the aggregate VSAM linear data set is smaller and the amount of free space in the aggregate is reduced by the difference between the old aggregate size and the new one.

The display:

zfsadm fsinfo -aggr omvs.prv.aggr003.lds0003

Part of the owner information could display:
    Size: 2000000K           Free 8K Blocks: 11000

zfsadm shrink -aggr omvs.prv.aggr003.lds0003 -size 1950000K
    IOEZ00873I Aggregate OMVS.PRV.AGGR003.LDS0003 successfully shrunken.

zfsadm fsinfo -aggr omvs.prv.aggr003.lds0003

Part of the owner information could now show:

    Size: 1950000K           Free 8K Blocks: 4750

When a shrink operation is requested for an aggregate, an IOEZ00881I action message is displayed on the console. This message is removed when the shrink operation is completed or if the shrink operation is interrupted by a shutdown, unmount with the force option, or a zfsadm shrink command with the -cancel option specified.

The actual process of shrinking an aggregate can be lengthy because zFS must scan every object in the file system to see whether it owns blocks in the portion of the aggregate to be released. If blocks are found, they are moved to the remaining portion. zFS then changes the size of the aggregate to the specified new size. After the size is changed, the DFSMShsm PARTREL service is called to release the space. Even if the process of releasing the space fails, zFS continues to operate with the new aggregate size.

Applications can continue to access the file system during the shrink operation, which can cause delays if the application needs to access blocks that are being moved by the shrink operation. To avoid these delays, it is recommended to shrink aggregates during periods of low file system activity, if possible.

Applications that are accessing the file system may also cause additional blocks to be allocated if data is added to files, or if files or directories are added to the file system. These new blocks that are allocated during a shrink operation are allocated in the portion aggregate that is to remain after the free space is released. If the aggregate runs out of free blocks in the portion of the aggregate that is to remain after the space is released, zFS will automatically increase the new size that was specified on the zfsadm shrink command so that more free blocks will be made available. This process is called active increase. If active increase causes the new size to go back to the original size, the shrink operation will be considered to have failed. If active increase is not to be used during a shrink operation, the -noai keyword should be specified on the zfsadm shrink command.

The size of the aggregate can be increased again with the zfsadm grow command. The aggregate can also be dynamically grown if it becomes full, as explained in Dynamically growing a compatibility mode aggregate. Any space that is still allocated to the data set is used first before another attempt is made to allocate more space.

If you attempt to unmount a shrinking compatibility mode aggregate, the attempt fails unless you specify unmount force.

For more information about shrinking aggregates, see zfsadm shrink.