Removing Bad Blocks With FSCK

Last Updated on

Occasionally hard drives encounter continuity errors, even on Linux.  Recently I had a disk which I tried running every manner and combination of FSCK commands and various other repair tools.  After giving up and returning to the issue, the following solved my drive troubles:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@nuuk /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 74.5G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 73.5G 0 part
├─centos-root 253:0 0 44.4G 0 lvm /
├─centos-swap 253:1 0 7.5G 0 lvm
└─centos-home 253:2 0 21.7G 0 lvm /home
sdb 8:16 0 298.1G 0 disk
└─sdb1 8:17 0 298.1G 0 part /media/usb_drive2
sdc 8:32 0 1.8T 0 disk
└─sdc1 8:33 0 1.8T 0 part /media/usb_drive1
sdd 8:48 0 1.8T 0 disk
└─sdd1 8:49 0 1.8T 0 part /media/usb_drive3

sdd1 was giving me issues:

1
2
umount /dev/sdd1
fsck /dev/sdd1 -y -C

To check for bad blocks as well (very time consuming):

1
2
umount /dev/sdd1
fsck /dev/sdd1 -y -C -c

For XFS Partitions with Superblock issues:

1
2
3
xfs_repair /dev/device
xfs_repair -n /dev/device
xfs_repair -L /dev/device  ##Potentially destructive use as last resort
Lima

About the author

Lima is the visual nautical indicator for "stop instantly."

Leave a Reply