Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 12847  / 3 Years ago, sun, june 27, 2021, 3:24:05

I have some bad sectors on my hard drive, so I followed the guide from this website



To detect the bad sectors, I did the following command:



sudo badblocks /dev/sda5 > /media/3865-6163/sda5


That worked fine, the next step is to run the following command:



sudo fsck -l /media/3865-6163/sda5 /dev/sda5


For some reason, this does not work for me and gives me the following message:



ubuntu@ubuntu:/media/3865-6163$ sudo fsck -l /media/3865-6163/sda5 /dev/sda5
fsck from util-linux 2.20.1
Usage: fsck.ext4 [-panyrcdfvtDFV] [-b superblock] [-B blocksize]
[-I inode_buffer_blocks] [-P process_inode_size]
[-l|-L bad_blocks_file] [-C fd] [-j external_journal]
[-E extended-options] device

Emergency help:
-p Automatic repair (no questions)
-n Make no changes to the filesystem
-y Assume "yes" to all questions
-c Check for bad blocks and add them to the badblock list
-f Force checking even if filesystem is marked clean
-v Be verbose
-b superblock Use alternative superblock
-B blocksize Force blocksize when looking for superblock
-j external_journal Set location of the external journal
-l bad_blocks_file Add to badblocks list
-L bad_blocks_file Set badblocks list
ubuntu@ubuntu:/media/3865-6163$


Why is this not working?


More From » 12.04

 Answers
7

You don't want to use badblocks. Modern drives are SMART and are capable of reporting errors and remapping any sectors that are bad to a spare pool. The drive can only remap sectors when you try to write to them though. If the disk utility reports that the drive has a few pending reallocations, then you can force them to happen by writing zeros to the whole disk:



sudo dd if=/dev/zero of=/dev/sda


After that, there should be no more pending sectors. If the sectors were physically damaged, the count of reallocated sectors will go up. If the data had simply been scrambled, writing zeros to the media corrected it without the need to reallocate the sector.



If you end up with any sectors that are still pending or offline_uncorrectable, or more than a few reallocated sectors, you need to replace the drive.


[#34154] Sunday, June 27, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
steaocyte

Total Points: 345
Total Questions: 122
Total Answers: 121

Location: Spain
Member since Wed, Nov 23, 2022
1 Year ago
steaocyte questions
;