On Tue, 5 Dec 2006, Joe Advisor wrote:
> I apologize for not wrapping my lines, I did not realize
> that Yahoo mail does not autowrap.
>
> So about the problem I am trying to solve. Honestly,
> I am actually not rewriting all that fast, but it's still
> filling up a filesystem. I am writing to maybe 4
> files or so, each file is about 100 Kb to 400 Kb, and
> I rewrite those about once every two seconds. The
> partition that these files are on is about 250 MB.
> I have another partition which is about 10 GB, and
> on that partition, there are maybe 100 files that
> I rewrite, once again, at about two second intervals.
Just to be sure, are you sure you are closing all your file
descriptors? Check with fstat.
I checked the behaviour of a -current system. There were some softdep
fixes after 4.0. To be sure I also checked a 4.0-stable system.
With this loop:
while true; do echo foo > foo; sleep 1; done
I see ever increasing disk usage on 4.0-stable.
On -current it grows, but then it is back to zero again, repeatedly.
So the fixes in -current do make things better.
Now as for a suggestion on how to circumvent these problems:
Both on -stable and -current the loop below works for me, disk usage
stays very low. In general, it's better to write to a temp name first,
and only replace the original file if the writing did succeed:
while true;
do
f=$(mktemp)
echo foo > $f
mv $f foo
done
-Otto