Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I use RHEL4 with LVM2 on it. At times even after removing large files more that a GB the partition size is not getting updated when is see using df command.

-bash-3.00$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/sys-root  3.9G  1.4G  2.3G  39% /
/dev/cciss/c0d0p1     251M   19M  219M   8% /boot
/dev/mapper/sys-home  250G  125G  113G  53% /home
/dev/mapper/sys-tmp   3.9G   41M  3.7G   2% /tmp
/dev/mapper/sys-var   3.9G  3.6G   98M  98% /var

But when i check using du it shows the proper size

-bash-3.00$ sudo du -sh /var/
 179M   /var/

you can see there that the df output shows /var partition to be 3.6Gb used but the du shows that its just only 179Mb.

Now the problem is that neither sync or partprobe is not updating the information. But surely rebooting the host will resolve the issue. But as this is a production server i cannot reboot it. Is there any way that i can update the disk information manually withough rebooting the host ?

Any help on this will be appreciated.

share|improve this question
    
You probably have open deleted files (i.e. processes that are holding on to deleted files). Try something like lsof to find out. Used/avail isn't stored in the partition table, partprobe (or any type of partition re-read) won't help at all. –  Mat Jan 12 '13 at 17:30
add comment

1 Answer

up vote 1 down vote accepted

When a file is removed/deleted/unlinked, if it is still held open by any process then only the directory entry for the file is erased, not the file's data. When the file is completely closed by all processes the data is returned to the free space pool. It's a feature since you can have anonymous files this way.

To see if you have any open deleted file on a filesystem, run one of these commands, where /mount/point is the mount point (/var in your case):

lsof /mount/point | grep '(deleted)'

This article on open, unlinked files should help explain this some more.

share|improve this answer
    
Great it worked well :) thanks.. –  M. Kannan Jan 12 '13 at 20:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.