ef2d Disk Free Space Not Adding Up - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Base System > General

General General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere.

Reply
 
Thread Tools Display Modes
  #1  
Old July 12th, 2010, 21:32
tad1214 tad1214 is offline
Junior Member
 
Join Date: Nov 2008
Posts: 19
Thanks: 8
Thanked 0 Times in 0 Posts
Default Disk Free Space Not Adding Up

Hello All

I know that if you delete a file that is currently being written to it doesnt actually put the space back into the available space.

Currently:
Code:
server1# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/da0s1a    496M    268M    188M    59%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/da0s1e    496M    968K    455M     0%    /tmp
/dev/da0s1f     57G     50G    1.9G    96%    /usr
/dev/da0s1d    4.7G    2.3G    2.1G    52%    /var
linprocfs      4.0K    4.0K      0B   100%    /usr/compat/linux/proc
57 - 50 is not equal to 1.9G.

I share this server with a few other people and I am guessing someone deleted a massive log file while the service was still writing to it.

Is there any way to free this space up without rebooting my server?

Thanks!
-=Tom

Last edited by DutchDaemon; July 12th, 2010 at 22:45. Reason: proper formatting: http://forums.freebsd.org/showthread.php?t=8816
Reply With Quote
  #2  
Old July 12th, 2010, 21:43
fronclynne's Avatar
fronclynne fronclynne is offline
Senior Member
 
Join Date: Feb 2009
Location: Lunch Time
Posts: 1,297
Thanks: 132
Thanked 166 Times in 143 Posts
Default

  1. df -h only give you a rounded approximation
  2. 8% is reserved, & does not show in the Avail column

You're probably better off not screwing with reserved blocks and space/time optimisations on your /usr/. If you wanted to screw around with that stuff, get another drive (or add another partition, if you have unallocated space on your drive) and mount it as /data/ or something and see what tunefs(8) can do (newfs(8) too, for that matter).

Also: read this.
__________________
Quid habemus reliquum?
Nutrimentum anatum!

Внимание: лифт вниз не поднимает
Reply With Quote
The Following User Says Thank You to fronclynne For This Useful Post:
tad1214 (July 13th, 2010)
  #3  
Old July 13th, 2010, 00:46
tad1214 tad1214 is offline
Junior Member
 
Join Date: Nov 2008
Posts: 19
Thanks: 8
Thanked 0 Times in 0 Posts
Default

Thanks for the help Getting more drives in the 1U isnt really an option and getting bigger SCSI drives is expensive. I may have to invest in another server I suppose.

Last edited by tad1214; July 13th, 2010 at 00:51. Reason: My math is terrible
Reply With Quote
  #4  
Old July 13th, 2010, 01:28
fronclynne's Avatar
fronclynne fronclynne is offline
Senior Member
 
Join Date: Feb 2009
Location: Lunch Time
Posts: 1,297
Thanks: 132
Thanked 166 Times in 143 Posts
Default

Well, if you feel like poking around, /usr/ports/distfiles/ may have a bit of garbage, as with your (potentially defunct) working directories in ports (try # rm -r /usr/ports/*/*/work if you just don't care (or some find(1) goblox to check it out, if you must (portsclean -CDL, which is part of ports-mgmt/portupgrade also works quite well in this regard))). Look at /usr/obj/ as well (though it's normally only about 800M).

Anyway, du(1) and find(1) are your friends. Learn them; use them.
__________________
Quid habemus reliquum?
Nutrimentum anatum!

Внимание: лифт вниз не поднимает
Reply With Quote
The Following User Says Thank You to fronclynne For This Useful Post:
tad1214 (July 13th, 2010)
  #5  
Old July 13th, 2010, 10:33
pbd pbd is offline
Member
 
Join Date: Nov 2008
Location: Brno, CZ
Posts: 187
Thanks: 9
Thanked 31 Times in 31 Posts
Default

You can use fstat to list biggest open files:

Code:
# echo -e "file size\tinode num\tmount\tcommand"; fstat | \
awk '{ print $8, "\t", $6, "\t", $5, "\t", $2 }' | sort -nr | head
file size       inode num       mount   command
1862270976       1860727         /var    mysqld
380840808        2802829         /var    lighttpd
108508595        2802767         /var    httpd
Then find to search for file with inode in that mount point. For example the first file in listing above:

Code:
find /var -inum 1860727
If find doens't find any file with this inode, then it's probably the one deleted, that you are looking for and you can see that mysql is using it, so you can restart mysql to free the space.
Reply With Quote
The Following User Says Thank You to pbd For This Useful Post:
tad1214 (July 13th, 2010)
  #6  
Old July 13th, 2010, 15:56
tad1214 tad1214 is offline
Junior Member
 
Join Date: Nov 2008
Posts: 19
Thanks: 8
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by pbd View Post
You can use fstat to list biggest open files:

Code:
# echo -e "file size\tinode num\tmount\tcommand"; fstat | \
awk '{ print $8, "\t", $6, "\t", $5, "\t", $2 }' | sort -nr | head
file size       inode num       mount   command
1862270976       1860727         /var    mysqld
380840808        2802829         /var    lighttpd
108508595        2802767         /var    httpd
Then find to search for file with inode in that mount point. For example the first file in listing above:

Code:
find /var -inum 1860727
If find doens't find any file with this inode, then it's probably the one deleted, that you are looking for and you can see that mysql is using it, so you can restart mysql to free the space.
fstat was the command someone told me about before and I couldn't remember thanks!!!
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solved] FreeBSD 8 drive free space issue Bink System Hardware 0 January 4th, 2010 08:52
Free Space Monitoring Script naezdnik Userland Programming & Scripting 6 October 7th, 2009 12:14
Adding and initializing a new disk cns5p System Hardware 3 May 16th, 2009 22:04
Where did the free space go after failed port build jwhendy Installation and Maintenance of FreeBSD Ports or Packages 23 May 7th, 2009 08:40
Adding a new raidz to zpool does not give zfs create more space audunfr Installing & Upgrading 0 April 19th, 2009 12:39


All times are GMT +1. The time now is 01:46.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0