1

On searching for files that have hardlinks on my Portable HDD using the following command:

$ find . ! -type d -links +1 -ls | sort -n

I get an output of the following form (there are hundreds of other files)

9336 244476 -rw-------   2 rishi    rishi    250342060 Feb 18 15:48 ./unigram_mvt_0.001_9_4_0.001

This shows that the file with inode 9336 has 2 hardlinks.

On trying to locate the other one using

$ find /media/rishi/ -xdev -inum 9336

I get the output shown below

/media/rishi/mvp/unigram_mvt_0.001_9_4_0.001

This indicates that there is only file with inode 9336

I have not created hardlinks myself. These files have been generated on my local disk from a simulation on my computer. I might have copied files for taking backups which could have created these links. The files are currently on my Portable HDD

Since I do not need this data in the near future, I was using gzip to compress it when I came across the hardlinks warning and tried to look into it.

Is the hardlink count incorrect or am I not able to locate the other hard linked file?

EDIT:

Filesystem is fuseblk

Things tried:

  1. Used sudo to search. Result: Same as before
  2. Compressed file using "gzip -f". Result: Free space on the disk increased so I guess there were no other files hardlinked
  3. Used find -name to check if it throws Hardlink count is wrong Warning. Result: No warning
  4. Checked file system. I think the problem lies here but I'm not able to resolve it

Here is the output of disk check:

$ sudo ntfsck /dev/sdb1
Unsupported: replay_log()
Unsupported: check_volume()
Checking 199424 MFT records.
Unsupported cases found.

$ sudo ntfsfix /dev/sdb1
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
NTFS volume version is 3.1.
NTFS partition /dev/sdb1 was processed successfully.

Even after running ntfsfix, I get the same error on ntfsck

  • Did you try it with sudo? – xiaodongjie May 19 '14 at 2:26
  • What filesystem do you have on the external disk? Is it NTFS? – terdon May 19 '14 at 2:33
  • @xiadongjie Added details in the edit section – Rishi Dua May 19 '14 at 2:45
  • @terdon Yes, it is NTFS – Rishi Dua May 19 '14 at 2:46
1

The issue was in the filesystem. Thanks @terdon for the hint.

Apparently NTFS support on Linux is limited as the errors remain even after running ntfsfix.

Running chkdsk /F /R /X F: where F: is the drive letter from the elevated CMD prompt corrected the index entries and fixed the issue for me.

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.