chun 2012-6-19 15:54
[轉貼]VMware ESXi 5 系統設定備份與回復
<a href="http://blogs.yyes.chc.edu.tw/post/2/3830">http://blogs.yyes.chc.edu.tw/post/2/3830</a>
<div><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">VMware ESXi 5 Server 系統設定的備份與回復,執行「vSphere Command-Line Interface」的「vicfg-cfgbackup」指令加上適當參數即可完成。</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">「vSphere Command-Line Interface」不論是 Windows 版、Linux 版,或者包含「vSphere CLI」的 VMware vSphere Management Assistant (vMA),全都可以註冊帳號登入 VMware 網站取得下載路徑。因此,在已安裝「VMware vSphere Client」的 Windows PC 上,再新增「vSphere Command-Line Interface」程式將是較為簡單的方式。</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><img src="https://lh4.googleusercontent.com/-WhglAcn0atg/T7hbIspRNNI/AAAAAAAAFn8/7gh7myqC_aw/s295/vSphere%2520Command-Line%2520Interface.jpg" align="right" style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">【作業環境】</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">Host OS:VMware ESXi 5.0.0</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">Client OS:Windows 7</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">【指令參數】</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">vSphere Command-Line Interface 的指令,在 Windows 系統當然只能在「命令提示字元」裡操作:</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">開始 > 所有程式 > VMware > VMware vSphere CLI > Command Prompt 命令提示字元,先用「--help」參數來查詢「 vicfg-cfgbackup」指令的主要用法:</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">vicfg-cfgbackup.pl --help</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "> --force</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "> -f 強制還原設定</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "> --load</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "> -l 還原主機設定</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "> --quiet</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "> -q 執行時不顯示訊息</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "> --reset</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "> -r 回復主機還原至原始預設值</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "> --save</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "> -s 備份儲存主機設定</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">……</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">因此,這次用到的是「-s」、「-l」兩個參數。</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">【系統備份】</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">vicfg-cfgbackup.pl --server <伺服器位址> -s <備份檔案名稱> </span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">或者因排程等其他需求而加上登入帳號、密碼:</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">vicfg-cfgbackup.pl --server <伺服器位址> --username root --password <管理者密碼> -s <備份檔案名稱></span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">如:</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><table border="0" cellpadding="2" cellspacing="2" style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; text-align: left; background-color: rgb(255, 255, 204); width: 440px; "><tbody><tr><td>C:\Program Files\VMware\VMware vSphere CLI>vicfg-cfgbackup.pl --server 172.20.1.x -s 20120501_h1.cfg<br>Enter username: root<br>Enter password:<br>Saving firmware configuration to 20120501_h1.cfg ...</td></tr></tbody></table><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">【系統回復】</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">vicfg-cfgbackup.pl --server <伺服器位址> -l <備份檔案名稱></span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">如:</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><table border="0" cellpadding="2" cellspacing="2" style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; text-align: left; background-color: rgb(255, 255, 204); width: 440px; "><tbody><tr><td>C:\Program Files\VMware\VMware vSphere CLI>vicfg-cfgbackup.pl --server 172.20.1.x -l 20120501_h1.cfg<br>Enter username: root<br>Enter password:<br>The restore operation will reboot the host.<br>Type 'yes' to continue:</td></tr></tbody></table><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">輸入「yes」讓主機載入備份設定內容後重新開機……</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><table border="0" cellpadding="2" cellspacing="2" style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; text-align: left; background-color: rgb(255, 255, 204); width: 440px; "><tbody><tr><td>yes<br>Uploading config bundle to configBundle.tgz ...<br>Performing restore ...</td></tr></tbody></table><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "><span style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); ">開機後以「VMware vSphere Client」登入,檢查 ESXi Server 的 root 密碼、序號、網路位址、自動校時、iSCSI、NFS……等系統設定內容,皆已回復至備份時狀態。</span><br style="color: rgb(56, 46, 31); font-family: 'Lucida Grande', Arial, sans-serif; font-size: 12px; line-height: 21px; background-color: rgb(243, 243, 235); "></div>