LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 07-02-2012, 06:02 PM   #1
linuxguy08
Member
 
Registered: Apr 2008
Posts: 155
Blog Entries: 2

Rep: Reputation: 15
no changes after deleting files


Hi ,

I have deleted some log files because of space crunch and after removed I still see the same percentage of space as how it was earlier before removal. So can you suggest what could be the reason and how to fix it out?

Thanks

---------- Post added 07-02-12 at 06:03 PM ----------

Sorry forgot to mention the server details
it it centos 5.2
 
Old 07-02-2012, 06:35 PM   #2
etech3
Senior Member
 
Registered: Jul 2009
Location: Virginia
Distribution: Debian Stable Testing Sid Slackware CentOS
Posts: 1,055
Blog Entries: 2

Rep: Reputation: 44
Code:
updatedb
and then search for the files again.
 
Old 07-02-2012, 06:54 PM   #3
linuxguy08
Member
 
Registered: Apr 2008
Posts: 155
Blog Entries: 2

Original Poster
Rep: Reputation: 15
so updatedb will make changes.

my questions , even after removal of log file, I see the same filesize in the var , no changes has been taken effect with
df -h
 
Old 07-02-2012, 07:05 PM   #4
etech3
Senior Member
 
Registered: Jul 2009
Location: Virginia
Distribution: Debian Stable Testing Sid Slackware CentOS
Posts: 1,055
Blog Entries: 2

Rep: Reputation: 44
Removed a log file or cleared it?

So how did you remove it?

If you wanted to clear a file:
Code:
cat /dev/null > aptitude
Check the file size before and after.
 
Old 07-02-2012, 07:19 PM   #5
etech3
Senior Member
 
Registered: Jul 2009
Location: Virginia
Distribution: Debian Stable Testing Sid Slackware CentOS
Posts: 1,055
Blog Entries: 2

Rep: Reputation: 44
Try looking for zero size files:

Code:
find /var/log -type f -size 0k
I just make a script and clear the log after review.
 
Old 07-02-2012, 07:30 PM   #6
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,093

Rep: Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995
For log files, you should really use the logrotate tool http://linux.die.net/man/8/logrotate, see /etc/logrotate.d (dir).

FYI, if a process has a file open, the the disk space is not returned after deletion until the file is released http://linux.die.net/man/2/unlink i.e. the file just becomes invisible to ls, find cmds etc.
You shouldn't normally delete an open file anyway; see lsof http://linux.die.net/man/8/lsof fuser http://linux.die.net/man/1/fuser
 
Old 07-02-2012, 07:33 PM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo, Slackware
Posts: 14,903
Blog Entries: 2

Rep: Reputation: 3812Reputation: 3812Reputation: 3812Reputation: 3812Reputation: 3812Reputation: 3812Reputation: 3812Reputation: 3812Reputation: 3812Reputation: 3812Reputation: 3812
Quote:
Originally Posted by etech3 View Post
Removed a log file or cleared it?

So how did you remove it?

If you wanted to clear a file:
Code:
cat /dev/null > aptitude
Check the file size before and after.
You can shorten that to
Code:
>logfile
 
1 members found this post helpful.
Old 07-02-2012, 07:39 PM   #8
etech3
Senior Member
 
Registered: Jul 2009
Location: Virginia
Distribution: Debian Stable Testing Sid Slackware CentOS
Posts: 1,055
Blog Entries: 2

Rep: Reputation: 44
Thanks TobiSGD, I'll add that to my script!
 
Old 07-03-2012, 12:39 PM   #9
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, FreeBSD
Posts: 3,925
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01
if a process has a file open, the the disk space is not returned after deletion until the file is released
Exactly. From the sounds of this problem, you may have just unlinked a file that is still being written to.

Try:
Code:
# lsof +L1 /var | egrep 'PID|deleted'
(That is a root prompt. So run it as root.)

Last edited by anomie; 07-03-2012 at 12:41 PM.
 
Old 07-03-2012, 05:27 PM   #10
linuxguy08
Member
 
Registered: Apr 2008
Posts: 155
Blog Entries: 2

Original Poster
Rep: Reputation: 15
Thanks lot!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
About deleting a files combilli Linux - Newbie 1 01-09-2007 10:54 PM
Deleting files rossi46 Mandriva 5 11-08-2006 08:15 AM
Deleting old files shiroh_1982 Linux - Newbie 2 06-21-2006 07:26 AM
Deleting files in C monil Programming 4 03-13-2005 10:33 AM
Deleting files ShakyJake Linux - Newbie 12 05-08-2003 03:07 PM


All times are GMT -5. The time now is 02:44 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration