Skip to main content

How the ls command accounts for space usage

When you use the ls command to view the contents of a FlexVol volume mounted on a Linux client, the file sizes displayed in the output could be lesser or more than the space usage displayed in the quota report for the volume depending on the type of data blocks for the file.

The output of the ls command displays only the size of a file and does not include indirect blocks used by the file. Any empty blocks of the file also get included in the output of the command.

Therefore, if a file does not have empty blocks, the size displayed by the ls command might be less than the disk usage specified by a quota report because of the inclusion of indirect blocks in the quota report. Conversely, if the file has empty blocks, then the size displayed by the ls command might be more than the disk usage specified by the quota report.

The output of the ls command displays only the size of a file and does not include indirect blocks used by the file. Any empty blocks of the file also get included in the output of the command.

Example of the difference between space usage accounted by the ls command and a quota report

The following quota report shows a limit of 10 MB for a qtree q1:
                                      ----Disk----  ----Files-----   Quota
Volume Tree Type ID Used Limit Used Limit Specifier
------- -------- ------ ------- ----- ----- ------ ------ ---------
vol1 q1 tree user1 10MB 10MB 1 - q1

...
A file present in the same qtree can have a size exceeding the quota limit when viewed from a Linux client by using the ls command, as shown in the following example:
[user1@lin-sys1 q1]$ ls -lh
-rwxr-xr-x 1 user1 nfsuser 27M Apr 09 2020 file1