Wednesday, July 8, 2015

The best way to find what is using all the disk space

disk space rtvdskinf prtdskinf

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
Disk Space Report System Information* % of Size in Description Disk 1,000,000 bytes i5/OS items reported: History files .00 30.15 Journal receivers .18 1560.43 User profiles .07 569.83 Configuration information .00 12.26 System help (QHLPSYS) .01 43.97 Calendars .00 2.03 System directories .00 3.58 Document files .00 2.54 OfficeVision items reported: Enrollment .00 .00 Mail files .00 .00 Text search .00 .00 Personal directories .00 .00 Licensed Internal Code: LIC and tables .40 3453.61 Dump space .13 1077.94 Error logs .00 34.67 Trace tables .00 .00 VLIC logs .02 188.75 VLIC control blocks .00 3.24 * This list points out items of interest and does not contain all objects on the system. For more information, see AS/400 System Operation V3R6, SC41-4203.
Disk Space Report System Information* % of Size in Description Disk 1,000,000 bytes Space used by system internal objects: Additional configuration information .00 .12 Communications .00 7.25 Data base .06 515.35 Manage jobs .17 1461.47 Monitor performance .00 .00 Folders .00 .24 Mail .00 .66 i5/OS .01 42.95 S/36 Environment .00 .00 Security .00 10.83 SNADS and object distribution .00 6.51 Spool .04 344.38 Cross component .00 32.40 Product installation .00 .12 Recovery of information .00 1.38 Obsolete .00 2.24 Internal system journals .00 35.70 Miscellaneous items reported: Printer output & Spooling (QSPL) .33 2844.68 Replaced object library (QRPLOBJ) .00 2.90 Storage affected by RCLSTG .00 .00 Reclaim storage library (QRCL) .00 .10 * This list points out items of interest and does not contain all objects on the system. For more information, see AS/400 System Operation V3R6, SC41-4203. * * * * * E N D O F L I S T I N G * * * * *

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:


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:


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



04  IF         COND(&JOBTYPE = '1') THEN(DO)
05     RETURN





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.


  1. Good blog-post! Personally, I use RtvDskInf to gather the raw data, and I use SQL to query the resulting file (qusrsys.qaezdisk), ordering by object-size, in descending order. I can often identify the "main culprits" pretty easily that way.

    -- Dave Ford

  2. GO DISKTASKS and setup/run a collection then select the PRINT option to run report with options you want. Or submit a DSPOBJD *ALL/*ALL to an output file then query the file and sort by object size. The disktasks option can be setup to run on the scheduler then you can just select the PRINT which runs very quickly.

    1. Trouble with DSPOBJD is it does not list the objects in the IFS.

    2. Correct you are. I have a separate command for that one in qshell. Have to find it though

    3. Actually you can obtain IFS info on object type of *stmf with DISKTASKS option 2 but it's not very good. A better way is to STRQSH then type the following: find / -type f -size +100000 -exec ls -lrt {} \; | sort -r +4. This will start at the root level and propagate down and give you a list (for example) of objects larger than 100000 512k blocks and sorts by size (largest first) etc. the IFS is simply a pain!!

  3. You could easily write a VTOC program using CL that will provide a nice neat listing.

  4. nice post ! one question on PRTDSKINF, have you noticed the output QPEZDISK sometimes lists 'ghost' objects (the objects that actually not in the disk) ? Or that I'm reading it wrong ?

  5. ok, caught the ghost. RTVDSKINF was not run recently.

  6. Re your comment about i5/OS Simon - it is actually worse than that. I just ran the PRTDSKINF command and found this in the listing:

    * This list points out items of interest and does not contain all
    objects on the system. For more information, see AS/400 System
    Operation V3R6, SC41-4203.

    Yup AS/400 - V3R6!!! Boo hiss IBM.

    1. ... and they say IBM i image as an outdated AS/400 is all the fault of developers :)


To prevent "comment spam" all comments are moderated.
Learn about this website's comments policy here.

Some people have reported that they cannot post a comment using certain computers and browsers. If this is you feel free to use the Contact Form to send me the comment and I will post it for you, please include the title of the post so I know which one to post the comment to.