Almost by accident I have started discussions on how to determine the largest objects on your IBM i server. I have given examples of how:
- Identify the 250 biggest objects using the DSPOBJD command, followed by a SQL statement, see here.
- Retrieve the number of deleted records/rows in files/tables, see here.
While both of these are useful they do not provide an overall picture of the status of the disk utilization. Fortunately there are two command I can use to get to that information:
- RTVDSKINF - Retrieve the disk information.
- PRTDSKINF - Print the retrieved disk information in a number of different formats.
When the RTVDSKINF command is run it takes a "snap shot" of the current disk information into the file QAEZDISK in the library QUSRSYS. The command comes with two parameters, the first for which ASP device to retrieve the information for, and the second for how damaged objects are handled. When I run this command I leave it with the defaults to include all ASPs and not to delete or move damaged objects.
The profile that is used to run the RTVDSKINF command must have *ALLOBJ authority and enrolled in the system distribution directory to gather all the information. You can learn how to enroll a user profile in the system distribution directory here.
This is the part of the process that takes several hours to run.
Once the retrieve command has finished I can then run the print command to list the information. I have to admit that is the thing I do not like about this process is that the output is spool file and not output file.
To print I use the PRTDSKINF, Print Disk Information, command. The command has a number of parameters that allow me to select what information I want. I am not going to list the possibilities, just the ones I use.
The first part of every print is the "system" information. I can just print the system information by using the value *SYS in the Type of report, RPTTYPE, parameter. It does print on all the other variations of the report too. If you know how to stop it from printing for the other reports please let me know by using a comment, below, or using the contact form on your right.
To list the system information the command would look like:
And the spool file looks like (I have had to remove some of headings to fit the width of this page):
Disk Space Report System Information Information collected . . . . . . . . . : DD/DD/DD TT:TT:TT Total disk space on system in 1,000,000 bytes . . . . . . . . . . . . . . . . : 858993 Main storage size in megabytes . . . . . : 6144 % of Size in Description Disk 1,000,000 bytes User libraries 68.80 591029.58 User directories 2.85 24447.04 Folders and documents .06 480.73 QSYS .62 5355.52 Other IBM libraries 1.11 9495.74 Licensed Internal Code .55 4758.21 Temporary space .63 5423.30 Unused space 25.26 216987.99 System internal objects .29 2461.60 Objects not in a library .00 .00 TOTAL 100.17 860439.71
It would appear that the program used to generate has not have been changed for a few releases as it categorizes the IBM i operating system as "i5/OS". Come on IBM change it to the new name!
I am going to want to find the largest objects in the IBM i environment, and to do this the PRTDSKINF command would look like:
PRTDSKINF RPTTYPE(*OBJ) OBJ(*ALL) MINSIZE(10) SIZE(*SIZE)
The command's parameters mean that it:
- Lists only objects: RPTTYPE(*OBJ)
- For all object types: OBJ(*ALL)
- That are greater or equal to 10 thousand bytes: MINSIZE(10)
- Sorted by size with the largest object appearing first: SORT(*SIZE)
The first three pages look like the System version of the print, and only on the fourth page do I get to the information about the objects:
Disk Space Report Specific Object Information % of Size in Last Last Object Library Type Owner Disk 1000 bytes Change Use Description FILE1 LIB1 *FILE USER1 2.13 18278023.2 05/01/15 05/01/15 Temp copy of order header FILE2 LIB2 *FILE QDFTOWN 1.18 10096382.0 06/22/15 06/25/15 Inventory transaction history QDBJXQ0002 QRECOVERY *JRNRCV QSYS .72 6222635.0 06/22/15
Only the names have been changed to protect the innocent objects.
With these commands I can also list the folders in the IFS, which I cannot do with the DSPOBJD command. Yes folders, not the files within them:
PRTDSKINF RPTTYPE(*FLR) SORT(*SIZE)
Ignoring the first three pages, the report lists the folders like this:
Disk Space Report Folder Information % of Size in Last Folder Owner Disk 1000 bytes Change Folder Path FOLDER1 USER1 .04 351535.1 04/17/15 TMP USER1 .00 35331.6 08/31/14 FOLDER2 USER2 .00 31370.2 10/28/13
As this process does take several hours to run I have put all of the necessary commands in a CL program that I can call, rather than run the commands individually, see below:
01 PGM 02 DCL VAR(&JOBTYPE) TYPE(*CHAR) LEN(1) 03 RTVJOBA TYPE(&JOBTYPE) 04 IF COND(&JOBTYPE = '1') THEN(DO) 05 SBMJOB CMD(CALL PGM(DSKINF)) JOB(DSKINF) JOBQ(job_queue) 05 RETURN 07 ENDDO 08 RTVDSKINF 09 PRTDSKINF RPTTYPE(*OBJ) OBJ(*ALL) SORT(*SIZE) 10 PRTDSKINF RPTTYPE(*FLR) SORT(*SIZE) 11 ENDPGM
The section between lines 2 – 7 is where the programs submits itself to batch. You can read about how to do this in the post CL program that submits itself to batch. I submit the program to a different job queue than the one used by other jobs. As this is going to take several hours to complete, I do not want it to hold up all the other submitted jobs.
On line 8 the RTVDSKINF command is executed.
The on line 9 and 10 the two PRTDSKINF reports are generated.
I can prints off a range of the pages from the generated reports and work to delete, purge, or whatever to reduce the amount of disk space used. As the RTVDSKINF produces a "snap shot" that is used by the PRTDSKINF commands, I will have to execute this again after my work to see how much disk spaces I have freed.
You can learn more about these from the IBM web site:
This article was written for IBM i 7.2, and should work for earlier releases too.