訳あって、ESXiの再インストールを行いました。
その際、構成情報のバックアップ、リストアが必要になったので、
メモしておきます。
vSphere Command-Line Interface
http://communities.vmware.com/community/vmtn/server/vsphere/automationtools/vsphere_cli
に含まれている、
vicfg-cfgbackup.pl
でバックアップ、リストアできます。
今回はWindowsから行うので、
VMware-vSphere-CLI-5.0.0-422456.exe
を選択、ダウンロードします。
VMware-vSphere-CLI-5.0.0-422456.exeを叩けばインストールが始まるので、
終わるまでお茶でも飲みましょう。
特に指定しなければ、
64Bit版
C:\Program Files (x86)\VMware\VMware VI Remote CLI
32Bit版
C:\"Program Files\VMware\VMware vSphere CLI
にインストールされます。
このままコマンド叩くと、DLLがぁぁと怒られますので、再起動します。。。
・バックアップ先・・・D:\esxi_config
・コマンド・・・vicfg-cfgbackup.pl
C直下に保存しようとすると
「C:\Users\ユーザ名\AppData\Local\VirtualStore」
に保存されるみたい。
また、パスにスペースが入っているので、
「“」で囲わないと、そんなファイル知らねぇと怒られますw
ただ、
ESXi 5 Installable Backup
http://communities.vmware.com/thread/337036
にあるように、バックアップ元とリストア先が同じビルドバージョンじゃないと
エラーすることがあるようです。
構成情報をバックアップしてみる。
(32Bit版とはパスが違うので適宜読み替えて下さい)
>C:\"Program Files (x86)\VMware\VMware vSphere CLI\bin"\vicfg-cfgbackup.pl -server IPアドレス -username ユーザ名 -s D:\esxi_config Saving firmware configuration to D:\esxi_config ... >
構成情報をリストアしてみる。
(32Bit版とはパスが違うので適宜読み替えて下さい)
>C:\"Program Files (x86)\VMware\VMware vSphere CLI\bin"\vicfg-cfgbackup.pl -server IPアドレス -username ユーザ名 -l D:\esxi_config Enter password: The restore operation will reboot the host. Type 'yes' to continue: yes Uploading config bundle to configBundle.tgz ... Unable to enter maintenance mode: fault.RestrictedVersion.summary. Please ensure no virtual machines are running on the host and retry the operation again. >
きちんと、ゲストOSを落として、メンテナンスモードにしておかないと
怒られます。
メンテナンスモードにして再度
(32Bit版とはパスが違うので適宜読み替えて下さい)
>C:\"Program Files (x86)\VMware\VMware vSphere CLI\bin"\vicfg-cfgbackup.pl -server 1IPアドレス -username ユーザ名 -l D:\esxi_config Enter password: The restore operation will reboot the host. Type 'yes' to continue: yes Uploading config bundle to configBundle.tgz ... Performing restore ... >
あとは、ホストサーバを再起動すると、
ネットワークやストレージデバイスまできちんと復元されるとおもいます。
その他のオプション
(32Bit版とはパスが違うので適宜読み替えて下さい)
>C:\"Program Files (x86)\VMware\VMware vSphere CLI\bin"\vicfg-cfgbackup.pl --help Synopsis: C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\vicfg-cfgbackup.pl OPTIONS [<backupfile>] Command-specific options: --force -f Force the restore of the configuration. --load -l Restore configuration onto the host --quiet -q Do not prompt for user confirmation. --reset -r Resets host, restore to factory settings. --save -s Backup the host configuration. Common VI options: --config (variable VI_CONFIG) Location of the VI Perl configuration file --credstore (variable VI_CREDSTORE) Name of the credential store file defaults to <HOME>/.vmware/credstore/vicredentials.xml on Linux and <APPDATA>/VMware/credstore/vicredentials.xml on Windows --encoding (variable VI_ENCODING, default 'utf8') Encoding: utf8, cp936 (Simplified Chinese), iso-8859-1 (German), shiftjis(Japanese) --help Display usage information for the script --passthroughauth (variable VI_PASSTHROUGHAUTH) Attempt to use pass-through authentication --passthroughauthpackage (variable VI_PASSTHROUGHAUTHPACKAGE, default 'Negotiate') Pass-through authentication negotiation package --password (variable VI_PASSWORD) Password --portnumber (variable VI_PORTNUMBER) Port used to connect to server --protocol (variable VI_PROTOCOL, default 'https') Protocol used to connect to server --savesessionfile (variable VI_SAVESESSIONFILE) File to save session ID/cookie to utilize --server (variable VI_SERVER, default 'localhost') VI server to connect to. Required if url is not present --servicepath (variable VI_SERVICEPATH, default '/sdk/webService') Service path used to connect to server --sessionfile (variable VI_SESSIONFILE) File containing session ID/cookie to utilize --url (variable VI_URL) VI SDK URL to connect to. Required if server is not present --username (variable VI_USERNAME) Username --verbose (variable VI_VERBOSE) Display additional debugging information --version Display version information for the script
恐らく使わないオプションがいっぱい。。。w
[tegaki]無事、動いた〜[/tegaki]