{"id":5599,"date":"2020-09-27T21:23:15","date_gmt":"2020-09-27T19:23:15","guid":{"rendered":"https:\/\/tekmart.co.za\/t-blog\/?p=5599"},"modified":"2020-09-27T21:23:17","modified_gmt":"2020-09-27T19:23:17","slug":"use-the-command-line-for-esxi-host-backup-and-restoration","status":"publish","type":"post","link":"https:\/\/tekmart.co.za\/t-blog\/use-the-command-line-for-esxi-host-backup-and-restoration\/","title":{"rendered":"Use the command line for ESXi host backup and restoration"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time-approximately:<\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>\n<h2 class=\"wp-block-heading\"><strong>Backing up and properly restoring VMs are essential tasks for workload protection. Use a command-line interface, such as vSphere CLI or PowerCLI, to back up and restore the ESXi host.<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn.ttgtmedia.com\/rms\/onlineImages\/bigelow_stephen.jpg\" alt=\"Stephen J. Bigelow\"\/><\/figure>\n\n\n\n<p>By <a href=\"https:\/\/www.techtarget.com\/contributor\/Stephen-J-Bigelow\">Stephen J. Bigelow<\/a><\/p>\n\n\n\n<p>VMware administrators can back up an ESXi host using one of two command-line scripting interfaces: vSphere CLI and PowerCLI. After creating the ESXi host backup, those admins can use the same language to restore it.<\/p>\n\n\n\n<p>The explosive growth of virtualization platforms, such as VMware vSphere, has introduced additional challenges to workload protection. IT administrators can often apply a variety of alternatives and options differently to each workload. Such flexibility is powerful, but organizations must make the best choices and adopt solid practices to ensure that they properly protect each workload.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Experts traditionally distinguish virtualization with\u00a0<em>host<\/em>\u00a0and\u00a0<em>guest<\/em>\u00a0terminology. The hypervisor\u00a0<em>host<\/em>\u00a0is the VM that contains the hypervisor and manages the underlying physical system &#8212; distributing and managing VMs containing one or more\u00a0<em>guest<\/em>\u00a0workloads.<\/p><\/blockquote>\n\n\n\n<p>Nowadays,\u00a0<em>host<\/em>\u00a0usually means the bare-metal hypervisor installed and configured on a physical system, such as VMware ESXi. Since the stability and performance of a host impacts all the VMs operating on the physical system, protecting the host is crucial. Platforms such as VMware ESXi enable admins to back up and restore ESXi host configuration using a command-line interface (CLI), such as\u00a0vSphere CLI\u00a0or\u00a0PowerCLI.<\/p>\n\n\n\n<p>An ESXi host configuration backup under Windows might use a vSphere CLI command line, such as:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>vicfg-cfgbackup.pl --server=host_IP_address --username=root -s file_name<\/strong><\/pre>\n\n\n\n<p>In this command-line example, the\u00a0<em>host_IP_address<\/em>\u00a0is the IP address\u00a0assigned to the ESXi host, and the\u00a0<em>file_name<\/em>\u00a0is the desired name of the backup file being created. In many cases, the target file name appears as a compressed format, such as TAR, so it&#8217;s important to include the file name extension, such as\u00a0<em>test_backup.tgz<\/em>. If a root password protects the host, the backup process prompts the admin for the password before proceeding. If admins don&#8217;t want the additional prompt, they can add a password switch to the command line, such as:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>vicfg-cfgbackup.pl --server=host_IP_address --username=root --password=root_pw -s file_name<\/strong><\/pre>\n\n\n\n<p>In this example, the\u00a0<em>root_pw<\/em>\u00a0is the root password for the ESXi host. The command-line\u00a0syntax under PowerCLI differs substantially\u00a0from the syntax under vSphere CLI. The same backup command in PowerCLI might appear as:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Get-VMHostFirmware -VMHost host_IP_address -BackupConfiguration -DestinationPath output_dir<\/strong><\/pre>\n\n\n\n<p>As with the vSphere CLI example, the&nbsp;<em>host_IP_address<\/em>&nbsp;is the IP address assigned to the ESXi host, and the&nbsp;<em>output_dir<\/em>&nbsp;is the target directory of the backup file.Platforms such as VMware ESXi enable admins to back up and restore ESXi host configuration using a CLI, such as vSphere CLI or PowerCLI.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Once admins create the ESXi host backup, they can restore the ESXi host configuration and vSphere switch configuration. Restoration compares the\u00a0universally unique identifier\u00a0of the host with the UUID of the backup and won&#8217;t restore backups to hosts with different UUIDs, though admins can override this protection.<\/p><\/blockquote>\n\n\n\n<p>When restoring an ESXi host configuration, admins should first power off all VMs on the host, access the CLI, such as vSphere CLI for Windows, and run the backup command line with the&nbsp;-1&nbsp;flag.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>vicfg-cfgbackup.pl --server=host_IP_address --username=root -1 file_name<\/strong><\/pre>\n\n\n\n<p>Here, the\u00a0<em>host_IP_address<\/em>\u00a0is the IP address of the ESXi host, and the\u00a0<em>file_name<\/em>\u00a0is the name of the backup file to restore. If there is a\u00a0root password protecting the host, the recovery process asks for the password before proceeding. If admins don&#8217;t want the additional prompt, it&#8217;s possible to add a password switch to the command line:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>vicfg-cfgbackup.pl --server=host_IP_address --username=root --password=root_pw -s file_name<\/strong><\/pre>\n\n\n\n<p>In this example, the&nbsp;<em>root_pw<\/em>&nbsp;is the root password for the ESXi host. Note that the command-line syntax under PowerCLI again differs substantially from the syntax under vSphere CLI. After placing the host into maintenance mode, the restoration command under PowerCLI might look something like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Set-VMHostFirmware -VMHost host_IP_address -Restore -SourcePath backup_file -HostUser username -HostPassword password<\/strong><\/pre>\n\n\n\n<p>In this example, the\u00a0<em>host_IP_address<\/em>\u00a0is the IP address of the ESXi host, the\u00a0<em>backup_file<\/em>\u00a0is the name of the backup file &#8212; often a\u00a0compressed file with a .tgz extension\u00a0&#8212; and the username and password provide the authentication the admin needs to access the host.<\/p>\n\n\n\n<p>Before attempting any command-line operations, refer to the documentation that accompanies your current version of ESXi for a comprehensive explanation of command-line syntax and options.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Once you&#8217;re familiar with using vSphere CLI or PowerCLI to back up and restore the ESXi host, the next step is to understand the\u00a0various backup methods for your VMs. From there, go over the\u00a0best practices for VM backup and restoration\u00a0and discover\u00a0what tools are available\u00a0to help you.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time-approximately:<\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>Backing up and properly restoring VMs are essential tasks for workload protection. Use a command-line interface, such as vSphere CLI or PowerCLI, to back up and restore the ESXi host. By Stephen J. Bigelow VMware administrators can back up an ESXi host using one of two command-line scripting interfaces: vSphere CLI and PowerCLI. After creating the ESXi host backup, those<\/p>\n<p><a class=\"more-link\" href=\"https:\/\/tekmart.co.za\/t-blog\/use-the-command-line-for-esxi-host-backup-and-restoration\/\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,30,16,3,95,52],"tags":[],"class_list":["post-5599","post","type-post","status-publish","format-standard","hentry","category-datacenter-news","category-expert-advise-and-opinion","category-how-tos-and-other-useful-tips-and-tricks","category-industry-news-and-expert-advise","category-timeless-tips","category-vmware-esx-and-esxi-administration"],"_links":{"self":[{"href":"https:\/\/tekmart.co.za\/t-blog\/wp-json\/wp\/v2\/posts\/5599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tekmart.co.za\/t-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tekmart.co.za\/t-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tekmart.co.za\/t-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tekmart.co.za\/t-blog\/wp-json\/wp\/v2\/comments?post=5599"}],"version-history":[{"count":1,"href":"https:\/\/tekmart.co.za\/t-blog\/wp-json\/wp\/v2\/posts\/5599\/revisions"}],"predecessor-version":[{"id":5600,"href":"https:\/\/tekmart.co.za\/t-blog\/wp-json\/wp\/v2\/posts\/5599\/revisions\/5600"}],"wp:attachment":[{"href":"https:\/\/tekmart.co.za\/t-blog\/wp-json\/wp\/v2\/media?parent=5599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tekmart.co.za\/t-blog\/wp-json\/wp\/v2\/categories?post=5599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tekmart.co.za\/t-blog\/wp-json\/wp\/v2\/tags?post=5599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}