filesystem: 12h to delete 32GB of data

Bill Moran wmoran at potentialtech.com
Wed May 6 12:48:37 UTC 2009


In response to Olivier Mueller <om-lists-bsd at omx.ch>:

> Hello,
> 
> $ df -m ; date ; rm -r templates_c ; df -m ; date
> Filesystem  1M-blocks   Used Avail Capacity  Mounted on
> /dev/da0s1a       989     45   864     5%    /
> /dev/da0s1f    128631 102179 16160    86%    /usr
> [...]
> Wed May  6 00:23:01 CEST 2009
> 
> Filesystem  1M-blocks  Used Avail Capacity  Mounted on
> /dev/da0s1a       989    45   864     5%    /
> /dev/da0s1f    128631 69844 48496    59%    /usr
> Wed May  6 12:21:02 CEST 2009
> 
> 
> -> it took about 12 hours to delete these 30GB of files and
> sub-directories (smarty cache files: many small files in many dirs).
> It's a little bit surprising, as it's on a recent HP proliant DL360 g5
> with SAS disks (Raid1) running freebsd 6.x
> ( /dev/da0s1f on /usr (ufs, local, soft-updates) )
> 
> Surprisingly, cpu load remained quite low during the operation (apache
> stayed responsive).  Is it a known problem on this kind of hardware or
> something related to the filesystem? Is there a way to improve this?
> Even on my $500 PC with IDE disks this goes quicker... :)
> 
> I checked
> http://www.freebsd.org/doc/en/books/handbook/configtuning-disk.html but
> I'm not sure if this would help in this case. Any suggestion how I can
> "fix" that? 

With lots of small files, the time involved is far less dependent on
the size of data, and much more dependent on the number of files, and
the resultant number of directory entries that need to be updated.
"Lots" isn't a particularly accurate count of the # of files, but if
you're talking web cache files, I'll guess they average 5k each, which
means you had 6 million files.  df -i would have been more useful in
the output above.

This brings a number of questions up:
* Are you _sure_ softupdates is enabled on that partition?  That's
  going to make the biggest improvement in speed.
* Are these 7200RPM disks or 15,000?  Again, going to make a big
  difference.
* If apache was still running, is it possible that it was creating
  enough disk activity to slow the activity down?  Running
  top -m io will show you how much disk IO each process is creating.
* When you compared the speed to your laptop, did you delete 6 million
  files from the laptop?  If you deleted a single 30G file, then you're
  comparing apples to atom bombs.

If this is a directory that you blow away on a regular schedule, you'd
do much better to make it a dedicated partition and simply reformat
it.

-- 
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/


More information about the freebsd-questions mailing list