LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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
  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: 45
Code:
updatedb
and then search for the files again.
 
Old 07-02-2012, 06:54 PM   #3
linuxguy08
Member
 
Registered: Apr 2008
Posts: 155

Original Poster
Blog Entries: 2

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: 45
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: 45
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
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
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: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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: 45
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
Posts: 3,935
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

Original Poster
Blog Entries: 2

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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:19 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration