Copying each file and directory of the aggregate to a larger data set

One method to increase the size of a zFS aggregate is to copy each file and directory of the aggregate to a larger data set. Figure 1 shows an example of this approach.
Figure 1. Sample job to copy each file and directory of an aggregate to a larger data set
//SUIMGVMB JOB ,'EXPAND AGGR WITH PAX',
//         CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
//* Make sure you have no line numbers in this JCL
//DEFINE   EXEC   PGM=IDCAMS
//SYSPRINT DD     SYSOUT=H
//SYSIN    DD     *
     DEFINE CLUSTER (NAME(PLEX.NEW.AGGR002.LDS0002) -
            LINEAR CYL(100 5) SHAREOPTIONS(3) -
            VOLUMES(CFC000 CFC001))
/*
//FORMAT   EXEC   PGM=IOEAGFMT,REGION=0M,
//* On the next line, aggregate and compat must be lower case
// PARM=('-aggregate PLEX.NEW.AGGR002.LDS0002 -compat')
//SYSPRINT DD     SYSOUT=H
//*******************************************************************
//**                                                               **
//**  note - use a + sign at the end of each line to indicate there**
//**         is another line to be processed.                      **
//**         use a ; at the end of each COMMAND                    **
//**                                                               **
//**         a single command can span multiple lines if each line **
//**         ends in a +.  when you have reached the end of the    **
//**         command, terminate the command with a ;               **
//**                                                               **
//*******************************************************************
//PAX1     EXEC PGM=IKJEFT01,REGION=0M
//SYSTSPRT DD  SYSOUT=*
//SYSEXEC  DD  DSN=SYS1.SBPXEXEC,DISP=SHR
//SYSTSIN  DD  *
 OSHELL /usr/sbin/mount -t ZFS -f PLEX.OLD.AGGR002.LDS0002           +
  /service2                                                        ; +
   /usr/sbin/mount -t ZFS -f PLEX.NEW.AGGR002.LDS0002 /service3    ; +
   cd /service2                                                    ; +
   pax -rwvCMX -p eW . /service3                                   ;
/*
//* The result of these next two steps should show that
//* More free space is available in the new file system
//AGGRINF1 EXEC PGM=IOEZADM,REGION=0M,
// PARM=('aggrinfo PLEX.OLD.AGGR002.LDS0002 -long')
//SYSPRINT DD  SYSOUT=*
//STDOUT   DD  SYSOUT=*
//STDERR   DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
//CEEDUMP  DD  SYSOUT=*
/*
//AGGRINF2 EXEC PGM=IOEZADM,REGION=0M,
// PARM=('aggrinfo PLEX.NEW.AGGR002.LDS0002 -long')
//SYSPRINT DD  SYSOUT=*
//STDOUT   DD  SYSOUT=*
//STDERR   DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
//CEEDUMP  DD  SYSOUT=*
/*
This approach uses the pax command to copy the individual files and directories into an already formatted and empty zFS file system. Both file systems must be mounted. pax uses the z/OS® UNIX file and directory APIs to read and write each individual file and directory of the hierarchy of the file system. (It does not copy lower mounted file systems because of the -X and -M options.) You can use the ISHELL command or the automount command with the allocany or allocuser keyword to create the new larger aggregate to copy into with pax, because they format the aggregate.
If you are running this job on a system that is running z/OS V1R13 or later, and the file system was written to using a prior release of z/OS, zFS might use more DASD space for the same data than it did on the prior release. The increase in DASD space can occur for small files (1 KB in size or less) because beginning with z/OS VR13 zFS does not store data in 1-KB fragments; instead, it stores data in 8-KB blocks. For example, if the file system contained 1000 files that are 1 KB in size, zFS Start of changeon z/OS V1R13 or laterEnd of change could use a maximum of 10 cylinders more than on previous releases. You can determine how many files are in the file system that are 1 KB or less by using the following z/OS UNIX command:
find mountpoint  -size -3 -type f -xdev | wc -l

After you successfully copy the data, when you are comfortable with the new, larger aggregate, you can delete the old aggregate.