1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ESXi 6.7 / 7.0 のコンフィグバックアップとリストア

Last updated at Posted at 2023-04-08

確認環境

ESXi6.7 VMware ESXi 6.7.0 build-14320388
ESXi7.0 VMware ESXi 7.0.3 build-20328353

バックアップ

①ESXiにSSH接続し以下のコマンドを実行

backup
#メンテナンスモード設定
esxcli system maintenanceMode get
esxcli system maintenanceMode set --enable true
esxcli system maintenanceMode get

#コンフィグ変更内容のファイル同期
vim-cmd hostsvc/firmware/sync_config

#コンフィグファイル作成(ダウンロードURL出力)
vim-cmd hostsvc/firmware/backup_config

#メンテナンスモード解除
esxcli system maintenanceMode get
esxcli system maintenanceMode set --enable false
esxcli system maintenanceMode get

image.png

②ブラウザからコンフィグURLに接続しダウンロード

コマンド出力結果からダウンロードURLを作成
(ESXiサーバのIPアドレスに置換)
http://*/downloads/52d82cd0-7128-04c3-0d51-35596019eb3e/configBundle-localhost.tgz

http://192.168.142.1/downloads/52d82cd0-7128-04c3-0d51-35596019eb3e/configBundle-localhost.tgz




ダウンロードURLにブラウザでアクセスするとコンフィグがダウンロードされる

image.png

image.png

リストア

①コンフィグファイルについて configBundle.tgz というファイル名に修正

image.png

②データストアにアップロード

(今回はデータストアdatastore1configフォルダを作成して格納)
image.png

③SSHコンソール接続し、以下のコマンド実行

restore
#メンテナンスモード設定
esxcli system maintenanceMode get
esxcli system maintenanceMode set --enable true
esxcli system maintenanceMode get

#コンフィグファイルの場所確認
ls /vmfs/volumes/datastore1/config/configBundle.tgz

#コンフィグファイルを /tmp 配下に移動
cp /vmfs/volumes/datastore1/config/configBundle.tgz /tmp

#リストア実行
vim-cmd hostsvc/firmware/restore_config configBundle.tgz

リストアコマンドを実行すると、直後に再起動が走ります。
vim-cmd hostsvc/firmware/restore_config configBundle.tgz

④再起動が完了し、リストア完了

(その他)リストアコマンドのコンフィグファイル指定について

vmware公式ではリストア実行コマンドのコンフィグファイルについてフルパスで記載するようありますが、実際に実行するとエラーとなり/tmpにコンフィグファイルを配置するように見えますため、上記手順でも/tmpに配置するようしています。

■vmware公式

以下のコマンドを実行して ESXi ホストの構成をリストアします:
vim-cmd hostsvc/firmware/restore_config /backup_location/configBundle.tgz

https://kb.vmware.com/s/article/2042141?lang=ja



■実行結果

restore-ng(ESXi6.7)
[root@localhost:~] vim-cmd hostsvc/firmware/restore_config /vmfs/volumes/datastore1/config/configBundle.tgz
(vim.fault.FileNotFound) {
   faultCause = (vmodl.MethodFault) null,
   faultMessage = <unset>,
   file = "/tmp/configBundle.tgz"
   msg = "Received SOAP response fault from [<cs p:00000037cbd43a50, TCP:localhost:8307>]: restoreConfiguration
File /tmp/configBundle.tgz was not found"
}
[root@localhost:~]
restore-ng(ESXi7.0)
[root@localhost:~] vim-cmd hostsvc/firmware/restore_config /vmfs/volumes/datastore1/config/configBundle.tgz
(vim.fault.FileNotFound) {
   faultCause = (vmodl.MethodFault) null,
   faultMessage = <unset>,
   file = "/tmp/configBundle.tgz"
   msg = "Received SOAP response fault from [<<io_obj p:0x000000a3fc80e2b8, h:5, <TCP '127.0.0.1 : 59576'>, <TCP '127.0.0.1 : 8307'>>, /sdk>]: restoreConfiguration
File /tmp/configBundle.tgz was not found"
}
[root@localhost:~]

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?