i386/57480: Removing very large files using rm doesn't show the space being unallocated by the kernel and df.

Pawel Malachowski pawmal-posting at freebsd.lublin.pl
Fri Oct 3 02:30:20 PDT 2003


The following reply was made to PR i386/57480; it has been noted by GNATS.

From: Pawel Malachowski <pawmal-posting at freebsd.lublin.pl>
To: Shon Elliott <shon at misproductions.com>
Cc: FreeBSD-gnats-submit at freebsd.org
Subject: Re: i386/57480: Removing very large files using rm doesn't show the space being unallocated by the kernel and df.
Date: Fri, 3 Oct 2003 11:30:49 +0200

 On Wed, Oct 01, 2003 at 02:29:47PM -0700, Shon Elliott wrote:
 
 > >Description:
 > 	When having a large file, sayt about 800 megs, and using rm on the file, it will be removed, however the space 
 >         occupied by that file will not be released by the kernel/filesystem  or shown by df. This has been noticed for UFS
 >         partitions, and not been extensively tested by me on any other filesystem.
 > >How-To-Repeat:
 > 	Create a large file, say 800 megs. then remove said file using the rm command. 
 > >Fix:
 > 
 > 	To work around the problem, you can use the following commands:
 >         echo "." > filename.ext 
 >         rm filename.ext
 > 
 > 	That will cause the system to correctly report the freed space. If the UFS system using rm doesn't clear the space,
 >         the only way to recover that space seems to be a restart of the entire system.
 
 For me, it works to use sync(8) few times to get df(1) and for example
 quota(1) output properly updated, or simply wait for a while.
 I use soft-updates.
 
 
 without soft-updates:
 # df -h /
 Filesystem    Size   Used  Avail Capacity  Mounted on
 /dev/da0s1a   2.9G   1.5G   1.1G    57%    /
 # dd if=/dev/zero of=dupa bs=1024 count=512000
 512000+0 records in
 512000+0 records out
 524288000 bytes transferred in 10.898418 secs (48106799 bytes/sec)
 # df -h /
 Filesystem    Size   Used  Avail Capacity  Mounted on
 /dev/da0s1a   2.9G   2.0G   664M    76%    /
 # rm dupa;df -h /
 Filesystem             Size   Used  Avail Capacity  Mounted on
 /dev/da0s1a            2.9G   1.5G   1.1G    57%    /
 
 
 with soft-updates:
 # df -h /home2
 Filesystem             Size   Used  Avail Capacity  Mounted on
 /dev/vinum/tiny-raid   992M    49K   913M     0%    /home2
 # dd if=/dev/zero of=/home2/dupa bs=1024 count=512000
 512000+0 records in
 512000+0 records out
 524288000 bytes transferred in 14.041056 secs (37339642 bytes/sec)
 # df -h /home2
 Filesystem             Size   Used  Avail Capacity  Mounted on
 /dev/vinum/tiny-raid   992M   500M   413M    55%    /home2
 # rm /home2/dupa;df -h /home2;sync;df -h /home2;sync;sync;sync;df -h /home2;sleep 2;df -h /home2
 Filesystem             Size   Used  Avail Capacity  Mounted on
 /dev/vinum/tiny-raid   992M   500M   413M    55%    /home2
 Filesystem             Size   Used  Avail Capacity  Mounted on
 /dev/vinum/tiny-raid   992M   500M   413M    55%    /home2
 Filesystem             Size   Used  Avail Capacity  Mounted on
 /dev/vinum/tiny-raid   992M   500M   413M    55%    /home2
 Filesystem             Size   Used  Avail Capacity  Mounted on
 /dev/vinum/tiny-raid   992M    49K   913M     0%    /home2
 
 
 -- 
 Pawe³ Ma³achowski


More information about the freebsd-i386 mailing list