On Tue, 14 Apr 2015 10:12:28 +0300 Reco <recovery...@gmail.com> wrote:
> Hi. > > On Tue, Apr 14, 2015 at 08:58:20AM +0200, Petter Adsen wrote: > > On Mon, 13 Apr 2015 15:41:03 +0200 > > Vincent Lefevre <vinc...@vinc17.net> wrote: > > > > > On 2015-04-13 14:45:25 +0200, Loïc Grenié wrote: > > > > 2015-04-13 14:39 GMT+02:00 Vincent Lefevre <vinc...@vinc17.net>: > > > > > The problem is that this operation is (always?) very slow: > > > > > something like 100 seconds (1 minute and 40 seconds). It has > > > > > been reproducible for several months. The logs show nothing > > > > > during this operation. > > > > > > > > > > Any idea? > > > > > > > > Maybe the directory is very large (even though its empty). > > > > Try > > > > > > > > ls -ld tmp. > > > > > > > > and see if the file "tmp" is large. > > > > > > Thanks! I didn't know that (I thought that the file system would > > > automatically "optimize" directories when files are removed, so > > > I've never looked closely at their size). Indeed: > > > > > > ypig:~/eftests> ls -ld tmp > > > drwxr-xr-x 2 vlefevre vlefevre 29655040 2015-04-13 15:25:55 tmp/ > > > > Can someone please enlighten me as to why the entry for this > > directory is so large, even though it is empty? Since it's > > apparently obvious to everyone else, I would very much like to > > know :) > > A case study: > > $ mkdir tmp > $ du -sxh tmp > 4.0K tmp > $ for x in {1..100000}; do touch tmp/$x; done > $ du -sxh tmp > 2.1M tmp > $ find tmp -type f | xargs rm > $ du -sxh tmp > 2.1M tmp > $ ls tmp | wc -l > 0 > > Removing files from the directory does not change directory's inode > size. If using ext4, at least. Interesting. Also good to know. Thank you :) But if you create new files in that directory after deleting them, I expect the inodes get reallocated? Is this specific to Linux/ext4? Petter -- "I'm ionized" "Are you sure?" "I'm positive."
pgp9JfdVdPrPc.pgp
Description: OpenPGP digital signature