How to get the quota of a directory for HDFS

hadoop fs -count -q /path/to/directory
QUOTA  REMAINING_QUOTA SPACE_QUOTA    REMAINING_SPACE_QUOTA DIR_COUNT  FILE_COUNT CONTENT_SIZE   FILE_NAME
none   inf             54975581388800 5277747062870         3922       418464     16565944775310 hdfs://master:54310/path/to/directory

The third column will give you the space quota.

NOTE: The column titles have just been added there for ease of reading, if you want to read more about the different ways of gettings the filesize of hdfs there's a comprehensive blog post here:

Understanding HDFS Quotas and Hadoop Fs and Fsck Tools


hadoop fs -count -q -h -v /path/to/directory

I would add -h and -v options for easy to read the output. With the -q option, also report the name quota value set for each directory, the available name quota remaining, the space quota value set, and the available space quota remaining. If the directory does not have a quota set, the reported values are none and inf. The -h option shows sizes in human readable format. The -v option displays a header line.

Tags:

Hadoop

Hdfs