2015-10-11 Sun

[別の年の同じ日: 2003 2005 2006 2007 2008 2009 2010 2011

zonecfg delete -F はてぶ

手元の環境で、zone を作ったり壊したりしている時に、
面倒で zonecfg -z testzone delete -F を使ってみた。

zone が 'installed' の状態から 'zonecfg -z testzone delete -F' で testzone を削除するのは、
'zoneadm -z testzone detach && zonecfg -z testzone delete' と同等っぽい。

zonepath の zfs が残っているので、同じ zonepath で zone を設定し、
zoneadm -z testzone install すると、以下のようなエラーになる。

ERROR: The zone you are trying to clone has been detached previously.
You must either re-attach the zone or mark incomplete and uninstall before
trying again.
zoneadm: zone 'testzone': ERROR: cloning failed:  zone switching to configured state


書かれている通り、

# zoneadm -z testzone attach && zoneadm -z testzone uninstall


または

# zoneadm -z testzone mark incomplete && zoneadm -z testzone uninstall


すれば、zoneadm -z test install できるようになる。

zonepath の zfs が既に存在するのが問題なので、
zonepath の zfs を削除してしまってもよい。

ということで、同じ zonepath で zone を作ったり壊したりする時、
'installed' な zone に対して

# zonecfg -z testzone delete -F


すると

# zoneadm -z testzone uninstall && zonecfg -z testzone delete


より、面倒になってしまう。