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

3 comments:

  1. This was helpful. I had originally checked only for conditions 1 and 2 and was stumped. Thanks.

    ReplyDelete
  2. 4. Check software RAID (/proc/mdstat), stop with mdadm

    ReplyDelete
  3. Thanks @Martin Žember, it works

    ReplyDelete