-1

How to confirm dd does Not erase the bad blocks list made by e2fsck ?

An old 1500 GB HDD (hard disk drive), without data,
took about 33 hours (1932 minutes) to run this command:

time sudo e2fsck -c -c -k -C 0 /dev/sda1

output

e2fsck 1.46.5 (30-Dec-2021) 
Checking for bad blocks (non-destructive read-write test) 
Testing with random pattern: done                                                  
_1500G_GEXT4: Updating bad block inode. 
Pass 1: Checking inodes, blocks, and sizes 
Pass 2: Checking directory structure                                            
Pass 3: Checking directory connectivity 
Pass 4: Checking reference counts 
Pass 5: Checking group summary information                                      
                                                                               
_1500G_GEXT4: ***** FILE SYSTEM WAS MODIFIED ***** 
_1500G_GEXT4: 11/91578368 files (0.0% non-contiguous), 6031026/366284288 blocks

real    1932m4.759s user    0m2.296s sys     0m7.618s

time sudo e2fsck -c -c -k -C 0 /dev/sda1

-c use badblocks(8) program to do a read-only scan

second -c makes it do a non-destructive write+read test,
External Hard Drive bad sectors recover/mark utility in linux

-k When combined with the -c option, any existing bad blocks in the bad blocks list are preserved, and any new bad blocks found by running badblocks(8) will be added to the existing bad blocks list.

-C fd
-C 0 progress of the file system check can be monitored

see man e2fsck

said differently:
Would doing a dd command erase what took 33 hours to achieve?
Does a dd command erase the bad blocks list?
How to confirm dd does Not erase the bad blocks list made by e2fsck ?

A dd command means one or both:
time sudo dd if=/dev/urandom of=/dev/sd_ bs=64K status=progress
time sudo dd if=/dev/zero of=/dev/sd_ bs=64K status=progress

details:

lsblk -ae7 -oType,name,path,size,fsuse%,tran,pttype,fstype,label,partlabel,mountpoints |grep 'sda\|MOUNT'

TYPE NAME PATH SIZE FSUSE% TRAN PTTYPE FSTYPE LABEL PARTLABEL MOUNTPOINTS
disk sda /dev/sda 1.4T sata gpt
part └─sda1 /dev/sda1 1.4T gpt ext4 _1500G_GEXT4 PART_1

neofetch --stdout |grep 'OS:'
OS: Kubuntu 22.04.2 LTS x86_64

e2fsck -V
e2fsck 1.46.5 (30-Dec-2021)
Using EXT2FS Library version 1.46.5, 30-Dec-2021

--

joseph22
  • 509

2 Answers2

4

What do you want to achieve? -- Achieve HDD with no errors.

That lets disk reallocate errors to spare sectors.

Reallocation of sectors does not heal a dammaged disk. The reallocation process is masking the dammaged sectors up.

What you are doing is effectively window dressing on file system level. When partitioning and formating the disk it will look clean but on firmware level you might have a big mess.

Computer slows down or Computer hangs. Disk makes clicking sound.

The clicking sound is an indication of a hardware issue. All symptoms put together your disk is dying, replace it.

Running ´smartmontools´ to compile SMART information will most likely deliver some additional arguments not to use this disk anymore.

r2d3
  • 4,050
0

You should replace this disk if it is getting bad blocks. Problems will arise in short time.

However solution for you to go around bad blocks is to use dd into file on file system on that disk, not on whole disk. File system will know where are the bad blocks and will go beside them.

pbies
  • 3,550