I have been remiss in writing about the updates in the past few Technology Refreshes to the SYSDISKSTAT View and Table function. Both the View and Table function return information regarding the spinning disk and solid-state drives, SSD, on your partition(s). While, IMHO, they can be used for different purposes, they do contain the same columns.
The columns I have identified that have been added since my previous post are:
- HARDWARE_STATUS: The status of the "disk" unit. There are many different statuses, refer to the link at the bottom of this post to the IBM Documentation for what they all are
- IS_ZERO: Returns whether all the pages on the disk unit are zero
- HOST_WWPN: Hexadecimal decimal string to represent the resource's host world wide port name
- REMOTE_WWPN: Hexadecimal decimal string to represent the resource's remote world wide port name
- UNIT_NVME: Whether this is a NVMe unit. 1 = It is, 0 = It is not
Let me show what the contents for this new columns are on the partition I am using:
01 SELECT RESOURCE_NAME,RESOURCE_STATUS, 02 HARDWARE_STATUS, 03 IS_ZERO, 04 UNIT_NVME 05 HOST_WWPN, 06 REMOTE_WWPN 07 FROM QSYS2.SYSDISKSTAT 08 ORDER BY 1 09 LIMIT 5 |
Line 1: These two columns are not new, they are the ones I would use to identify the resource and its status.
Lines 2 – 6: The new columns.
Line 7: I am retrieving this information from the SYSDISKSTAT View.
Line 8: I want to sort my results by the first column, resource name.
Line 9: For this post I only want to retrieve the first five results. If you are running this statement for the first time I recommend you omit this line so that you can see what information you can retrieve for all of your drives.
RESOURCE RESOURCE HARDWARE IS_ UNIT _NAME _STATUS _STATUS ZERO _NVME HOST_WWPN REMOTE_WWPN -------- -------- -------- ---- ----- ---------------- ---------------- DMP001 PASSIVE ACTIVE NO 0 C050760C68270024 5005076812153B9B DMP002 PASSIVE ACTIVE NO 0 C050760C68270024 5005076812153B9B DMP003 ACTIVE ACTIVE NO 0 C050760C68270024 5005076812153B9A DMP004 PASSIVE ACTIVE NO 0 C050760C68270024 5005076812153B9A DMP005 ACTIVE ACTIVE NO 0 C050760C68270024 5005076812153B9B |
The Hardware Status of active means that the unit is operational and ready to be used for input and output operations.
The IS_ZERO column is all "No" as there is at least one page on the drive that is not zero.
Alas, none of the disk units on this partition are a NVMe unit.
For just looking at the contents of these columns using the View is easiest. But I could use the SYSDISKSTAT Table function and return the same columns:
01 SELECT RESOURCE_NAME,RESOURCE_STATUS, 02 HARDWARE_STATUS, 03 IS_ZERO, 04 UNIT_NVME, 05 HOST_WWPN, 06 REMOTE_WWPN 07 FROM TABLE(QSYS2.SYSDISKSTAT()) 08 ORDER BY 1 09 LIMIT 5 |
The results returned are the same as for those returned by the View.
You can learn more about this from the IBM website:
This article was written for IBM i 7.5 TR4 and 7.4 TR10.
Why is there both a view and a table function? When would you use one over the other?
ReplyDeleteFor the examples as I have given them above there is no real difference.
ReplyDeleteBut, the Table function has a parameter that allows me to reset the statistics for the storage:
SYSDISKSTAT(RESET_STATISTICS => 'YES')
Personally if I did not want to reset the statistics I would use the View.
I would only use the Table function if I wanted to reset the statistics.