Unified Archivesとarchiveadm
Solaris11.1からSolaris11.2になってしばらく経ちましたが、あまりしっかり触っていないので久しぶりにチョットいじってみました、、と言っても大した事ではないのですが...
archiveadmでzoneを移動してみる
Solaris11.2的な方法でbeachiku zoneのイメージをアーカイブしてみる
tsubane7 ~ # zoneadm list -v ID NAME STATUS PATH BRAND IP 0 global running / solaris shared 5 beachiku running /export/zones/beachiku solaris excl tsubane7 ~ # tsubane7 ~ # archiveadm create -z beachiku /var/tmp/vbeachiku.uar Initializing Unified Archive creation resources... Unified Archive initialized: /var/tmp/vbeachiku.uar Logging to: /system/volatile/archive_log.11691 Executing dataset discovery... Dataset discovery complete Creating install media for zone(s)... Media creation complete Preparing archive system image... Beginning archive stream creation... Archive stream creation complete Beginning final archive assembly... Archive creation complete tsubane7 ~ #簡単、これで、beachiku zoneのunified archiveが作成される
uarの情報をみれる
tsubane7 ~ # archiveadm info -v /var/tmp/vbeachiku.uar
Archive Information
Creation Time: 2015-03-08T04:52:16Z
Source Host: tsubane7
Architecture: i386
Operating System: Oracle Solaris 11.2 X86
Recovery Archive: No
Unique ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Archive Version: 1.0
Deployable Systems
'beachiku'
OS Version: 0.5.11
OS Branch: 0.175.2.0.0.42.2
Active BE: solaris
Brand: solaris
Size Needed: 721MB
Unique ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
AI Media: 0.175.2_ai_i386.iso
Root-only: Yes
tsubane7 ~ #
その他、--targetsオプションなどストレージ構成情報などを表示できるようです再度アーカイブファイルからリストアしてみる
zonecfgでサーバー設定を読み込む
tsubane7 ~ # zonecfg -z beachiku create -a /var/tmp/beachiku.uar ID NAME STATUS PATH BRAND IP 0 global running / solaris shared - beachiku configured /export/zones/beachiku solaris excl tsubane7 ~ #zoneの設定はアーカイブファイルに入っているので、zonecfgコマンドで設定してあげる、前からこうして欲しかったので案外うれしい。
zoneadmでアーカイブファイルを戻す
tsubane7 ~ # zoneadm -z beachiku install -a /var/tmp/beachiku.uar
The following ZFS file system(s) have been created:
rpool/export/zones/beachiku
Progress being logged to /var/log/zones/zoneadm.20150308T060221Z.beachiku.install
Installing: This may take several minutes...
Install Log: /system/volatile/install.19770/install_log
AI Manifest: /tmp/manifest.beachiku.ReayLM.xml
Zonename: beachiku
Installation: Starting ...
Commencing transfer of stream: 182b1b9c-f0a6-4608-8ca5-bd9c7278467b-0.zfs to rpool/export/zones/beachiku/rpool
Completed transfer of stream: '182b1b9c-f0a6-4608-8ca5-bd9c7278467b-0.zfs' from file:///var/tmp/beachiku.uar
Archive transfer completed
Installation: Succeeded
Zone BE root dataset: rpool/export/zones/beachiku/rpool/ROOT/solaris
Cache: Using /var/pkg/publisher.
Updating image format
イメージ形式はすでに最新です。
Updating non-global zone: Linking to image /.
処理中 リンクされたイメージ: 1/1 完了
Updating non-global zone: Syncing packages.
このイメージは更新の必要はありません。 (zone:beachiku)
Updating non-global zone: Zone updated.
Result: Attach Succeeded.
Done: Installation completed in 145.023 seconds.
Next Steps: Boot the zone, then log into the zone console (zlogin -C)
to complete the configuration process.
Log saved in non-global zone as /export/zones/beachiku/root/var/log/zones/zoneadm.20150308T060221Z.beachiku.install
tsubane7 ~ #
うまくいけばattachされる、そしてzoneを起動する、初回は-Cでzloginするよ
tsubane7 ~ # zoneadm -z beachiku boot tsubane7 ~ # zlogin -C beachiku後は普通に起動しちゃう。
エラーとか
ネットワークとか、zoneの設定とグローバルzoneの設定とか合わないとinstall時にちゃんとチェックをしてくれる
zoneadm: zone beachiku: WARNING: Skipping network interface: net resource for 'beachiku0': unable to find physical 'beachiku0': object not found.「VNICのbeachiku0がねぇーよ」って文句をいう
zoneadm: zone beachiku: verifying fs /share failed: could not access '/export/share': No such file or directoryこれはlofsでグローバルゾーンのディレクトリをbeachiku zoneでマウントさせようとしたのに、グローバルゾーンにそんなディレクトリがないので叱られる。
で、なにがいいの?
11.1の時とやり方が変わったUnified Archiveですが、なにがいいかとチョット調べてみましたが、このアーカイブをUSBとか他のメディアに書き込んでUSBブートとか出来そうだったり、リアルな実サーバーとかにもそのまま移せたりと、その逆とかもできちゃったりとSolaris11.2だったらやりたい放題らしいです。
これはいい、achiveadmコマンドもオプションが多くてまだ細かく制御できるっぽいのですが、ボチボチ覚えていこうと思います。
また、酒を飲む時間が増えそうです...
