Resizing (Shrinking) Drives With VMware Standalone Converter

KB ID 0000185

Problem

Using: vSphere 6.7 and VMware Standalone Converter Version 6.2.0

I’m performing this procedure on vSphere 6.7, back ith the release of vSphere 5, This process changed, with vSphere 4 and VI3, you had to install VMware Converter on the vCenter Server then download and enable the plugin in your VI client software (like this).

VMware now only has the “standalone converter“, so now you DONT install anything on the vCenter server, the converter runs on a client machine/server.

Note: This article is primarily concerned with shrinking guest hard drives, If you want to make your drives larger you can also use this process but the following article will be easier. Resizing Windows Volumes / Drives in VMware vSphere / ESX

Also if space is your consideration, you also might want to consider; VMware ESXi – Converting ‘Thick’ Provisioned Drives to ‘Thin’

Solution

Resizing (Shrinking) Guest Hard Drives in vSphere

Before you start:

Remember you are cloning a machine, don’t have clients writing data to the machine while this is going on, or there is the potential for data to be lost. If possible disable any services that will accept data, e.g. Exchange, SQL, Oracle, etc, prior to cloning.

Licensing: Only really applicable if you’re cloning a physical machine, but make sure you DO NOT have OEM Licensing. Also if you have Windows Storage Server, or Windows Appliance Edition, you should speak to a license specialist.

Installing VMware converter is pretty straightforward, run the install file accept the EULA, select. local installation, and I opt out of the ‘User Experience’, when complete it will open the Converter client by default, (as shown).

When the program opens > Convert machine > Type in the name of the machine you are going to convert, and credentials to logon and install the converter agent > Next.

 

Type in the name of the machine you are going to convert, and credentials to logon and install the converter agent.

If you’re going to retire the target machine afterwards, this it does not really matter, but I leave it on the defaults > Yes.

5. Now enter the vSphere/ESX target details that you are going to create the cloned copy on. > Next.

Give the new VM a name, select which folder to place the new VM into > Next. (Note: You may get a certificate warning, if so click ignore).

7. Chose a Cluster/Host > Choose which storage to place the files into. > Next.

8. In the ‘Data to Copy’ section > Edit.

9. Here you can select the NEW sizes for the drive(s) on the cloned machine. > Next.

10. Finish.

11. Depending on the size of the VM it can take a while.

12. Now power of the original, and power on the new machine and TEST IT THOROUGHLY, when you are happy you can delete the source machine.

Resizing (Shrinking) Guest Hard Drives in vSphere 4 (and older)

The following procedure was done with VSphere4 but the process is the same in VI3. Before you start ensure that VMware Converter has been installed on the Virtual Center Server.

 

Related Articles, References, Credits, or External Links

VMware Converter ‘A file I/O Error Occurred’

VMware Converter Slow!

VMware Converter ‘Unable to Connect to the Network Share’

VMware Converter – Unable to Deploy Agent

Migrate a VM from vCenter to Azure

KB ID 0001510

Problem

Last time we looked at migrating from vCenter to Hyper-V, now we will use the MVMC (Microsoft Virtual Machine Converter) to take a VMware (vCenter) virtual machine and convert/upload it to Microsoft Azure.

Note: MVMC is not ‘officially’ supported and this procedure requires you to create some ‘legacy’ (for legacy in Azure read ‘classic’) ways of doing things. So this might not be the tool for you. But if you want to go down this route, this is what you need to do.

The best approach is to use Azure Site Recovery (ASR)

A better option might be to use Veeam?

Solution

To connect the MVMC to Azure you need a ‘Management Certificate’ This can be a self generated (self signed) certificate. To create it on your MVMC machine execute the following commands;

[box]

Import-Module PKI
 
New-SelfSignedCertificate -DnsName "MVMC" -CertStoreLocation "Cert:\CurrentUser\My" 
 
Export-Certificate -Cert (Get-ChildItem Cert:\CurrentUser\My\ -DnsName MVMC) -FilePath $env:TEMP\MVMC.cer
Import-Certificate -FilePath $env:TEMP\MVMC.cer -CertStoreLocation Cert:\CurrentUser\Root

[/box]

