Home » Questions » Computers [ Ask a new question ]

How do I determine what file occupies a given sector?

How do I determine what file occupies a given sector?

I have a hard drive with 3 bad sectors. I know the sector numbers and the computer can still boot into Windows. I want to run sector repair from an HDD diagnostics tool from the manufacturer, but before I do that, I'd like to know what files are affected. Is there a way to figure out what file or files are occupying those sectors?

Asked by: Guest | Views: 344
Total answers/comments: 4
bert [Entry]

"Most defragmenting programs show a disk-map displaying all the clusters on the disk which you can then click (look for the ones marked as bad) to view the file(s) located in that cluster.

As Walter said, any disk and OS combo from the past decade or so will make sure to relocate files from bad sectors automatically (drive firmware usually handles this, but disk tools like chkdsk or defragmenters will usually do this as well).

Defraggler:

Defrag-a-File:

Vopt:"
bert [Entry]

"as far as i know when a drive hits a certain number of read errors on a sector it gets marked as bad and its contents are copied away to another place on the drive. this usually happens before the data on that sector has become completely unreadable.

I try to dig up a source for that, just read it yesterday but cannot remember where.

from man hdparm (8)

Note also that the --repair-sector flag can be used to restore (any) bad sectors when they are no longer needed, including sectors that were genuinely bad (the drive will likely remap those to a fresh area on the media).

Bottom line: you don't have to care about bad sectors, the harddrives firmware does that for you. only thing you have to do is get a new drive before there are too many of them and your drive dies."
"as far as i know when a drive hits a certain number of read errors on a sector it gets marked as bad and its contents are copied away to another place on the drive. this usually happens before the data on that sector has become completely unreadable.

I try to dig up a source for that, just read it yesterday but cannot remember where.

from man hdparm (8)

Note also that the --repair-sector flag can be used to restore (any) bad sectors when they are no longer needed, including sectors that were genuinely bad (the drive will likely remap those to a fresh area on the media).

Bottom line: you don't have to care about bad sectors, the harddrives firmware does that for you. only thing you have to do is get a new drive before there are too many of them and your drive dies."
bert [Entry]

RunTime's DiskExplorer allows you to examine a drive by sector. It's payware ($70 for the NTFS version) but free to try. They have versions for NTFS, FAT and Linux (ext2/3).
bert [Entry]

"I know thread is old but for the record for everyone having such issue there is way to check it from linux. One can always use some live linux on cd/usb stick, like slax which is super easy to run. Anyway, back to business.

I had found today some smartd deamon logs with unreadable sectors warnings and decided to investigate that. After research I eventually run (# is prompt indicating root privileges, sudo can be used instead if one is running as ordinary user):

# smartctl -H /dev/sda2

SMART overall-health self-assessment test result: PASSED

Which indicates that that drive is somewhat healthy, which is good.
But I followed and investigated further and run badblocks.

# badblocks -v /dev/sda2 > ~/log/sda2.badsectors
# cat ~/log/sda2.badsectors

271521948

So there was some badblock which I wanted to know which file it belongs to and found
that it could be done with debugfs, the problem was that my partition was ntfs so I used ntfstools which is the key:

# ntfscluster -s 271521948 /dev/sda2 > 271521948.secinfo 2>&1
# cat 271521948.secinfo | grep -v ""extent""

Searching for sector 271521948
Inode 142427 /tmp/dl/setup_torch_2.exe/$DATA
* one inode found

/ grep -v ""extent"" is to get rid off lot of useless information displayed by ntfscluster /

So in case of ntfs all one needs is ntfscluster -s $SECTOR."