My question is as stated above, on a FreeBSD system, what is the use of the kern.geom.debugflags?

I see it written before the command to write on to a disk.

sysctl kern.geom.debugflags=16

What does it do and is there any Linux equivalent of the following command?

1 Answer 1


Out from the box you cannot write to MBR of disk, which is the one FreeBSD boots from. After setting sysctl kern.geom.debugflags=16 (or kern.geom.debugflags=0x10, which is all the same) you get allowed to shoot in the foot and write to MBR.

It's useful to backup and restore MBR or bootcode using dd: backup and restore MBR via dd

The only way to write into MBR without touching this sysctl is to boot your FreeBSD in single-user mode and work with MBR while root filesystem is mounted read-only. If boot in single-user mode and then remount root filesystem in rw-mode, you will need to set this sysctl to write into MBR. If normally boot in multi-user mode and then go to single-user mode (by typing shutdown now without -r or -h arguments), you would still need to deal with this sysctl to write into MBR.

  • 1
    This example is only related to systems with MBR partition table, not with GPT.
    – AntonioK
    Apr 9, 2015 at 7:43
  • Got badblocks: Operation not permitted while trying to open /dev/ada1 running badblocks -ws -b 4096 /dev/ada1 (on FreeNAS), this solved and explained it.
    – Qtax
    Feb 2, 2020 at 19:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .