FreeNAS(FreeBSD) で gpart が Operation not permitted になるとき
sysctl kern.geom.debugflags=0x10
ないし、
sysctl kern.geom.debugflags=16
を試してみる。
http://d.hatena.ne.jp/r_coppelia/20100301/1267445053
もし以下のようなエラーが表示されて、書き込みに失敗した場合は、sysctl コマンドを実行すると良いらしい。
This may fail with an "operation not permitted" error message, since the kernel likes to protect critical parts of the disk. If this happens for you, run:
Fixit# sysctl kern.geom.debugflags=0x10
翻訳:(もしかしたら、"operation not permitted" というエラーメッセージが表示されて、dd コマンドの実行に失敗するかもしれない。なぜ失敗するかといえば、カーネルは、ディスクの重要な部分を保護したがるからだ。もし失敗した場合は、以下を実行すると良い。)Fixit# sysctl kern.geom.debugflags=0x10
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.
http://d.hatena.ne.jp/m-bird/20080424/1209015802
「disk write error」とか出ます。
うざいっす。
で、これはGEOMとかいうもんでセキュリティ上ロックしているらしいので、これを解除してやります。
$ sysctl kern.geom.debugflags
で確認してみて下さい。たぶん、0になってます。
で、これを解除するには、この値を16にしてやれば良いらしいので、セットしちゃいます。
# sysctl kern.geom.debugflags=16
https://ja.wikipedia.org/wiki/GEOM
GEOM は、FreeBSD オペレーティングシステムにおける主要なストレージフレームワーク。