Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find the size of directory in unix

Tags:

linux

unix

Problem Statement:-

I am getting 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 is the size of /tmp directory currently and because of that I am getting this exception. How can I see the 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 puzzled right now why I am getting that exception then as it clearly states above that I have space available.

like image 706
AKIWEB Avatar asked Dec 20 '22 14:12

AKIWEB


2 Answers

You can do (For SunOS)

# du -sh /tmp

To see how much it uses now, but that you already saw.

To see how much total, free and used space is on the partition where /tmp resides you can use:

# df -h /tmp

Note that filling up space is not the only thing that can prevent writing to filesystem.

Running out of inodes is another popular reason.

You can check that with

# df -i /tmp
like image 122
favoretti Avatar answered Dec 23 '22 04:12

favoretti


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

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

like image 38
pkm Avatar answered Dec 23 '22 02:12

pkm