list the size of directories in a mount point

Latest response

a simple method to list the directories and their sizes in descending order

:/vol/mountpointname_shared
200G 180G 21G 90% /shared

180GB utilised and the user wants to know which dir is comsumingmore space

Responses

To determine which sub-directory of /x/y/z occupies the most space, you could issue the following commands:

cd /x/y/z
du -sm * .??* 2>/dev/null | sort -n

The ".??*" is meant to catch any sub-directories whose names start with a "dot". These commands produce a list of directories with increasing occupation (in MB), provided the user issuing the command has access to all sub-directories.

okay thank you. checking. It seems to take a lot of time to give me the output..

cat /etc/redhat-release

Red Hat Enterprise Linux Server release 6.9 (Santiago) #

I was using these commands that I got from inter but I have to give up eventually as the output never came even after waiting for 10 minutes

Now I am waiting for the out from your command Siem.

du -sm * .??* 2>/dev/null | sort -n

May be because the mount point is 200GB it takes a lot of time ?

When doing this kind of query, largeness of objects queried typically has lower adverse impact on the query-speed than the number of objects that have to be queried. When there are scads of small files - particularly with some filesystem-types or if querying a network-share — query-speed can be very slow.

Agree, thanks

I was using these commands that I got from internet but I have to give up eventually as the output never came even after waiting for 10 minutes

du -h --max-depth=1 | sort -hr

^C

du -sh * | sort -h

^C #

Now I am waiting for the output from your command Siem.

du -sm * .??* 2>/dev/null | sort -n

May be because the mount point is 200GB it takes a lot of time ?

Sure, the amount of data, the latency of the network and the speed of the filer/disks determine the required time.

Siem I waited for over an hour - I never got the output.

Went deep inside a directory and executed the commands there - same is the case. it is taking time....dont know how much but so far I never got a reply from the server

Hello Moosad,

What do you mean by the :/vol/mountpointname_shared?

Is this a network share?

If so, do you have access to the server or NAS box that provides the share?

This would be the place to run the commands provided by Siem, if the server is running a Linux or Unix operating system.

I prefer not run the commands on a NFS or Samba client.

Regards,

Jan Gerrit Kootstra

Running those kinds of commands client-side is great ...if you're getting ready to head out the door for lunch. =)

yes it it a network share

Oof... Those do really horridly when there's lotsa small files to iterate.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.