Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

du for root dir 2

Status
Not open for further replies.

gatetec

MIS
Mar 22, 2007
420
US
I need to find out the size of each file under root (/) and its sub dir, but so far I haven't had a luck.

du -m / |sort +0rn
du -m . |sort +0rn

etc etc

Can you pls help me on that?

thx a lot in adv.
 
du -ms /* | sort -rn

should do it, if I understand what you're asking.

You want to rank the disk space used by each of the subdirectories of the root directory, along with files actually in the root directory, right?

- Rod


IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

Wish you could view posts with a fixed font? Got Firefox & Greasemonkey? Give yourself the option.
 
Rod,

lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 2 2 closed/syncd N/A
hd6 paging 180 360 2 open/syncd N/A
hd8 jfslog 1 2 2 open/syncd N/A
hd4 jfs 2 4 2 open/syncd /
hd2 jfs 9 18 2 open/syncd /usr
hd9var jfs 4 8 2 open/syncd /var
hd3 jfs 2 4 2 open/syncd /tmp
hd1 jfs 1 2 2 open/syncd /home
hd10opt jfs 1 2 2 open/syncd /opt

It just gives the sum:

377.07 /var
345.93 /tmp

So, still the size of each file under root (/) and its sub dir is not showing.

thx much

 
I'm still not sure what you're looking for. Could you restate it, or make up an example of how it would look?

You can do a long listing of every file on the system by using "ls -lR /", if that's what you want.

- Rod


IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

Wish you could view posts with a fixed font? Got Firefox & Greasemonkey? Give yourself the option.
 
Rod,

ls -lR / |sort +4nr |more
-rw-r--r-- 1 root system 927909409 Jan 27 06:05 check_printq.log
-rw-r--r-- 1 patrol system 619666036 Jan 27 19:54 param.hist

This gives the size of each file, but not which dir the file is under.

It wuld be great if it gives like:
1200.21 /
3.2 fileA
2.7 fileB
2.4 fileC
.... etc ....

377.07 /var
2.2 fileA
1.8 fileB
1.1 fileC
.... etc ....
345.93 /tmp
3.2 fileA
2.8 fileB
1.7 fileC
.... etc ....

Would that be possible?

thx much
 
Anything's possible for the man who doesn't have to do it. :)

Search around for "script tree disk space" and you should find plenty of ways to do it.

- Rod


IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

Wish you could view posts with a fixed font? Got Firefox & Greasemonkey? Give yourself the option.
 
before going through tools out there,

this ( find / -ls |sort +4nr |more ) would work for me as long as I can exclude certain dirs i.e. /proc under root (/).

find: 0652-023 Cannot open file /proc/491944.
sort: 0653-657 A write error occurred while sorting.

Any thoughts on this?

thx muxh for your help.
 
how about something akin to

find / -ls|grep -v "/proc/"|sort +4nr

You might want to adjust the grep to ensure that it is only the /proc directory that is ignored and doesn't ignore any subordinate directories called proc

Dave
 
find / -ls|awk '$11 !~ /^\/proc/'|sort +4nr

should exclude /proc

Dave
 
Since I'm guessing you only care about real files, then

find / -type f -ls | sort +4nr | more

should do it.

The "sort: 0653-657" error was caused, most likely, by quitting "more" before you got to the end of the output.

- Rod


IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

Wish you could view posts with a fixed font? Got Firefox & Greasemonkey? Give yourself the option.
 
I am still getting:

root:/> find / -ls|awk '$11 !~ /^\/proc/'|sort +4nr
find: 0652-019 The status on /proc/400824 is not valid.
root:/> find / -type f -ls | sort +4nr | more
sort: 0653-657 A write error occurred while sorting.

It seems |sort takes time and timed out.
Any way to get around it?

thx much
 
Are you running out of space on /tmp?

From the looks of the strings in the "sort" binary, it might be writing scratch files there. Since "sort" is reporting the error, that seems a likely cause.

- Rod


IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

Wish you could view posts with a fixed font? Got Firefox & Greasemonkey? Give yourself the option.
 
The issue is on /.

Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 2.00 0.00 100% 4918 1% /
 
I found the reason why / was filled up 100%.
There was a filesystem that was not mounted, thus it affected / when it had many files with large size.

If there is .ksh that can get filesystems that are not mounted and give me du, that will be great.

Any ideas, please?

thx much
 
You can't check [tt]du[/tt] for an unmounted filesystem, since [tt]du[/tt] has to examine the filesystem.

Check [tt]man mount[/tt] for instructions on mounting a filesystem temporarily at a point other than its defined mount point.

I'm still not sure what exactly it is you're looking for. What is the problem you're trying to solve?

- Rod


IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

Wish you could view posts with a fixed font? Got Firefox & Greasemonkey? Give yourself the option.
 
With severqal tries, I realized that it is not quite possible to check sizes of EACH files under dirs under / with command lines. It seems that the only solution avail would be to run customized scripts. Your inputs were very helpful though..

thx much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top