How to recover disk space after filesystem full

2009-05-22 Thread Luke Dean


Yes, it sounds like a stupid question, but let me tell the story.

The log for my dhcp server filled up /var last night, which meant that
dhcpd was also unable to hand out new leases, which meant that I had
effectively been DOSed.  I'll have to look into changing my logging
policies.

So, to correct the problem, I log into the router, removed the big
log and several other files in /var to free up some space, and assumed
this would correct the problem.

It did not.
Several minutes after freeing up a lot of space on /var, I continued
to get filesystem full messages and df continued to show the
capacity at 100%.  I checked df -i for the inodes too.  That was
fine.  I ran a quick fsck to see if that might shock the system into
seeing all the space that I'd freed up, but no good.

I ended up rebooting the box.

Was there any other possible solution I could've tried?

Why wouldn't the free space immediately appear as free?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How to recover disk space after filesystem full

2009-05-22 Thread Steve Bertrand
Luke Dean wrote:
 
 Yes, it sounds like a stupid question, but let me tell the story.
 
 The log for my dhcp server filled up /var last night, which meant that
 dhcpd was also unable to hand out new leases, which meant that I had
 effectively been DOSed.  I'll have to look into changing my logging
 policies.
 
 So, to correct the problem, I log into the router, removed the big
 log and several other files in /var to free up some space, and assumed
 this would correct the problem.
 
 It did not.
 Several minutes after freeing up a lot of space on /var, I continued
 to get filesystem full messages and df continued to show the
 capacity at 100%.  I checked df -i for the inodes too.  That was
 fine.  I ran a quick fsck to see if that might shock the system into
 seeing all the space that I'd freed up, but no good.
 
 I ended up rebooting the box.
 
 Was there any other possible solution I could've tried?

You have to restart the service that was holding the log file(s) open.
The system does not release the space while an application is 'using'
the file, even after it's been deleted.

 Why wouldn't the free space immediately appear as free?

Because technically, the space is not freed. lsof will help identify
which process(es) are holding a particular file open, if you see that
disk space is not recovered as expected after deletion:

# pkg_add -r lsof

pearl# lsof | grep auth.log

syslogd 850 root   15wVREG  0,127  75199  237484
/var/log/auth.log

Steve


smime.p7s
Description: S/MIME Cryptographic Signature


Re: How to recover disk space after filesystem full

2009-05-22 Thread Lowell Gilbert
Luke Dean lu...@pobox.com writes:

 Yes, it sounds like a stupid question, but let me tell the story.

 The log for my dhcp server filled up /var last night, which meant that
 dhcpd was also unable to hand out new leases, which meant that I had
 effectively been DOSed.  I'll have to look into changing my logging
 policies.

 So, to correct the problem, I log into the router, removed the big
 log and several other files in /var to free up some space, and assumed
 this would correct the problem.

 It did not.
 Several minutes after freeing up a lot of space on /var, I continued
 to get filesystem full messages and df continued to show the
 capacity at 100%.  I checked df -i for the inodes too.  That was
 fine.  I ran a quick fsck to see if that might shock the system into
 seeing all the space that I'd freed up, but no good.

 I ended up rebooting the box.

 Was there any other possible solution I could've tried?

 Why wouldn't the free space immediately appear as free?

http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/disks.html#DU-VS-DF
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How to recover disk space after filesystem full

2009-05-22 Thread Fred Condo
On Fri, May 22, 2009 at 9:14 AM, Luke Dean lu...@pobox.com wrote:

 Yes, it sounds like a stupid question, but let me tell the story.

 The log for my dhcp server filled up /var last night, which meant that
 dhcpd was also unable to hand out new leases, which meant that I had
 effectively been DOSed.  I'll have to look into changing my logging
 policies.

 So, to correct the problem, I log into the router, removed the big
 log and several other files in /var to free up some space, and assumed
 this would correct the problem.

 It did not.
 Several minutes after freeing up a lot of space on /var, I continued
 to get filesystem full messages and df continued to show the
 capacity at 100%.  I checked df -i for the inodes too.  That was
 fine.  I ran a quick fsck to see if that might shock the system into
 seeing all the space that I'd freed up, but no good.

 I ended up rebooting the box.

 Was there any other possible solution I could've tried?

 Why wouldn't the free space immediately appear as free?

Because unlinking the file does not close the file. Restarting the
dhcp daemon probably would have done the trick. The filesystem will
free the disk space only when all references to the file have gone
away.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How to recover disk space after filesystem full

2009-05-22 Thread Mel Flynn
On Friday 22 May 2009 18:19:25 Steve Bertrand wrote:

 # pkg_add -r lsof

Or use the native fstat(1).
-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How to recover disk space after filesystem full

2009-05-22 Thread Luke Dean



On Fri, 22 May 2009, Steve Bertrand wrote:


Luke Dean wrote:

I ended up rebooting the box.

Was there any other possible solution I could've tried?


You have to restart the service that was holding the log file(s) open.
The system does not release the space while an application is 'using'
the file, even after it's been deleted.


Oh yeah!  I forgot.
I've got it configured to use syslogd to handle the dhcp logging, so I
probably just needed to restart that one.  I probably could've left
dhcpd running.
This kind of emergency always seems to happen before I get a chance
to make coffee.
Thank you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org