Disk space - du and df discrepency
Hi
Can someone explain this to me? I started off with Code:
[root@zs]# df -h 6.6G /var/log/httpd/error_log.1 7.3G /var/log/httpd/error_log.2 6.7G /var/log/httpd/ssl_error_log.2 I had a look in them, saw which php was causing the trouble, fixed it and deleted the log files. Then I had... Code:
[root@zeldia tmp]# df -h Code:
[root@zs]# df -h /var |
This is a guess. Look at the output of lsof. If a program has a lock on one of the files, it might not be dropped until that program releases the lock.
|
Thanks for the suggestion but no significantly large files show up in the list.
I'm now back to ... Code:
[root@zs]# df -h These figures haven't changed since my first post but 6G of free space on /var have gone... Code:
[root@zs]# du -sh /var/* |
hi, just wanted to post some new info, posted by jovie in the Linux - Security forum, related to this (the thread was closed for being essentially the same issue):
Quote:
|
df reports plenty of space yet I get 'no space left' errors
Hi,
I'm having similar problems. According to df I have 77 Gigabytes of space. However, all attempts to create a file fail with the error 'no space left on device'. These examples are done as user root. $ df -Tah Filesystem Type Size Used Avail Use% Mounted on ... /dev/hdh ext3 466G 367G 77G 83% /media/.Backup and here's the error (it's consistent no matter which user tries to create a file). $ touch /media/.Backup/foo touch: cannot touch `/media/.Backup/foo': No space left on device Permissions are set to allow rwx by everyone (for the sake of this example). If I remove some files from /media/.Backup then the call to touch /media/.Backup/foo succeeds. Here's some more information about the disk and filesystem. $ parted -s /dev/hdh print Model: Maxtor 6H500R0 (ide) Disk /dev/hdh: 500GB Sector size (logical/physical): 512B/512B Partition Table: loop Number Start End Size File system Flags 1 0.00B 500GB 500GB ext3 $ tune2fs -l /dev/hdh tune2fs 1.38 (30-Jun-2005) Filesystem volume name: MAXTOR500GB ... Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file Default mount options: (none) Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 477056 Block count: 122096646 Reserved block count: 6104832 Free blocks: 26151205 Free inodes: 4 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 1024 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 128 Inode blocks per group: 4 ... Mount count: 20 Maximum mount count: 10 Last checked: Thu Nov 16 06:11:43 2006 Check interval: 1728000 (2 weeks, 6 days) Next check after: Wed Dec 6 06:11:43 2006 Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 128 Journal inode: 8 Default directory hash: tea ... Journal backup: inode blocks I also tried lsof to list all open files. There are no files open on /media/.Backup My best idea is there is 77GB of filesystem overhead (superblocks,journal). But I would guess any smart space reporting tool would only report the amount of possible space since users aren't interested in disk space they can never use (most of the time)... Any ideas on why there is plenty of free space reported yet 'no space' errors? -J_Tom_Moon_79 |
Sorry I should have posted the solution when I found it. jschiwal was on the right lines I just didn't understand the implications.
I'd deleted the log file used by apache but didn't restart apache. Apache had a lock on the file and kept using it. Thus 'du' considered the file deleted and didn't count the space but 'df' considered the file in use and did count the space. Every time I made free space on the partition apache used it to write to the deleted log file which 'du' wasn't reading so it appeared that the space was mysteriously disappearing. If you know which service you've been messing with restart it or else you could reboot the machine. |
All times are GMT -5. The time now is 12:25 AM. |