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

5 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
  4. Thanks, this helped me out alot. :)

    ReplyDelete
  5. Thanks! But I found you too late, hopefully forced execute won't break the stick...

    If the tool could just say, where exactly the drive is used, it would much better in terms of UX.

    ReplyDelete