1827705 Members
2777 Online
109967 Solutions
New Discussion

Re: Disk Usage using du

 
SOLVED
Go to solution
Chern Jian Leaw
Regular Advisor

Disk Usage using du

Hi
I tried doing the following:
$du -k -s /
It produced the following messages for all directories under /:
du: cannot change to dir /tmp/image/ :Permission denied

Also, when I did another du on another filesystem, i.e. $du -k -s /fs36/nwd.srtl.cr, it produced:
du: cannot open
du: bad status

Could someone tell me what is the reason to all these error messages and how I could rectify it?

Thanks.
4 REPLIES 4
steven Burgess_2
Honored Contributor

Re: Disk Usage using du

Hi

Are you 'root' user whilst performing the actions ?

Steve
take your time and think things through
Chern Jian Leaw
Regular Advisor

Re: Disk Usage using du

Steve,
No, I'm not logged in as root whilst performing this action. I'm able to perform a df on mentioned filesystem.

Do I need to be a root user to execute du? I'm not logged into a fileserver.

I've managed to execute du on other filesystems on different hosts before.

Could you please explain?

Thanks.
steven Burgess_2
Honored Contributor
Solution

Re: Disk Usage using du

Hi

I've just tried it on of my servers as my standard ID and root

I received errors when using my ID similar to yours - None whilst root user

It will depend on the permissions of the files in the directory - if the user is unable to read the file it will not be able to calculate the size

Regards

Steve
take your time and think things through
T G Manikandan
Honored Contributor

Re: Disk Usage using du

If you are doing a du -sk for a directory you should have read and execute permissions on that directory.YOur message shows that you do not have read and execute permissions for that directory.So the reason is that you are unable to open the directory.
May the permission now are
drwx------
dr-xr--r--

In the first case the owner has read,write and execute permissions.The group and others have no permissions.

In the second case the owner has read and execute permissions.The group has read permissions and others have read permissions.

If you are the owner for that directory
drwx------ is enough.
If you are not the owner
then
drwxr-xr-x permissions is neccessary.
change the permissions of that directory with
read and execute permissions for everyone,you can do a du-sk.

Thanks