Find directory size on unix

Problem: -

I get this below exception -

org.apache.hadoop.hdfs.protocol.DSQuotaExceededException: org.apache.hadoop.hdfs.protocol.DSQuotaExceededException: The DiskSpace quota of /tmp is exceeded: quota=659706976665600 diskspace consumed=614400.1g 

So, I just wanted to know how much the / tmp directory is now, and because of this I get this exception. How can I see free space in / tmp?

Update: -

 bash-3.00$ df -h /tmp Filesystem size used avail capacity Mounted on rpool/tmp 10G 2.2G 7.8G 22% /tmp 

I am now puzzled why I am getting this exception, as it clearly states above that I have free space.

+4
source share
3 answers

You can do (for SunOS)

 # du -sh /tmp 

To find out how much he is using now, but what you have already seen.

To find out how much total, free and used space is in the section where /tmp is located, you can use:

 # df -h /tmp 

Please note that filling the space is not the only thing that can interfere with writing to the file system.

The launch of inodes is another popular reason.

You can check that with

 # df -i /tmp 
+10
source

for a in ls ; do du -ch $ {a} | total grep; echo $ {a}; done

try this, but it takes time if the dir size is in GBs

+1
source

Managing quotas for HDFS space It is important to understand that in HDFS there must be enough quota space to accommodate the entire block. If a user has, say, 200 MB free in his allocated quota, he cannot create a new file, regardless of the file size, if the HDFS block size is 256 MB. You can set the HDFS space quota for the user by running the setSpace-Quota command. Here is the syntax:

 $ hdfs dfsadmin –setSpaceQuota <N> <dirname>...<dirname> 

The space quota you specify serves as the upper limit on the total size of all files in the directory. You can set the space quota in bytes (b), megabytes (m), gigabytes (g), terabytes (t) and even petabytes (by specifying p - yes, this is big data!). And here is an example that shows how to set a user space quota of 60 GB:

 $ hdfs dfsadmin -setSpaceQuota 60G /user/alapati 

You can set quotas for several directories at once, as shown here:

 $ hdfs dfsadmin -setSpaceQuota 10g /user/alapati /test/alapati 
0
source

Source: https://habr.com/ru/post/1441967/


All Articles