Wednesday, February 19, 2014

badblocks: says it is not safe to run and stops

Symptoms:

When checking for bad blocks, following error is displayed:

# badblocks -nvs /dev/sdb
/dev/sdb is apparently in use by the system; it's not safe to run badblocks!

Solution:

  1. Check the mounts (/etc/mtab), unmount with umount
  2. Check the swaps (/proc/swaps), unmount with swapoff
  3. Check volume groups (/dev/mapper/...), deactivate with vgchange -a n