Transferred from: http://www.wiser001.cn/2014/11/21/vmware-esxesxi-%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%A1%AC%E7%9B%98%E7%9A%84%E5% 8e%9a%e7%bd%ae%e5%a4%87thick-provision%e4%b8%8e%e7%b2%be%e7%ae%80%e7%bd%ae%e5%a4%87thin-provision%e7%9a%84%e8% bd%ac/
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.
- Turn off the virtual electromechanical source.
- Right-click the virtual machine, and then click Migrate .
- Click change data store .
- Click Next , and then select a datastore that is different from the current data store.
- In the drop-down list, select thin provisioned virtual disk format.
- 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:
- Right-click the virtual machine and select migrate .
- To find a virtual machine, select the datacenter, folder, cluster, resource pool, host, or VAPP.
- Click the Related Objects tab, and then click Virtual Machines .
- Select change data store , and then click Next .
- Select Thin provisioning for the disk for the virtual machine, and then click Next .
- Select the virtual machine storage Policy from the virtual machine Storage Policy drop-down menu, and then click Next .
- Select the data storage location where the virtual machine files are stored, and then click Next .
- Review the information on the Check Selection page, and then 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:
# vmkfstools-i old.vmdk-d Thin NEW.VMDK
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.
Thick provisioning of VMWare esx/esxi virtual machine hard disks (Thick provision) and thin provisioning (Thin provision) conversion