⬆️ ⬇️

VMware vSphere: Convert Virtual IDE Disk to SCSI

Recently, I was faced with a situation where a virtual disk in a vSphere virtual machine began to run out of space, and the typical operation to expand disk space was impossible. In my case it was connected with the interface of the disk connection - IDE.



Articles that can be found in this connection on the Internet, for example:

VMware Knowledge Base

Analogue, with pictures

unfortunately incomplete.



Following these articles leads to the inoperability of the virtual machine. After more detailed research, a working path was found that complements the above articles. In order for the article to provide a complete solution to the problem, a revised and updated conversion method will be presented here.



Retreats


1. In order not to clutter an article, I will omit the word “virtual” everywhere, which will be applied to the disk and to the machine.

2. I will use specific terminology / names typical of vSphere.

3. The impossibility of disk expansion can be caused by several reasons: the presence of snapshots of this disk (they may not be visible in the snapshot manager), the lack of space for expansion, the power supply of the machine, etc. It describes the situation when there are no snapshots, there is a place, the power is turned off, but the IDE drive.

4. There is a theoretical / (not tested) ability to convert a disk using VMware Converter. I did not use it for two reasons: it is rather “heavy” software and I have been mentioned that it’s impossible to boot the machine after conversion

5. Operations were performed on vSphere + ESXi v4.1U2. I do not guarantee the performance of the method on other versions (but in principle it should work, nothing super-specific).

6. Inside the machine is installed neonka WinXP 32bit, and some of the action is designed for this, if you have another OS, keep this in mind.

7. Thick disc format

8. You have a fresh backup of this machine (in the process of experiments, I recovered about 5 times).

')

Started


So, our machine is turned off, we have an open vSphere Client.

Go to the properties of the machine, and add the SCSI Device. As a tale device, I had a sidir, which is recommended to immediately change the Virtual Device Node from SCSI (0: 0) to SCSI (0: 1), since later on SCSI (0: 0) we will hang our converted disk.

Tell the device is added together with the controller (SCSI Controller), in which it is necessary to change the type from BusLogic Parallel to LSI Logic Parallel.







Save the settings and turn on the machine.

We put the driver for the controller, which can be found on the manufacturer's website: LSI Support .

We are looking for a driver for your OS, for LSI20320-R

After installing the driver, it would be good to check that the controller and skaz device appeared in the equipment of the machine and installed correctly.



Turn off the virtual machine.



In the above links, it is recommended to replace one line in the% vm-name% .vmdk file (ddb.adapterType) so that everything will work in the future. It did not work for me (the machine does not load at all - even the MBR is not visible).

After some research, a problem was found - different geometry of IDE and SCSI disks.

Thus, it is necessary to figure out the geometry of a SCSI disk with exactly the same size as our IDE disk.

This can be done in different ways, I personally used VMware vSphere PowerCLI (see the footer).

So, connect to the ESX (i) host and find out the size of the machine disk:



 PowerCLI> (Get-HardDisk -VM% vm-name%). CapacityKB
 10485760


So we got the size in kilobytes. Now let's find out the name of our machine controller's tale (this will be needed to create a tale disk):



 PowerCLI> (Get-ScsiController -VM% vm-name%). Name
 SCSI controller 0


Create a tale drive of the same size:



PowerCLI > New-HardDisk -Datastore datastoreXX -StorageFormat Thick -CapacityKB 10485760 -Controller "SCSI controller 0" %vm-name%



When creating, a label will be displayed in which, among other things, the path to the created disk, as well as its name, will be specified.



A bit of theory:

In VMware, a virtual disk in the simplest case consists of two files:

% vm-name% .vmdk - disk description file

% vm-name% -flat.vmdk - the actual disk itself (contents)

By the way, Datastore Browser presents them as a single file, but if this file is downloaded, for example, to a local machine, then we actually get two files, as it should be (in theory it could be more if split was used).



At the moment, we are interested in the description files of the old IDE disk and the newly created SCSI disk. I used SSH and WinSCP to extract them.

For my disk size see the following:



IDE

 #Extent description
 RW 20971520 VMFS "% vm-name% -flat.vmdk"

 # The Disk Data Base
 #DDB
 ddb.geometry.cylinders = "16383"
 ddb.geometry.heads = "16"
 ddb.geometry.sectors = "63"
 ddb.adapterType = "ide"


SCSI

 #Extent description
 RW 20971520 VMFS "% vm-name% _1-flat.vmdk"

 # The Disk Data Base
 #DDB
 ddb.geometry.cylinders = "1305"
 ddb.geometry.heads = "255"
 ddb.geometry.sectors = "63"
 ddb.adapterType = "lsilogic"


First, let's pay attention to the second line, to the numbers after RW , this is the size of the disks (in my case in 512b blocks). The numbers must match, if they do not match, it makes no sense to read further.



Further, the difference between the cylinders and heads is immediately apparent. Well, the type of adapter.

Now we edit the description file of the old IDE disk, change the number of cylinders, heads and adapter type accordingly. I do not recommend simply rewriting the description file, such as from a new disk tale, because The old IDE disk has more information in this file.



All that we needed from the test disk tale we received, so it can be removed (for example, using the Remove-HardDisk).



Now we go into the properties of the virtual machine and remove the IDE disk from the composition of the machine.

Be extremely careful, remove the disk only from the virtual machine (Remove from virtual machine), but do not delete files from the disk!







Save the changes, and again go to the properties of the virtual machine. Add a hard disk, select the item “Reuse existing virtual disk” and point to the file with our disk.







In the additional properties, we check that the disk is on SCSI (0: 0).







At the moment, you can delete the stories with a sidir if it is not needed, and check the IDE settings of the sidirom (if it exists). IDE Sidir must be installed on the IDE (0: 0) or IDE (1: 0) (master) channel, otherwise the machine will refuse to start.



In general, that's all. You can still go to the BIOS of the virtual machine, check the boot order.

You can start the virtual machine, the first time the driver is loaded, it will be installed on the disk.



By the way, now you can change the size of the disk.



Basement


VMware Knowledge Base: IDE to SCSI

LSI Support

VMware vSphere PowerCLI

Source: https://habr.com/ru/post/138005/



All Articles