Take a note of the Thumbprint. You will need this certificate thumbprint, and your Subscription ID. Once you have uploaded the certificate you’ve just created, to connect with MVMC. So now you need to connect to you Azure subscription.

All Services > Subscriptions.

Take a note of your subscription ID, then click the subscription.

Management Certificates > Upload > Location ether certificate in your temp directory, and upload it.

You need to create a ‘Classic’ Storage account > All Services > Storage Account (Classic) > Create Storage Account (Classic) > Choose classic deployment model (They hid that well!)

In case you are unfamiliar with Azure, you need a Resource group, in which the place this storage group, if you don’t already have one you can simply click ‘Create new’. Give your storage account a name > set the other values as shown. (Note: Not all locations support classic storage accounts) > Review and Create > Create.

It may take a few minutes.

Convert VMware VM and Upload to Azure

Launch MCVM > Set Virtual Machine Conversion > Next > Migrate to Microsoft Azure > Next.

Enter the Subscription ID and Thumbprint you made a note of earlier > Next.

Select your Storage Account > Next.

Note: If there is no option to select, you either didn’t create ‘classic’ storage, or you didn’t apply the ‘cup of coffee rule’. Go have a brew then try again.

Provide your vCenter Details > Next.

Select your VM to convert/upload > Next.

My VM is not a domain member so I’m supplying the local administrator credentials > I want to power the source VM off when conversion is done, the converted VM will simply be a new virtual disk in Azure so that will be off also > Next.

Warning: At this point the VM being converted needs to have its windows firewall off, and be able to be resolved in DNS (or when you click next it will error!)

Supply a folder with sufficient capacity, (twice the site of the source VM) in which to perform the migration > Next.

Check the details > Finish.

Note: If it fails with a descriptor error see the following article;

Conversion Error ‘Unsupported Disk Database Entry’

The conversion and upload should progress like so;

Back in Azure > All Resources > Select your storage account > Storage Explorer > Blob Containers > Theres our virtual disk.

All Services > Disks (classic) > Select your disk > Create VM.

Name the VM > Select the Resource group you used above > Next.

Choose a VM size > Select.

Give the VM a domain name, (you will use this to access the VM via RDP) > Next.

Review the details > OK.

All Services > Virtual Machines > Select your VM > Connect > This should download a rdp file which you can use to connect to the converted VM.

Related Articles, References, Credits, or External Links

NA

Conversion Error ‘Unsupported Disk Database Entry’

KB ID 0001508

Problem

Seen when attempting to convert a VMware disk (.vmdk) file to a Microsoft disk (.vhd or .vhdx) with Microsoft Virtual Machine Converter.

Microsoft Virtual Machine Converter encountered an error while attempting to convert the virtual machine.
Details: The entry “{value}’ is not a supported disk database entry for the descriptor.

If you click on the ‘Log‘ link you will see something line this;

The entry 1 is not a supported disk database entry for the descriptor.

You will see a similar error ,if you use the ConvertT0-MvmcVirtualHardDisk PowerShell command;

[box]

ConvertTo-MvmcVirtualHardDisk : The entry 1 is not a supported disk database entry for the descriptor.
At line:1 char:1
+ ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath $Winfolder\$VMDK -Vh …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Accel…nversionService:DriveConversionService) [ConvertTo-MvmcVirtualHardDisk], VmdkDescriptorParseException
+ FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC
ommand

ConvertTo-MvmcVirtualHardDisk : One or more errors occurred. At line:1 char:1
+ ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath $Winfolder\$VMDK -Vh …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Accel…nversionService:DriveConversionService) [ConvertTo-MvmcVi rtualHardDisk], AggregateException
+ FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC
ommand

 

[/box]

Solution

I did some searching and found this was a common error, and that most people were fixing it with a tool called dsfok and using that to extract the descriptor file, and then edit it. Which is great, but all the examples had paths to the vmdk on Windows machines? 

My VMDK was on an ESXi Datastore, (where you would expect it to be). I wasn’t about to start copying vmdk files off to Windows and back again. So I needed a solution that would work in LINUX and was quicker and easier, (I am lazy after all).

There’s two ways I found to fix this, if you are happy using a vi editor in Linux then use option 1, if you are a Windows type and prefer doing things with a GUI then use option 2.

