-   Linux - Enterprise (
-   -   Slow recognition of free space on deleted filesystems (

robthky 07-29-2005 03:25 PM

Slow recognition of free space on deleted filesystems
Hi everyone,
I have noticed this happening twice in the last few days:
I will cd into a filesystem (/ora1 or /data_c01) and run an rm -rf * &
A few minutes later my job will show as done and the jobs command shows no active background jobs, but when I do a df -h I will still see the filesystem as having data in it. If I cd to the directory and run an ls. I see no data, even with a ls -a.

About 5 minutes later a df -h will show the filesystem as being empty? Why the delay?


Rob Thompson

rjlee 07-30-2005 07:24 PM

The delay is bacause df reports the actual amount of space on the disk, but the delete requests are still in the hard disk's buffers.

To maximise performance, the hard-disk buffers only get committed when the disk is on a low load, when they get full, after a certain amount of time, or when they are explicitly synchronised.

You can see the amount of disk space by passing df the --sync option, which will request an immediate commit of the disk buffers and wait for that request to finish.

You can also mount a device with the sync and dirsync options (set in /etc/fstab before mounting), in order to have the device be accessed synchronously (i.e. buffers committed after every read or write). This is slow.

All times are GMT -5. The time now is 05:40 AM.