How to find files affected by reallocated sectors?
I have a Western Digital RE4 1.5TB that has just reallocated 56 sectors.
Reallocated Sectors Count,140,193,193,OK,56,0,Enabled
I want to know if it is possible to find out which are the files affected by these reallocated sectors, and if they got corrupted bits because of this reallocation.
Not easily.
the sector reallocation happens inside the drive (which is why it's reported to you by SMART) -- your filesystem has no clue it's happening. As far as it's concerned sector 12345
is still sector 12345
, that's what it asks the drive for. Internally the drive knows 12345
is now 67890
and returns the contents of the remapped sector.
The only way I know of that you could do this would be to get the physical sector map of the drive (from the drive's electronics), combine it with the reallocation map, translate it to the logical sector map (that is presented to the OS/filesystem), and then determine what files were using the reallocated sectors at the time they were remapped (which may not be the file(s) currently using it.
So for all practical purposes you can't do this - and you shouldn't have to.
Modern hard drives are pessimistic when reallocating sectors and will reallocate when a sector is marginal rather than waiting for it to be totally unusable (so if the reallocation is successful and transparent no data is lost: The write was redirected, or the read retried until it succeeded and the data subsequently moved). If the reallocation failed the OS would have gotten an error back from the drive and reported it to you.
About the only things you should concern yourself with are:
Are there visible bad sectors on my drive (being reported to the OS)?
If the answer is yes, the drive is dead. OS-visible bad sectors mean that the reallocation space the drive has is used up, and you're starting to lose accessible disk. Failure is usually imminent and the drive should be replaced ASAP.Is the sector reallocation count above the threshold, or steadily growing at a rapid rate?
This could indicate a failure in progress - Again, plan to replace the drive ASAP.
This is SMART counter. Reallocated sectors are not exposed to the software. Physically, all drives have spare space reserve for reallocation, so, HDD is internally doing all the things, process is transparent to the outside world. While reallocated sector count is low enough - you don't have to worry about it, performance decrease won't be significant. Probably, some vendor-specific tools can show you the internal structure of HDD, but with generic utilities - it's not really possible, there is no such standard, only SMART.