Background: In an ESX environment VM-Name.vmdk is not actually the hard disk, that’s usually called VM-Name-flat.vmdk, the descriptor in your error message, you can find in the VM-Name.vmdk file. (which you can edit in a text editor).

Option 1 – Linux and Vi

SSH into your ESXi host, then change directory to the datastore that has the VM in it;

[box]cd /vmfs/volumes/{Datastore-Name}[/box]

Enable SSH Access to VMware vSphere ESX

Change directory to the folder with your VM in it, and here you can see the VM-Name.vmdk and the VM-Name-flat.vmdk file I was taking about. Edit the file using vi (vi vm-name.vmdk).

OK, remember my initial error? It was talking about a value of “1” I’ve only got one entry with that value ‘ddb.toolsInstallType = “1”‘, simply comment that line out by prefixing it with a hash, (or pound sign if you’re American). Save and exit the file, then retry the conversion. 

Note: If it wont let you edit the file, you may need to shut down the guest VM.

Using the VI Editor (For Windows Types)

Option 2 – Windows and WinSCP

Download WinSCP and use it to connect to your ESXi host (SSH needs to be enabled). Navigate to vmfs > volumes > {Datastore-name} > {vm-name} locate the VM-Name.vmdk file and download it to your Windows machine.

You can now edit the file, as above locate the offending line, prefix it with a hash (pound) symbol so that it is ignored, then simply save and upload the file back again, (choosing ‘yes‘ when prompted to overwrite the file). Then retry the conversion.

Related Articles, References, Credits, or External Links

NA

Resizing Windows Volumes / Drives in VMware vSphere / ESX

KB ID 0000381 

Problem

This article is primarily geared towards making your guest virtual machines hard drives LARGER, If you want to SHRINK or make the drive smaller then see the following article.

Resizing Guest Hard Drives using the VMware Converter

Solution

Re sizing a Guests Hard Drive (Make it larger)

1. On the properties of the VM select the hard disk in question and locate its size.

2. Enter the new size and hit OK. Note: Making the drive size smaller, will have no affect, if you want to do that clone the drive. If the option is “Greyed out” then make sure you DO NOT have any snapshots for this machine.

Re-sizing the guests “Volume” Option 1 – Graphically

Note: To do this using diskpart skip forward to number 10.

3. On the guest > Right click “My Computer” > Manage > Locate “Disk Management”. You will see there’s some free space that’s appeared on the end of the drive, (Click action > Re-scan if you can’t see it).

4. Simply right click the existing volume and select “Extend Volume”.

5. Next.

6. Copy in the extra space you want to assign (all of it probably) > Next.

7. Finish.

8. All the physical drive should now be committed.

9. And just to be sure, look in “My Computer” the drive is now 300 GB.

Re-sizing the guests “Volume” Option 2 – From Command Line with diskpart

10. Start > run > cmd{enter}

[box]diskpart list volume&lt select volume x –Where x is the volume number of the volume to be re sized[/box]

11. The final command is simply extend (This uses ALL the available free space.) Note the volume size in the picture below has jumped up by 40 GB.

Resizing a System (boot) Partition.

Server 2008 R2 and Windows 7 can do this quite happily. Older versions of Windows do not like having their system drive re sized, you see the following error if you try,

Error: The volume you have selected may not be extended. Please select another volume and try again.

Option 1 (Connect this drive to another machine)

In a virtual environment this is much simpler, but even if its a real physical hard drive, you can put it into another server and re size it. In an ESX environment simply do the following,

1. Shut down the machine that needs its drive re sizing, then go to another virtual machine’s properties and select add.

2. Hard Disk > Next.

3. Select “Use existing virtual disk” > Next.

4. Browse to the the drive we want to re size > Next.

5. Next.

6. Finish.

7. Now on the VM (Action > Re-scan disks). You will see the drive, and it’s not listed as a system drive, so you can extend it using any of the methods listed above.

8. For example, heres the drive re sized using disport.

9. when you have re sized the drive go back to the properties of the machine you have connected it to, and remove it.

10. OK.

11. Now power on the original VM and drive will be re sized.

Option 2 (Re size the Windows volume with GParted)

Note: This will work for a physical server as well.

