This was a weird one for me. We had a client ask for a CentOS 7 installation, one of the other techs always installs CentoOS 6 to do a Dell firmware update then leaves it to install what the client requests. I went to install CentOS 7 and it wouldn’t work, tried multiple times, went back to 6 it worked, tried 7, pulled the disk and put in a new one, and still no luck.
I later decided I was going to do a full wipe on the drive and make sure i’m not missing something.
I first started by using wipefs to remove all partitions
wipefs -af /dev/sda
then ran badblocks with a destructive write to clear the drive contents, and test there isn’t any bad sectors.
badblocks -v -p 1 -w -s /dev/sda
Guess what after all that I went back and was able to install my CentOS 7 without a problem. I’m assuming since the drive was previously on a server with a RAID there was some additional partition info that needed to be wiped.
Another way to use badblocks is to take the output of badblocks and run it through fsck for a partition to update the badblocks list, example this time using a non-destructive test for sda2 partition.
badblocks -v -n -s /dev/sda2 > badsectors.txt fsck -l badsectors.txt /dev/sda2