VMWare esx/esxi virtual machine hard disk's thick provisioning (Thick provision) and thin provisioning (Thin provision) conversion

Source: Internet
Author: User

VMWare Esx/esxi has two hard disk provisioning methods, thick prep (thick) and thin provisioning (Thin)

There may be times when a virtual machine disk can be turned between two modes due to performance issues or disk space, although there is no way to modify the virtual machine configuration page, but this thing can actually be changed.

The hard disk provisioning method looks here:

The client must be shut down before the drive is converted!!!

One, thin provision of thickening provision

In fact, this operation is relatively simple. If you see the hard disk in the above window as thin provisioning mode, you can perform the conversion operation.

Two methods:

Method One: VMware official approach

VMware says:

· Click the Summary tab for the virtual machine.

· Under Resources, right-click the data store where the virtual machine resides, and then click Browse Data Store.

· Double-click the virtual Machine folder to display the. vmdk file.

· Right-click the. vmdk file, and then click Expand. The enrich option converts the disk to thick provisioning.

If the expansion button is gray, it is possible because: 1, no shutdown, 2, the hard disk is already thick-provisioned.

Method Two: esxcli command conversion

In fact, the method of a relatively simple. Of course, you can also use ESXCLI to convert it, but obviously there is no convenient mouse point. For the specific operation of method two, see thick provisioning to thin provisioning section ... And then tiger a bit ...

In fact, there is a method of three, that is, the thin-provisioned cloning thick preparation, but this method, I personally think, since there is a method, if not more than a virtual machine, this method is a take off the pants fart practice ... The same procedure refers to the next section ...

The expansion of this old thing is slow ... A half-day expansion ...

Second, thick provision to streamline provisioning

There are still two ways to do this (there's a good way back)

Method One: VMware recommended method

In fact, VMware also gives the official solution, but it is very pit.

VMware says:

To convert a virtual machine base disk from thick provisioning to thin provisioning by changing the data store and using an offline virtual machine migration, do the following:

Note: This process requires multiple data stores. If there is only one data store, you can clone the virtual machine to a target virtual machine with a thin provisioned disk without performing a migration.

1. Turn off the virtual electromechanical source.

2. Right-click the virtual machine and click Migrate.

3. Click Change Data Store.

4. Click Next, and then select a datastore that is different from the current data store.

5. In the drop-down list, select thin provisioned virtual disk format.

6. Click Next, and then click Finish. You can monitor the transition progress in the tasks and Events view of VCenter Server.

Follow the steps below to perform Storage vMotion operations on vsphere 5.5 from vsphere Webclient:

1. Right-click the virtual machine and select migrate.

1. To locate the virtual machine, select Data Center, folder, cluster, resource pool, host, or VAPP.

2. Click the Related Objects tab, and then click Virtual Machine.

2. Select Change data store, and then click Next.

3. Select thin provisioning for the disk for the virtual machine, and then click Next.

4. Select the virtual machine storage policy from the virtual machine storage Policy drop-down menu and click Next.

5. Select the data storage location where the virtual machine files are stored, and then click Next.

6. Review the information on the "Check for selection" page and click Finish

His approach is actually to say that there are multiple storage words that can be used in a migration way. But we sometimes only have one store, then we need to clone it.

Right-click the virtual machine you want to convert and click Clone

Give him a new name, specify a location, and then next

Select a host, next

The point is, when you select memory, there is a drop-down menu, choose thin Provisioning, next, then the action, on demand.

Then, or that sentence, old slow ... I'm a 20G Windows2003, cloned for three hours ...

Method Two: Esxcli method

What about people like us who don't have multiple stores and obsessive-compulsive patients who don't want to clone virtual machines? Well, that's a good way to go! Using the ESX CLI can be a good solution to this problem.

First of all, you need to start the ESX server SSH feature, click on the host---configuration-------------Properties->ssh-> options.

Such as:

Then with some such as putty, SECURECRT and other SSH software to connect the server, as to how to connect, how to login, here or not introduced it ...

In fact, this ESXi CLI is similar to the Linux command, the basic commands such as CD VI AH can be used. The main tools used in this session are MV, CD, VI and Vmkfstools. Vmkfstools is a tool for converting disks (at least I understand it) to clone disks, fill 0, and so on.

First of all, the VMware disk is divided into two main files, one is XXX.VMDK and the other is XXX-FLAT.VMDK. XXX.VMDK is can be opened with VI editing, is a text file, as for the flat file, look at his size to know that this is the real thing to save data! But it seems that xxx.vmdk is more important, the personal understanding should be that this file is the entire virtual disk description, each operation by the file to adjust the configuration recorded in order to determine the actual data disk file read. The same is true of the. vmx file for VMware virtual machines. To start the virtual machine, VMware needs to read the. VMX configuration description of the virtual machine, and then follow the configuration to boot the virtual machine. The configuration of the virtual disk image name is also preserved in the. vmx file. Of course, the VMX file also writes which VMDK file should be loaded.

Vmkfstools The syntax for this command is:

# vmkfstools-i <Source-File>-d {Thick|thin} <Dest-File>

-I option to clone disk mirroring

Source-file as source files, such as XXX.VMDK

-D is the Clone target file option, which can be added thick or thin, without adding a copy intact, the source file is what provisioning method, the target file is what

Dest-file is the target file, such as XXX.VMDK

Use this command to convert a VMDK file, which first examines the description of the data file in the VMDK. If the description is not found FLAT.VMDK will be an error. After conversion, the FLAT.VMDK in the new VMDK file is automatically changed to the new FLAT.VMDK name.

For example, the original file for OLD.VMDK and OLD-FLAT.VMDK, thick preparation, using the VI Editor Open OLD.VMDK will find, which has the following line:

If you want to convert the file to

Then, the command to convert the disk to thin provisioning using the Vmkfstools command is as follows:

NewVMDK

After a long wait, two new files, NEW.VMDK and NEW-FLAT.VMDK, are generated. After conversion, the area is automatically changed to a new file name, which is NEW-FLAT.VMDK.

However, since the virtual machine disk file described in the vmx file is OLD.VMDK, we need to rename the newly generated two files new.vmdk and new-flat.vmdk to OLD.VMDK and OLD-FLAT.VMDK, and modify the related configuration in the above file to a new disk file.

or modify the. vmx file to point to the new disk file, and the VMX file modifies the location shown.

However, it is said that this will require reloading the VMX file to reload the virtual machine, which I have not tried.

At this point, the disk conversion work is complete.

VMWare esx/esxi virtual machine hard disk's thick provisioning (Thick provision) and thin provisioning (Thin provision) conversion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.