1832991 Members
2418 Online
110048 Solutions
New Discussion

File system cleanup

 
Victor_5
Trusted Contributor

File system cleanup

It is not my first time to meet this problem, any idea?

For example, /var hit 95%, I found a huge log file there, then

mv /var/logfile /var/logfile.bk
touch /var/logfile
compress /var/logfile.bk

After that, use du -sk /var to double check, I found the space has been free up, however, when I use bdf, it still say 95%?

7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: File system cleanup

Hi Victor,

Check this thread - I think the situation Michael Tully describes might be yours as well:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x4965c1c4ceddd61190050090279cd0f9,00.html

Pete

Pete
Ashwani Kashyap
Honored Contributor

Re: File system cleanup

The process writing in the logfile is still running . U need to stop that process before u can see the required space in bdf . use lsof to find out which process is using that file .
Dietmar Konermann
Honored Contributor

Re: File system cleanup

After mv'ing the file it may be still opened by some process... which makes it impossible for the kernel to free up space.

This should work:

# compress -c /var/logfile > /var/logfile.bk.Z
# > /var/logfile

The "> /var/logfile" truncates the file... and allows the kernel to free the space.

Regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Helen French
Honored Contributor

Re: File system cleanup

The bdf and du commands works differently. du will reflect the FS changed very quickly, but bdf doesn't. Check and make sure that no processes are kept locking the file which you moved (lsof, fuser). Try doing a 'lvsync' and check again. I would wait for sometime to get the correct output from 'bdf'. You might want to take a look at the system patch level too.
Life is a promise, fulfill it!
Victor_5
Trusted Contributor

Re: File system cleanup

I can not access this link, where can I get the lsof?

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.61/

S.K. Chan
Honored Contributor

Re: File system cleanup

Dietmar Konermann
Honored Contributor

Re: File system cleanup

Just to make it clear... there is NO need to stop the process for your cleanup. Just truncate the file, that's it.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)