0

While tidying up some folders I saw that deleting some files is very slow :

$ ls -lah a/
-rwxrwxrwx 1 user user    4 Nov 17 12:31 af8048e4aec858a02ac48119545413dd

$ time (rm -v af8048e4aec858a02ac48119545413dd)
removed ‘af8048e4aec858a02ac48119545413dd’

real    0m7.908s
user    0m0.000s
sys     0m0.000s

While delete other file is like :

$ touch some_file
$ time (rm -v some_file)

removed ‘some_file’

real    0m0.003s
user    0m0.000s
sys     0m0.000s

I don't understand what's going on. I fear about some hardware problem...

Any help is welcome and will be appreciated.

Thank you.

JazZ
  • 231
  • 2
  • 4
  • What filesystem are you using? How much free space do you have? What is your underlying block device arrangement? Please provide more information. – shodanshok Dec 13 '16 at 20:52
  • @shodanshok It's ext4 filesystem. I tried to reboot but Debian can't start any more. I'm running `e2fsck` right now and get I/O errors on several blocks... I think I must say goodbye to the hard-drive... What do you think ? – JazZ Dec 13 '16 at 20:59
  • I/O errors never are a good thing. Your disk is probably bad, or your logical volume metadata (if you are using it) are badly corrupted. If you can, reboot with a live CD and issue a `smartctl --all` to check disk health. – shodanshok Dec 13 '16 at 21:03
  • Ok thanks for your support. I'll do that as soon as the `e2fsck` has finished. I delete this question since the subjet is not in relation with the actual problem. – JazZ Dec 13 '16 at 21:09

1 Answers1

1

It depends on the size of the file and how fragmented the file is at the time of deletion.

Bigger files can take up more sectors on disk and are more likely to be more fragmented on the disk. The FS table has to remove the index entries for the file which can take longer if it has to find it on the disk.

It can also matter if there is driver performance issues or issues with the drive accessing that part of the disk.

If the drive has to zero the disk (secure erase) that will take time as well. I don't believe a simple "rm" will do a secure erase, but I know it will do it on database servers unless disabled.