Cloning a drive with VMware ESXi installed on it

Correct Method

The correct method consists of three steps:

  • Creating a copy of the ESXi server settings using the vicfg-cfgbackup utility with the -s switch (s from save).
  • Clean installation of ESXi on new hardware (for example, on new hard drives).
  • Restoring configuration settings on a freshly installed ESXi using the same vicfg-cfgbackup, but with the -l switch (l from load).

Example: Saving ESXi settings to C:\backup.txt
vicfg-cfgbackup -s C:\backup.txt

Then we restore the settings on a new copy from the file C:\backup.txt
vicfg-cfgbackup -l C:\backup.txt

Optionally, you can add the -q switch to the last command so that the command is executed without asking for confirmation.

Dedicated Server

Dedicated server

Check out SIM-Networks’ powerful pre-made server configurations

See packages

Another method. Not the best, but in some cases also possible

This method can be used if the new hardware does not meet the minimum requirements for ESXi for some reason (for example, it has a single-core processor). To implement this method, the following conditions must be met:

  • The new hard drives should already be installed in the system and the old ones have not yet been removed.
  • A USB flash drive or optical disk with Linux Live USB (CD) installed on it must be connected to the server. Live USB takes the convenient one.

When the top two points are met, do the following:

  • Boot from Live USB.
  • We display the list of available disks with the parted -l command. The output of this command must have at least two disks in it. Source disk (for example /dev/sda) with ESXi already installed on it and target disk (for example /dev/sdb).
  • We look at what partitions are on the source disk using the sgdisk -p /dev/sda command. The output will be something like this:
    Disk /dev/sda: 15679488 sectors, 7.5 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 3703B3D8-7FBE-4A3A-8526-FE24A6BF76DC
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 15679454
    Partitions will be aligned on 32-sector boundaries
    Total free space is 13836413 sectors (6.6 GiB)
    Number Start (sector) End (sector) Size Code Name
    1 64 8191 4.0 MiB EF00
    5 8224 520191 250.0 MiB 0700
    6 520224 1032191 250.0 MiB 0700
    7 1032224 1257471 110.0 MiB FFFF
    8 1257504 1843199 286.0 MiB 0700
  • The next step is to rough copy the source disk to the target disk using the dd utility. Here you need to know how much to copy. Pay attention to the number of the last sector (in the example it is 1843199) and add one to it (because the sector numbering starts from zero).
    Important! All information that was previously on the target disk will be deleted
    dd =if/dev/sda of=/dev/sdb bs=512 count=1843200 This command clones all information from the source drive to the target drive.
  • Next, we need to repair the partition table on the target disk. You can do this with the gdisk utility. The command looks like gdisk /dev/sdb and then: x (to enter the "expert menu"), e (to fix the disk layout), and w (to write the changes).

Congratulations. You should now have a working, absolute copy of your ESXi on the target drive.

Was this article helpful?

Tags:

#server

Did you like the article?

Cookie consent

By clicking «I agree», you consent to our website's use of cookies to give you the most relevant experience by remembering your preferences and repeat visits. However, you may visit «Manage сookies» to provide controlled consent. Learn more

Cookies settings

functional

Necessary cookies are crucial for the basic functions of the website and the website will not work in its intended way without them.

Analytics

Analytical cookies are used to understand how visitors interact with the website.

Advertisement

Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns.