zfsadm shrink

Purpose

zfsadm shrink reduces the physical size of a zFS aggregate. The aggregate must be mounted before it can be shrunk.

The zfsadm shrink command releases unused space from the aggregate data set so that the resulting physical size of the data set is approximately the new total size that was requested by the -size option.

Format

zfsadm shrink -aggregate name {-size KBytes [-noai] | -cancel}
              [-trace file_name][-level][-help]  

Options

-aggregate name
Specifies the name of the aggregate to be shrunk. The aggregate name is not case-sensitive. It is always converted to uppercase.
-cancel
Cancels an in-progress shrink operation for the specified aggregate.
-help
Prints the online help for this command. All other valid options that are specified with this option are ignored.
-level
Prints the level of the zfsadm shrink command. This option is useful when you are diagnosing a problem. Except for -help, all other valid options that are specified with -level are ignored.
-noai
The new total size is not to be increased if more space is needed. For more information about active increase, see Usage notes for zfsadm shrink.
-size Kbytes
Specifies the new total size in kilobytes of the aggregate after the shrink operation is completed. The size is rounded up to an 8 K boundary.
-trace file_name
Specifies the name of the file that will have the trace records written into it. The trace file can be a z/OS UNIX file, an existing MVS sequential data set, or a member of either an existing partitioned data set (PDS) or partitioned data set extended (PDSE). Use this option only at the direction of IBM Support.

For information about preallocation instructions for debugging, see Step 5 (Optional) Preallocate data sets for debugging in zFS installation and configuration steps.

Because MVS data set names must be fully qualified, z/OS UNIX has special rules for specifying MVS data set names in the shell environment. For more information, see Specifying MVS data set names in the shell environment in z/OS UNIX System Services Command Reference.

Usage notes for zfsadm shrink

  1. Shrinking an aggregate is a long-running administrative operation. This process involves moving any blocks that are in the portion of the data set to be released into the portion that will remain. This can be a long process because each internal aggregate structure has to be scanned to determine whether it owns any blocks that need to be moved. The two aggregate structures that can be the largest are the bitmap and the anode table (also called the File System Inode Table). The larger the bitmap and anode table are, the longer this will take. Therefore, it is expected the bulk of the time of the shrink operation will occur in scanning them. After all block movement is completed, the free space is released. zFS will consider the new size of the aggregate to be the new total size, even if the partial space release fails. See z/OS DFSMSdss Storage Administration and z/OS DFSMSdfp Advanced Services for more information about releasing space from VSAM data sets.
  2. You can monitor the progress of the shrink operation by checking the progress indicators that are displayed in the owner information of an FSINFO command to the aggregate. These steps are intended for use by IBM Service personnel and should not be used as a programming interface. The movements of the bitmap and the anode table are the steps that require the bulk of the time, so they have a percentage complete value. The percentage complete value for the anode table movement can at times appear to be decreasing. This change can happen because user activity is causing the creation of new files and directories, which in turn causes an increase in size of the anode table. The percentage complete is calculated each time FSINFO is called, so even though more anodes have been processed, these anodes can be a smaller percentage of the current total number of anodes. The FSINFO owner display contains the size of the bitmap and anode table.
  3. The difference between the new total size of the aggregate and the current size of the aggregate cannot be larger than the free space in the aggregate.
  4. To process the request, the long-running command thread pool must have an available foreground thread. See the IOEFSPRM configuration option long_cmd_threads for information about controlling the size of the long-running foreground and background thread pools. ( IOEFSPRM)
  5. Most of the shrink operation allows other applications to access file and directory blocks during the shrink operation. This might cause additional blocks to be allocated. If this allocation causes more space to be needed in the aggregate than the new total size specified in -size, zFS will actively increase the new total size. The shrink command ends with an error if the size is actively increased back to the original size of the aggregate. You can prevent active increase by specifying -noai. If -noai is specified, and an active increase is needed, the shrink command ends with an error.
  6. Ideally, aggregates should be shrunk during periods of inactivity because shrink operations can take longer to complete if applications are updating files and directories.
  7. A shrink operation can be interrupted by using the -cancel option or during a shutdown. It can also be interrupted when the shell command unmount or TSO/E command UNMOUNT is issued with the force option. If the system that is performing the shrink operation ends (via shutdown or abnormally), any new zFS owner of the aggregate will not continue the shrink operation. Another shrink command will need to be issued if you still want to do the shrink operation.
  8. You can control whether SMS-managed zFS aggregates that are assigned to a management class are allowed to shrink by use of the Partial Release setting in the management class definition. zFS aggregates that are allocated with guaranteed space will use the Conditional Partial Release setting to determine if a shrink is allowed. zFS aggregates that are not SMS-managed, or are SMS-managed and not assigned to a management class, will always be allowed to shrink. For more information about management classes, see Defining management classes in z/OS DFSMSdfp Storage Administration.
  9. You cannot shrink an aggregate that is in a partially encrypted, partially decrypted, partially compressed, or partially decompressed state. In other words, if encryption, decryption, compression, or decompression was interrupted for an aggregate, you cannot shrink it.
  10. Files and directories that are in the fragmented format will be converted to blocked format if the shrink operation needs to move them. If there are not enough free 8 K blocks for this conversion, the shrink operation will fail.
  11. Aggregates with active file backups cannot be shrunk.

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

Privilege required

The user must have UPDATE authority to the VSAM linear data set.

Examples

The following command shrinks aggregate PLEX.ZFS.AGGR1 to a size of 1400480 K:
zfsadm shrink -aggr PLEX.ZFS.AGGR1 -size 1400480
IOEZ00873I Aggregate PLEX.ZFS.AGGR1 successfully shrunk.

Related information

Commands:
  • zfsadm fsinfo
  • zfsadm grow
Files:
  • IOEFSPRM