Re: How to deal with defect block

Bruce Allen <[email protected]>
Newsgroups gmane.linux.utilities.smartmontools
Message-ID <[email protected]>
Hi Bernd,

HDPARM is a low-level tool to interact with disk drives.  It doesn't know anything about file systems.

I don't know about NTFS.  You'll have to investigate tools for that.  The question you want to answer is, "what file or directory or file system data is stored at block number X."  I suggest you consult some NTFS experts to get the answer.

Cheers,
	Bruce


On Jul 21, 2014, at 12:09 PM, bege <[email protected]> wrote:

> Thank you very much, Robert and Bruce,
> 
> the drive has NTFS file system. On the linked page I didn't find an option (maybe I didn't properly understand everything) to enter the defect block number and receive the file/directory using that block. Which command does that job?
> I'd feel more serene to start with the repair if I new what exactly is affected.
> Thank you.
> Bernd
> 
>> -------- Original Nachricht/Message ---------
>> Betreff/Subject: Re: [smartmontools-support] How to deal with defect block
>> Datum/Date: Montag, 21. Juli 2014 11:47:38
>> Von/From: Bruce Allen <[email protected]>
>> An/To: [email protected], bege <[email protected]>
>> 
>> 
>>  
>> Robert, very nice directions, thank you!
>> 
>> Bernd, you might want to review 
>> http://linux.die.net/man/8/hdparm
>>  first.  Depending upon what file system you are using, you might also be able to figure out in advance or after the fact, what file or directory is using the data stored at that disk sector.  After you have finished you should run a full disk self-test (scan) to be sure that there are no other unreadable sectors.
>> 
>> Cheers,
>> 	Bruce
>> 
>> 
>> On Jul 21, 2014, at 1:41 AM, 
>> [email protected]
>>  wrote:
>> 
>> 
>>> The disk won't either re-allocate or "repair" the sector until it is
>>> written to. If the sector can be written to, then the count goes back down
>>> to zero.
>>> 
>>> I clear pending sectors using hdparm. You will need a live Linux CD with
>>> 
>>> it. Knoppix has it, as does Clonezilla, or ALT rescue, among others.
>>> 
>>> Be warned that you will lose whatever data, hence file, is in that sector,
>>> but then, it's really already lost anyway.
>>> 
>>> 1) Boot off one of the live CDs and become root.
>>> 2) Figure out which drive name Linux gives this drive. Likely it will be
>>> 
>>> /dev/sda . Use fdisk -l or smartctl --scan to be sure.
>>> 3) Run the following command: hdparm --read-sector 121893751 /dev/sda
>>> (assuming the drive is /dev/sda; if not substitute the drive's name). Did
>>> you get an error? If yes, that is good (well, kind of). Continue to the
>>> next step.
>>> 4) Edit the command you just ran (use the up arrow). Don't retype! You
>>> only get one chance to get it right. Again, assuming the drive is
>>> /dev/sda, edit the command to read:
>>> hdparm --write-sector 121893751 --yes-i-know-what-i-am-doing /dev/sda
>>> 5) Did that succeed? Yes, then try step 3 again. Did it succeed and give
>>> 
>>> you nothing but zero's? If yes, now recheck SMART. The sector should be
>>> gone.
>>> 6) Now wait 5 minutes to an hour and run step 3 again (or just run the
>>> SMART short test). Did it come back? No is good. You should be done. If
>>> yes, you have a medium error. That's bad.
>>> 
>>> 
>>>> Hi,
>>>> a week ago on two consecutive days the syslog reported a defect block on
>>>> the internal HDD (attached).
>>>> Of course smartd noticed about the SMART attribute Current Pending
>>>> Sector Count: 1
>>>> Now I receive a smartd warning after every selftest of the HDD, because
>>>> 
>>>> the number of failed self tests increased (attached).
>>>> 
>>>> What I read about reallocating the defect block under Windows 7 I must
>>>> admit I did not right understand. As far as I understood the disk
>>>> reallocates the block after some time. After a week this did not happen
>>>> 
>>>> yet.
>>>> I tried the tool that came with smartmontools for windows
>>>> (fix_badsectors.cmd with dd.exe). But that corrupted the boot partition
>>>> 
>>>> (system not found at boot) and didn't change the SMART attributes. So I
>>>> 
>>>> recovered the boot partition.
>>>> 
>>>> Please, can someone give me advice with dealing with that problem? Thank
>>>> you very much.
>>>> Regards
>>>> Bernd
>>>> 
>> -----
>> E-Mail ist virenfrei.
>> Von AVG uberpruft - 
>> www.avg.de
>> 
>> Version: 2014.0.4716 / Virendatenbank: 3986/7892 - Ausgabedatum: 21.07.2014 


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.