Scribbled notes on fixing bad blocks

#smartctl -t short /dev/sdb

then

#smartctl -a /dev/sdb

SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed: read failure 20% 50556 1132724807
# 2 Extended offline Completed: read failure 90% 50556 490221916
# 3 Short offline Completed: read failure 20% 50556 490221916
# 4 Short offline Completed: read failure 20% 50555 490221916
# 5 Extended offline Completed: read failure 90% 50555 490221917
# 6 Short offline Completed: read failure 20% 50554 490221916
# 7 Short offline Completed: read failure 20% 50554 490221916
# 8 Offline Aborted by host 90% 50554 –
# 9 Short offline Completed without error 00% 42680 –
#10 Short offline Completed without error 00% 42 –

#fdisk -lu /dev/sdb

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x447d8526

Device Boot Start End Blocks Id System
/dev/sdb1 63 1953520064 976760001 83 Linux

root@kodaly:~# tune2fs -l /dev/sdb1 | grep Block
Block count: 244190000
Block size: 4096
Blocks per group: 32768

use the lba_of_sector and the start offset in the following calculation

#echo “(1132724807-63)*512/4096” | bc -l

141590593.00000000000000000000

#debugfs
debugfs 1.42 (29-Nov-2011)
debugfs: open /dev/sdb1
debugfs: testb 141590593
Block 141590593 not in use

if it reports as not in use block it out then :

# dd if=/dev/zero of=/dev/sdb1 bs=4096 count=1 seek=141590593

# sync

then

# smartctl -t long /dev/sdb

If it reports in use then

Block 141623865 marked in use
debugfs: icheck 141623865
Block Inode number
141623865 35397635

debugfs: ncheck 35397635
Inode Pathname
35397635 /shares/stuff/Steves Lapto/backups/myers/investigations/Everyman/media/Audio/hitmike.wav

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.