very slow deletions on ext3 USB drive
Amedee Van Gasse (Ubuntu)
amedee-ubuntu at amedee.be
Fri Sep 18 14:19:15 UTC 2009
On Fri, September 18, 2009 13:37, Karl Auer wrote:
> Hullo all.
> I have a hard disk, 250Gb or so, in an external USB 2.0 HDD enclosure.
> The disk is now full. Specifically, it is full of old backups. Each
> backup is in its own directory, and there are about 45 directories at
> the top level. Each directory contains about 300,000 files and
> directories, mostly very small. The files are pretty evenly distributed
> through the directories and subdirectories. The disk is an ext3
> I now want to recycle the drive and start filling it up with new
> backups. So I have started deleting the old backups. I don't want to
> delete ALL the backups - just the oldest ones - so I can't just reformat
> the disk.
> Problem is, it is taking literally hours to remove each backup
> directory. Why is this so? Is there any faster way than "rm -fr" to
> remove a directory? Should I use a different filesystem type next time?
> The only wrinkle here is that the backup directories were created using
> rsynch, hard linking to identical files rather than copying them anew.
> But that is a simple link count - I can't see it adding *this* much pain
> to a simple deletion!
ext4 is supposed to be faster than ext3 at deleting small files, but don't
take my word on it. Look up some benchmarks on the web.
The good thing about ext4 is that you can upgrade from ext3 without
needing to reformat the drive. See
However if you do an ext3->ext4 upgrade, you don't get all of the benefits
from ext4. For example an upgraded ext3->ext4 disk doesn't use extents
like a clean formatted ext4 does. You will need to "defrag" the disk with
a tool like e4defrag, and that will take just as long (or even longer) as
copying from the old disk to a new disk.
I suggest that you do some test on a loopback filesystem first, before you
hose your backup disk. :)
More information about the ubuntu-users