# XFS very slow deleting big folders

## nekromancer

Hi,

I have xfsprogs-2.10.1,  2.6.27-gentoo-r8 kernel,  XFS filesystem on a 320GB 5400rpm disk on a laptop

```

Filesystem    Type    Size  Used Avail Use% Mounted on

/dev/sda3      xfs    297G   23G  274G   8% /

udev         tmpfs     10M  204K  9.9M   2% /dev

shm          tmpfs    2.0G     0  2.0G   0% /dev/shm

```

I been using it for over 6 months and everything is good except for 1 thing. When I delete large directories it takes a really really long time. For example I have a backup of /usr/portage, which is a huge folder. Doing a "rm -rf /usr/portage_backup" took around 15 minutes to finish. Nothing on the system was unresponsive and cpu usage was under 10%. But the deleting was really slow.

I don't know why but if anyone out there has any ideas? and maybe any way to speed things up?

according to this benchmark http://linuxgazette.net/122/piszcz.html see graph 006

xfs should be very fast in deleting tens of thousands of directories.

----------

## disi

you can to some tasks to check fro fragmentation or filesystem errors:

check defragmentation:

```
# xfs_db -c frag -r /dev/sda3
```

start defrag for 10min:

```
# xfs_fsr -v -t 600
```

then check again as above

xfs doesn't use fsck at all, but you can use this one to check for errors (remember to umount the partition first):

```
# xfs_repair /dev/sda3
```

I hope this helps a bit.

//edit: just checked myself O.o

```
disi-openvz ~ # xfs_db -c frag -r /dev/mapper/vg001-data

actual 131343, ideal 1058, fragmentation factor 99.19%
```

----------

## nekromancer

Doesn't seem like fragmentation is a problem for me.

```

toshi necro # xfs_db -c frag -r /dev/sda3 

actual 534125, ideal 528687, fragmentation factor 1.02%

```

I will try the repair when I get my hands on a livecd, cos my root partition is the only one that is xfs.

----------

## schiotz

It is quite a while ago, but I once had /usr/portage on a separate partition, and tried timing emerge sync with different file systems.  XFS was by far the slowest, reiserfs the fastest, and ext3 doing quite well.

Of course things may have changed a lot since then, but I was surprised at the slowness of xfs and abandoned it.

/Jakob

----------

## gentoo_ram

From all the benchmarks I've read XFS is fast at some things, and really slow at others.  It turns out XFS is really slow at deleting files.  That's the weak point in its design.  So it doesn't surprise me is takes a long time to delete directory trees with lots of little files.  That just isn't XFS' strong point.  From your description of the 'problem', I'd say this is 'normal'.

----------

## FizzyWidget

xfs is good with large files not small, thats why most use it for storing large files, tv shows recorded from tv on capture card and such like, i have used xfs for a while and yes it can take a time to delete files, small ones, large files are gone near enough right away

----------

