VMware 创建虚拟机的磁盘操作

VMware的磁盘可以挂在在两种总线下:IDE,SCSI。
IDE总线的速度比较慢,但是价格低廉。一般的pc机都会采用IDE总线。(感觉目前的pc都采用sata总线。和IDE的并行相比,串行通信的sata速度更快,占用更少的线路)更重要的是正版的xp,2003都只支持IDE,因为那时候还没有SCSI。
SCSI的速度比较快,常用于服务器,价格比较贵。
VMware的虚拟机对于两种总线还是有很多限制的。

IDE介绍
对于IDE来说,VM最多有两条IDE总线。每条IDE总线可以挂载两个设备(主设备和从设备),所以一个虚拟机最多可以挂载四个IDE设备。
在创建中需要注意一点:VMware自己预留了一个IDE端口。VMware将201:0(201是IDE总线编号。IDE有两个总线编号:200和201。每个总线下的两个设备编号分别为0和1。201:0就是编号为201的IDE总线的主设备)留给了光驱cdrom。所以在配置的时候一定要注意不要占用此端口。
创建虚拟机需要通过VirtualDeviceConfigSpec对象来配置参数。其中的VirtualDevice描述了磁盘在此虚拟机的表示。具体参数意义参考sdk:
backing* VirtualDeviceBackingInfo Information about the backing of this virtual device presented in the context of the virtual machine's environment. Not all devices are required to have backing information.
See VirtualMachineConfigOption
connectable* VirtualDeviceConnectInfo Provides information about restrictions on removing this device while a virtual machine is running. If the device is not removable, then this property is null.
controllerKey* xsd:int Object key for the controller object for this device. This property contains the key property value of the controller device object.
deviceInfo* Description Provides a label and summary information for the device.
key xsd:int A unique key that distinguishes this device from other devices in the same virtual machine. Keys are immutable but may be recycled; that is, a key does not change as long as the device is associated with a particular virtual machine. However, once a device is removed, its key may be used when another device is added.

This property is not read-only, but the client cannot control its value. Persistent device keys are always assigned and managed by the server, which guarantees that all devices will have non-negative key values.

When adding new devices, it may be necessary for a client to assign keys temporarily in order to associate controllers with devices in configuring a virtual machine. However, the server does not allow a client to reassign a device key, and the server may assign a different value from the one passed during configuration. Clients should ensure that existing device keys are not reused as temporary key values for the new device to be added (for example, by using unique negative integers as temporary keys).

When editing or deleting a device, clients must use the server-provided key to refer to an existing device.

unitNumber* xsd:int The unit number of this device on its controller. This property is null if the controller property is null (for example, when the device is not attached to a specific controller object).

Normally, two devices on the same controller may not be assigned the same unit number.

controllerkey就是IDE总线的编号(200或者201)。unitNumber就是主从设备号(0或者1)。

SCSI介绍

这里再次提示需要注意的一点:xp,2003以及更早的操作系统是不支持SCSI总线的。(虽然可以安装操作系统之后补充安装scsi的总线驱动,但是如果安装的虚拟机全部为scsi磁盘,那么提示找不到磁盘)
VMware的虚拟机支持一条SCSI总线。其上可以挂在16个设备(编号为0-15)。
然后就没啥了,呵呵。
原文地址:https://www.cnblogs.com/xinyuyuanm/p/3013938.html