cancel
Showing results for 
Search instead for 
Did you mean: 

du -sk * taking long time

 
SOLVED
Go to solution
chindi
Respected Contributor

du -sk * taking long time

Hi ,

 

We have 11iv2 server rx2660  4c/16gb ram.

Our root filesystem is 83% full , we would like to trim it  to 70% .

For which we have ran du -sk *|sort -n at root prompt ,

but its taking too much of time since we havae a filesystem which very deep , is there any way by which i can skip this filesystem and get the o/p of other directories and files ????

 

 

am sure there is some file or directory which is consuming unnneded space .

I need to find it .

4 REPLIES
Bill Hassell
Honored Contributor
Solution

Re: du -sk * taking long time

>> Our root filesystem is 83% full , we would like to trim it  to 70% .

The root filesystem should be virtually static. If anything is growing, it is probably in the wrong directory (logs, junk files, bad installations, etc).

 

>> For which we have ran du -sk *|sort -n at root prompt ,

Leave off -s because all you'll see are the first level directories.

Use this command instead:

 

du -kx / | sort -rn | head -20

 

The two largest directories *must* be /etc and /sbin. Anything else does not belong in /.

 

>> a filesystem which very deep , is there any way by which i can skip this filesystem and get the o/p of other directories and files ????

 

First problem: you have a bad filesystem that should not be in /

 

Most likely this bad filesystem is the problem and should be moved to another location (ie, /var).

It should be examined to see why the directory is so deep and perhaps redesigned or cleaned up.

If this problem directory must exist in /, move the directory to /var, then make a symbolic link to point to the new location, like this:

 

mv /badDirectory  /var

ln -s /var/badDirectory  /badDirectory

 

 

Second, you can run separate du commands on selected top level directories:

Make sure the directory is local to the root directory and not a mount point (like /var /opt...)

 

du -kx /etc /sbin /root | sort -rn | head -20

 

The root directory is critical to the system's health. The root home directory must NEVER be in /.

At least create a /root directory and change /etc/passwd to reflect root's new home.

 

Also, there should be *NO* files in /, only directories. No core files, junk files, temp files, or as I call them "root droppings". If the files are to be accesible using the original path (/), use a symlink as mentioned above and move the files to a more stable location.

 

All Unix-style systems need root's home moved out of /, and the contents of / should be restricted to stable directories like /etc and /sbin. Note that if /dev is more than a few hundred bytes (not kBytes), someone misspelled a device name, typically a tape drive (/dev/rmt/om is not the same /dev/rmt/0m). The /dev directory must have *NO* files in it, so search for the bad files like this:

 

find /dev -type f -exec ll {} \+

 

There should be nothing found.



Bill Hassell, sysadmin

Re: du -sk * taking long time

>find /dev -type f -exec ll {} \*

 

Did you intend the above to be "\;"?  Instead, this will be much faster if using "+":

find /dev -type f -exec ll {} +

 

You can correct typos using: Post Options > Edit Reply

pbedn1
Occasional Visitor

Re: du -sk * taking long time

an easy place to look at is in /root/home/ and zero out everyone's .sh_history file...that should trim some fat

Bill Hassell
Honored Contributor

Re: du -sk * taking long time

>> Did you intend the above to be "\;"?  Instead, this will be much faster if using "+":

 

Yep, obviously I have a defective keyboard...  ;-)



Bill Hassell, sysadmin