1. Here’s our system drive with some nice shiny free space.

 

2. Make sure the server in question can boot from CD, in VMware do the following to boot to the machines BIOS, for a real server watch the screen as the server boots for instructions (Usually F10, F1 or Esc but differs depending on vendor).

3. Locate the boot order and make sure CD/DVD is at the top of the list.

4. Download GParted burn the image to CD, if you are working on a real server (use ImgBurn if your stuck). Or simply point the VM to the iso image, and boot the machine in question from it. At the welcome screen press Enter.

5. Use your arrow and tab keys to select Don’t touch the keymap > OK.

6. Pick a language.

7. We want to launch the GUI (X Windows), so select 0 (Zero).

8. Select Re size/Move > Drag the arrow to include the free space > Re size/Move.

9. Apply

10. Apply.

11. Close.

12. Click GParted > Quit.

13. Exit > Reboot/Shutdown > OK.

14. Remove the CD/ISO and press Enter.

15. The guest will run chkdsk the firs time it boots. This is normal don’t panic.

16. Once booted the volume will be re sized.

Shrink a Windows Partition with diskpart

1. To actually make the volume smaller with diskpart, the initial commands are the same.

2. If you use “shrink” on its own is will shrink the drive as much as it can (I cannot think of any situation where you would do this!). So to shrink the volume by 10 GB simply issue a “shrink minimum 10240”. (The figure in in MB).

 

Related Articles, References, Credits, or External Links

Original Article Written 24/01/11

VMware ESXi – Converting ‘Thick’ Provisioned Drives to ‘Thin’, and ‘Thin’ to ‘Thick’

KB ID 0000579 

Problem

Thin provisioning of hard drives is pretty cool stuff, full support for thin provisioning was brought in with vSphere version 4. Put simply a thin proviosioned drive is as big as it needs to be, and a thick provisioned drive is set to its maximum size when it’s created. The virtual machines that use these hard drives don’t know, and assume that their hard drive is a set size (even if it is thin proviosioned).

Thick provisioned drives should be used for machines/applications that will have intensive input/output (RAW mappings are also better for this). But what happens if you want to convert them? From Thin to Thick is very simple (see below), But from Thick to thin is a little more convoluted.

Note: You can change drive provisioning by running the Converter on the virtual machine, and change the disk provisioning as part of the conversion process (click here for details).

Solution

ESXi Converting Thick to Thin Provisioned Drives

1. Here you can see I’ve got a VM (Server 2008 R2) with a 40GB vmdk file (Hard Drive). You can also see it’s in a datastore called ‘RAID5’. Before you start make sure the VM using this disk is shut down.

2. Log into your ESX box via SSH, I’m logged in as ‘root’ if you are not don’t forget to ‘su’. To find out what the symbolic link is for the RAID5 datastore issue the following comand;

[box] ls -l /vmfs/volumes/ [/box]

From the output below we can see RAID5 is called “4f214fe5-c5ce77b0-a889-00110a59a5d6”.

3. Using the Symlink and the path (from the datastore browser, see step one) you can construct the command, use the following syntax;

[box] vmkfstools -i /vmfs/volumes/{volume-symbolic-link}/{folder}/{original-drive-name}.vmdk /vmfs/volumes/{volume-symbolic-link}/{folder}/{new-drive-name}.vmdk -d ‘thin’ -a lsilogic [/box]

If you didn’t turn off the machine (I did tell you in step one!) you will see the following;

4. Now we have a “New” thin provisioned drive cloned form the old one, go to the properties of your VM (Edit Settings). And remove the old drive.

5. Then add in your new “Thin” Drive.

6. It should look a little like this.

7. Now power up your VM and, once you are happy, don’t forget to DELETE the old thick provisioned drive.

ESXi Converting Thin to Thick Provisioned Drives

1. This is much simpler to do; browse the datastore in question and locate the vmdk file you want to convert. Right click it and select “Inflate”.

8. The drive will be converted.

9. You can also see its progress in the VI client’s “Recent Taks”.

 

Related Articles, References, Credits, or External Links

Virtual Center (VIM) Resizing Guest Hard Drive Sizes With VMware Converter

Re sizing Windows Volumes / Drives in VMware vSphere / ESX