Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I used badblocks to scan a partition on my hdd for bad sectors and it gave me the following output

output

...from what I understand it looks like "one scratch on the hdd" ... anyways I can't partition with gparted because of this bad sector (my previous question: I need help with increasing the size of the file-system partition. Partitioning-o-phobia!) gparted still gives me "a red exclamation mark" on the drive after the badblocks test. ...now what?

I have also tried chkdsk on windows but still gparted gives the red mark

How do I mark this bad sector so that gparted can do its work? :) ...plz exclude answers about "replacing the hdd" I know I can do that.

share|improve this question
add comment

2 Answers 2

Try writing to those blocks:

sudo dd if=/dev/zero of=/dev/sda6 bs=1024 count=1 seek=303975848
sudo dd if=/dev/zero of=/dev/sda6 bs=1024 count=1 seek=303975849
sudo dd if=/dev/zero of=/dev/sda6 bs=1024 count=1 seek=303975850
sudo dd if=/dev/zero of=/dev/sda6 bs=1024 count=1 seek=303975851

(or in your case, you could collapse that to a single dd call with count=4)

Then run badblocks again.

On a modern hard drive, the controller already knows the blocks are bad, and will remap them, but still cannot provide the data from the previous location (since it's bad). Writing to the blocks will cause everything to look good again, and then you don't have any need for the filesystem to take care of it.

If this does work, then the second run of badblocks should find no bad blocks.

share|improve this answer
    
ummm I really don't understand the tech part but I'll just do those commands ... I could use more knowledge though :D –  Mina Michael Jan 10 at 14:14
    
just executed those commands then opened gparted and it still shows the "red exclamation mark" that indicates that there's a bad sector... will running badblocks again make a difference? –  Mina Michael Jan 10 at 14:26
    
...well my problem got solved. thanks for helping :) ... the 4 commands you told me to do, they delete the data on these 4 sectors, right? –  Mina Michael Jan 10 at 15:29
1  
@MinaMichael: No, they just (try to) write to these bad blocks. If the drive is SMART (modern), it will automatically detect that the write failed and that the blocks are bad and the drive will use new (spare) ones instead - making the disk look as if it was without bad blocks. –  FriendFX Jan 13 at 12:23
1  
The question is, what can be done if the drive is not modern enough to be SMART? –  FriendFX Jan 13 at 12:24
show 4 more comments
up vote 1 down vote accepted

...well now gparted says it's clean!! AT LAST!! ...anyways I'm not sure what exactly solved the problem but I'll list what I've done backwards:

sudo ntfsfix -b /dev/sda6 which gave out:

Refusing to operate on read-write mounted device /dev/sda6.
minow@mina-ubuntu:~$ sudo ntfsfix -b /dev/sda6
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
Going to un-mark the bad clusters ($BadClus)... OK
NTFS partition /dev/sda6 was processed successfully.

but before that I did:

sudo dd if=/dev/zero of=/dev/sda6 bs=1024 count=1 seek=303975848
sudo dd if=/dev/zero of=/dev/sda6 bs=1024 count=1 seek=303975849
sudo dd if=/dev/zero of=/dev/sda6 bs=1024 count=1 seek=303975850
sudo dd if=/dev/zero of=/dev/sda6 bs=1024 count=1 seek=303975851

and before that I did

sudo badblocks -nvs /dev/sda6 ... which took 2 whole days to finish!

anyways, lastly, before the last command, I opened windows 7 and used the chkdsk utility (right click the partition, properties, "tools"(or something like that), check for errors)

I hope this helps anyone.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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