0

I was working with many small files (about 1million) and for one reason or another had to create a bunch of hard links to them. Now I am trying to delete all this data, but can't. After removing the 'original' files, the hard links remain and can not be changed:

bash-3.2$ rm -rf a
rm: a: Directory not empty
bash-3.2$ sudo rm -rf a
Password:
rm: a: Directory not empty
bash-3.2$ cd a
bash-3.2$ ls -la
[...]
ls: 82395-8.jpg.txt: No such file or directory
ls: 82395-9.jpg.txt: No such file or directory
ls: 824-1.jpg.txt: No such file or directory
ls: 824-10.jpg.txt: No such file or directory
ls: 824-2.jpg.txt: No such file or directory
ls: 824-3.jpg.txt: No such file or directory
ls: 824-4.jpg.txt: No such file or directory
ls: 824-5.jpg.txt: No such file or directory <-
total 0
drwxrwxrwx  32114 ma  staff  1091876  4 Mai 11:13 .
drwxrwxrwx      3 ma  staff      102  4 Mai 11:04 ..
bash-3.2$ vim 824-5.jpg.txt
~
~
~
~
"824-5.jpg.txt" [New File] <-
-> enter some text
:wq!
bash-3.2$ vim 824-5.jpg.txt
-> text was saved
bash-3.2$ rm -rf 824-5.jpg.txt
bash-3.2$ ls -la
ls: 824-3.jpg.txt: No such file or directory
ls: 824-4.jpg.txt: No such file or directory
total 8
drwxrwxrwx  32115 ma  staff  1091910  4 Mai 11:23 .
drwxrwxrwx      3 ma  staff      102  4 Mai 11:22 ..
-rw-r--r--      1 ma  staff        7  4 Mai 11:23 824-5.jpg.txt <-
bash-3.2$ rm -rf 824-5.jpg.txt <-
ls: 824-4.jpg.txt: No such file or directory
**ls: 824-5.jpg.txt: No such file or directory**
total 0
drwxrwxrwx  32114 matthi  staff  1091876  4 Mai 11:24 .
drwxrwxrwx      3 matthi  staff      102  4 Mai 11:22 ..
bash-3.2$ ls

Using the finder just leads to an error when I try to empty the trash. What can I do? This is taking >100GB of my hard disk and I'd really like to reclaim the space.

  • Run the mighty fsck or one of his glorious brothers fsck.ext3, fsck.ext4... seriously check for corruption in the HDD. Give it a look to the SMART report too. – Hastur May 4 '16 at 10:47
0

It is hard to give an explanation without more details, but removing an entry of an hardlink should not leave other file entries linking to the same file in such a corrupted state.

I suggest to use Disk Utility to check and possibly repair your drive.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.