- Using Client based tools: The most effective method of viewing LUN consumption from the client perspective is to use client-side tools such as Windows Explorer or UNIX 'du'. Windows Disk Management can also be used to show the LUN size.
- Using Filer storage based tools: If LUN is already in use and data has been written to the LUN: Create a new volume, create a new LUN, and ndmp copy the old LUN data to the new LUN , and df -r.
Using the methods above will show the exact size of the consumed LUN space.
NOTE: The df -r command will effectively display the consumed LUN space as long as the following are true. a. There is only 1 LUN within the volume. b. There are no snapshots of the LUN within the volume. c. Space reservations are turned off on the LUN. Space reservations and Fractional reserve will affect the usage displayed.
LUN size displayed on the filer via df -r and client utilities may differ in size.
There are two distinctions in the way LUN space consumed can be viewed:
1. LUN Space can be viewed as Filer Storage Blocks consumed within the WAFL volume. Due to the way some operating systems format the LUN, the filer will see the LUN as a sparse file.
2. LUN Space can be viewed as the amount of space consumed by the Client Operating System within the LUN. This view displays the Operating System's view of amount of space consumed and LUN size. Client operating systems may have data written to blocks within the LUN that is not actual user data.
The OnCommand/System manager displays the %used space of the LUNs even if there are more than one LUN in a volume irrespective of whether it is space reserved or not. But what is the command it usesinternally to findout this %used space?
In Ontap 8 the "lun show -v" output now also shows the "Occupied Size" for a LUN. As already discussed this will only show how much has been used by the OS and not how much free space there is in the filesystem.
As I understand, the 'used' colmun of an 'aggr show_space -h' command shows the actual usage of the space, even inside thick provisioned volumes/LUNs. Tricky part however, is that the OS filesystem doesn't report freed blocks back to the controllers, so the used space usually only increases. The Space Recaimer feauture of SnapDrive for Windows is used to circumvent this.
The only reliable way is to look at the LUN on the host. The storage controller cannot see inside the LUN. There are only a few corner cases where it's possible to tell how much space is in a single LUN, (one thin provisioned volume in an aggregate with one thin provisioned LUN inside...not a typical case). You can see how much volume or aggregate space you have, but to know how much space is available inside the LUN you have to go through the host as only the host knows the filesystem, etc.
It is not the same. LUN may be 100% free from host’s point of view, but 100% full from filer point of view.
There is ZAPI call lun-get-occupied-size which looks like it does provide this information (not tested): Size occupied by the LUN in the Active FS in bytes. I am not aware of any CLI option (even in diag mode) that would return the same.