Associating a VMDK disk to a virtual machine

Hello

I implement the restoration of a saved VM. I created the virtual machine with the virtual machine configuration information upwards. I have also created the disk in Esx Server using the CreateVirtualDisk_Task call with the thin option in the VirtualDisk_Spec (hope it creates a thin provisioned disk). Now how to associate the disk created with the VM newly created using the vstorage api. When backing up I've accessed your drive hard details with VM-> Config-> hardware-> virtualDevice. Fill this data structure with the details of the hard drive? What is the best way to add a hard disk created in a virtual machine?

Thank you

. / Siva.

Hello Shiva!

But anyway the Vmdk file created must be fixed with the VirtualMachine right?

Yes, you are right, but I would suggest taking a different route - it becomes a bit redundant but all I declare now is purely my understanding of documentation, etc., that is not yet done in the real world - you know I'm still working on the persistence of VMConfig if you are away in front of my friend:

I suggest not to use the CreateVirtualDisk_Task (...) at all. If I understand correctly, you condition is currently to fully restore the virtual machine. There you have the backup of disks and configuration of the VM and now to recreate the entire VM from scratch with raw empty disks that reload you the backup content.

From my point of view, all this, except the reloading can be done via the Folder.CreateVM_Task (...) and its VirtualMachineConfigSpecparameter. Through the ConfigSpec.deviceChange property, you can provide an array of data objects VirtualDeviceConfigSpec. Finally, you can specify a VirtualDeviceConfigSpec which creates a VirtualDisk. The following was borrowed here:

// Duplicate virtual machine configuration
VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec();
// Set the VM values
configSpec.setName("My New VM");
configSpec.setVersion("vmx-04");

 ... 
// Now add in the devices
VirtualDeviceConfigSpec[] deviceConfigSpec = new VirtualDeviceConfigSpec [5];
configSpec.setDeviceChange(deviceConfigSpec);

 ...

// Formulate the SCSI controller
deviceConfigSpec[1].setOperation(VirtualDeviceConfigSpecOperation.add);
VirtualLsiLogicController scsiCtrl = new VirtualLsiLogicController();
scsiCtrl.setBusNumber(0);
deviceConfigSpec[1].setDevice(scsiCtrl);
scsiCtrl.setKey(-44);
scsiCtrl.setSharedBus(VirtualSCSISharing.noSharing);
// Formulate SCSI disk one
deviceConfigSpec[2].setFileOperation(VirtualDeviceConfigSpecFileOperation.create); // create disk file
deviceConfigSpec[2].setOperation(VirtualDeviceConfigSpecOperation.add); // add disk to vm
VirtualDisk disk = new VirtualDisk();
VirtualDiskFlatVer2BackingInfo diskfileBacking = new VirtualDiskFlatVer2BackingInfo();
diskfileBacking.setDatastore(datastoreRef);
diskfileBacking.setFileName(volumeName);
diskfileBacking.setDiskMode("persistent");
diskfileBacking.setSplit(new Boolean(false));
diskfileBacking.setWriteThrough(new Boolean(false));
diskfileBacking.setThinProvisioned(true);
disk.setKey(-1000000);
disk.setControllerKey(new Integer(-44));
disk.setUnitNumber(new Integer(0));
disk.setBacking(diskfileBacking);
disk.setCapacityInKB(524288);
deviceConfigSpec[2].setDevice(disk);

Foregoing, we learn that the VirtualDeviceConfigSpec governs the creation and the addition of the disc, or more broadly, the VirtualDevice, to the virtual machine that will be created. In regards to records remember to recreate the news of support according to the configuration that you have saved for your backup. This should give the correct disk, type in your thin case put into service.

If I did not know any subject do not hesitate ask - this post is a little complicated to write ;-)

Anyway hope it do you get going again...

Tags: VMware

Similar Questions

  • Allocation of disk space to virtual machines

    I played around with assigning physical disk space to a virtual machine, in the "Add Hardware Wizard", I selected hard drive & gt; Create a new virtual disk & gt; He gave a size of 100 GB stored with the virtual machine and not independent.

    When I started the VM space, which is all that I wanted to check if I stop the virtual machine. Rather than remove the new hard drive 2 settings of the virtual machine, I have restored a previous snapshot without the new HD. Now when I check the free space on datastore1, it seems that the 100 GB does not have to be added to the free space.

    I did something wrong?

    UPDATE:

    I just tried the process again but this time assigned 8 GB.  Then I checked free space on datastore1, and now I have the 100 GB back, less the 8 GB I just posted.  Any ideas?

    If you take out it just of the virtual machine, it does not actually remove the virtual disk that you created. As you say, there are 2 options when you remove the drive, we need to remove the virtual machine, and we need to remove the disc. If you remove the disk from the virtual machine, it will always keep the file even if it is not associated with a virtual machine. There is no question to delete this file. Just make sure that you delete the correct VMDK. It's easy, if it's the only drive of 100 GB or 8 GB, you have created.

  • How can I get the number of disks for a virtual machine and PAHO are / s of a disc?

    Hi all

    I would like to know if there is a command that returns the number of disks having a virtual machine.

    and also if there is no command to obtain and change the number of the IOPS / disk s.

    Thanks in advance

    Carlos

    It will give you hard drives attached

    Get - VM | Hard drive


    It will give you count

    Get - vm | Select name, @{N = "TotalHDD"; E={($_ | (Get-harddisk).count}}


    It is possible to retrieve the number of the IOPS / disk s, but what do you mean by editing.

  • Move ROW with dynamic disk to another virtual machine

    Hello

    I'm in a situation where I have to leave my RDM Win2003 VM to win2008, but the complexity and multiple physical RDMs here make only dynamic partition (RDM1 1.5 TB, RDM2 1.5 TB, is drive G RDM3 1 TB 4 TB),

    Now my question is if I can move this partition of G (which includes 3 disks RDM) again an another VM (win2008)

    Thanks, SD

    Hello

    This does not resemble a specific question VMware.  On the contrary, seems like a question of Microsoft Windows.  Just make sure the hosts on which the virtual machine of 2008 runs can see the same ROW and follow this procedure to remove dynamic disks of the virtual machine of 2003 and add them to the virtual machine of 2008.

    Move disks to another computer

    All the best,

    Mike

    -----------------------------------------

    Remember to mark this reply 'proper' or 'useful', if you found it useful.

    Mike Brown

    NetApp, VMware and Cisco data center guy

    Consultant engineer

    [email protected]

    Twitter: @VirtuallyMikeB

    Blog: http://VirtuallyMikeBrown.com

    LinkedIn: http://LinkedIn.com/in/michaelbbrown

  • Copy of the data of the disk of the virtual machine on a Local disk is too slow

    We have recently implemented vMware view.   We vSphere 5.5 and 5.2 and made Desktop visualization server.

    We have SAN as HP 3Par and Esxi hosts are HP ProLiant DL380p Gen8

    Now all trying to copy the data from the disk of the virtual machine disk of the local computer are too slow. But if we are writing data from Local disk on the disk of the virtual machine is normal. And copying data between the two virtual machine disk is also fast.

    Thanks in advance for your help

    Dear all,

    Thanks for your help.

    We have analyzed the issue in 360 degrees, and we also examined your entries. Finally, we found the problem. It was that a defective fiber link has been creating the problem.

    We have recently implemented vMware and this flaw in fiber can also happened during this period. That's why we thought it may be because of vmware.

    Thanks again for your help

  • delete a virtual disk of the virtual machine of broken storage

    I have a virtual disk to a virtual machine on a broken iSCSI storage,

    now I can not remove the disc from the virtual machine.

    ESX 4.1 does not see the now broken iSCSI storage.

    See attach.

    Remove the virtual machine from the inventory and edit VMX manually deleting the reference to this disk. After that, add the machine virtual back again for the inventory.

  • Maximum number of virtual disk for a virtual machine in vSphere 4.1

    I read the maximum record rate and see that the maximum number of virtual disk is 16 for FT.

    I have the same document I seem not to be able to see the number max of virtual disk that can be taken in charge for a virtual machine.

    The number will be the same as the number of LUNS per host which is 256?  I know the max is for the host, but that be will come the number of Director to the total number of virtual disk that can be supported in the virtual machine?

    In fact, in a logic unit number, we can have more than one data store that can be mapped to a virtual disk.

    I'm confused.

    Thank you and have a nice week,

    Anthony.

    If I am not mistaken, you can attach up to 60 virtual disks to a virtual machine. 15 for each of the 4 virtual SCSI controllers.

    André

  • Connect physical hard disks to the virtual machine (and leave the data intact)

    Hello

    I'm looking to virtualize a SOHO headless server, that I use mainly for secure file storage.

    Currently, the system runs Linux installed on a small disc and has two drives 1.5 TB, used exclusively for data, in a cluster of ZFS mirroring. (I use the ZFS-fuse Linux-based application).

    I want virtualization for two reasons. One is to make administration easier and safer - avoid having to connect a keyboard and the physical monitor to the box from time to time. The other is that the machine is a bit more powerful to handle the load, and I'm hoping to make it work on other, more challenging tasks.

    Now, there is a catch. These discs are as highly important. I mean the data on them. What I need is to convert the current Linux system to a virtual machine, or re - install Linux on a virtual machine (don't like that), then connect the physical disks to the virtual machine as if they were actually connected.

    I certainly don't want to vmware touches those disks somehow.

    I've read the documentation, but I'm a noob when it comes to server virtualization and system engineering and don't quite understand if this is possible or not. These discs are not a SAN, they are physically connected to the server, I want to install vSphere on. (Of course, I'll log out when I run the setup of vSphere. But I need plug them again later, and they need to be sure that vmware will leave them alone and pass them to the virtual machine transparent.)

    Sigmoid wrote:

    Oh yes, the cluster mirrored ZFS. It is essentially a software RAID type thingie.

    http://en.Wikipedia.org/wiki/ZFS

    A material, or the point of view of virtualization, it appears two hard drives with a single huge partition on each that is not transparent to anyone, except the implementation of ZFS.

    OK, means that you can break the RAID, connect the drives to different host and configure RAID once again, right?

    Let's do it this way

    1. We will need a disc player more for VM, cause on flash, we install ESXi
    2. I will share ZFS :-), all you need to do with that before you install ESXi
    3. make the BACKUP!
    4. Disconnect the data host drives
    5. install ESXi 4.1 U1 free version on flash
    6. Download the site VMware vSphere client
    7. Connect the VM disk to ESXi
    8. customer help create the virtual machine and install the OS on it
    9. stop the virtual machine and esxi
    10. connect DATA drives to the ESXi host
    11. begin to ESXi
    12. See how to add RDM on youtube, after client use, change first hardware VM--> add a new hard disk--> choose Raw Device Mapping--> (physical or virtual) mode--> store it with folder VM - FACT
    13. Start the virtual machine, now your VM should see both drives, with good data course :-)

    I have just made this procedure (add ROW with data in Linux VM) on ubuntu VM, works well

  • How to make a visible USB hard disk for a virtual machine on ESXI 4.1?

    Hi all

    As I am new to the world of vmware ESXI, I always make mistakes or I don't undertand all therefore be complete :-).

    So I have a HP Proliant ML 350 G6 Server installed with ESXI 4.1 and I want to connect a USB hard disk to a virtual machine (SBS 2K 8). Currently, the virtual machine is not able to see the hard drive.

    I already add a USB controller to the virtual machine, but my USB HARD drive is still not visible to my virtual machine.

    Can you help on that?

    Thank you

    Michael

    Next, add a USB device to the virtual computer (in the change settings tab), there are different things, USB controller and USB devices. Sometimes, you may have to restart the virtual machine.

    Greetings

  • Can I convert a server disk to a virtual machine?

    I have a number of OS X 10.5 servers running on hardware that is incredibly underused.  Since the Fusion 3 supports running OS X Server virtualized, is it possible to convert a live server disk to a virtual machine to the BootCamp to VM? I could run all 5 of my server on a single Xserve systems. I dug around, but everything points to a new facility to achieve this.

    Thank you

    Tim

    Yes, it is possible to convert physical machines to Mac OS X Server VM. I've posted instructions on how to do this in the following thread: Re: Snow Leopard Server VM existing?

    In your case, the only thing that needs to change is the version of the OS - pick instead of 10.6 10.5. I tried this with one of my machines so far, I would be interested to comment on the question of whether instructions to work for you. I'll probably convert this post into a document at some point...

    I also thought the ability to hire only the OS X physical disk partitions without copying the data (like Fusion for Boot Camp). However, Fusion currently only supported the MBR partition tables to access raw partitions, and most Macs are partitioned GPT (or hybrid MBR + TPG). You can try to use Library/Application Support/VMware Fusion/vmware-rawdiskCreator to see if it recognizes the OS X partitions. If so, you should be able to create a virtual disk that references the partitions and boot from it as you would for a machine virtual Boot Camp.

    It is also possible to use a physical disk full (instead of individual partitions), but you would need to have partitions not mounted before using virtual machines that reference the physical disks. If you are interested in, there is a link in this thread as well.

  • is there an action to add a disk to a virtual machine by specifying a vmdk file?


    I'm trying to reproduce the functionality of the GUI to add a drive (not create new) existing in a virtual machine and specifying the hard file that will be used.  You would change from the GUI, then add and choose the hard drive.  Then choose Select the use an existing hard drive and dig into the specific to the hard file data store.

    After selecting the hard, then choose the SCSI device and channel and complete the wizrard.  After you add the disk, then go back and select the hard disk and choose manage paths to change the walkway on the MRU policy.

    Ideally, the user would be able to use something like VC:Datastore use a tree view to point to the vmdk when adding the drive, however I tried VC:Datstore and it only allows you to go as far as the data store but not more to specify the drive.

    Thank you

    Here is the script updated with the VCVirtualDiskRawDiskMappingVer1BackingInfo backup type.

    backup of var = new VcVirtualDiskRawDiskMappingVer1BackingInfo();
    backing.fileName = diskPath;
    backing.diskMode = "independent_persistent";

    backing.thinProvisioned = false;

    backing.eagerlyScrub = true;

    backing.writeThrough = false;

    backing. Split = false;

    connectable var = new VcVirtualDeviceConnectInfo();
    connectable.startConnected = true;
    connectable.allowGuestControl = false;
    connectable. Connected = true;

    Like var = [];

    do we need a Comptroller?
    If (scsiControllerKey< 0)="">
    controller of var = new VcVirtualLsiLogicSASController();
    controller.sharedBus = VcVirtualSCSISharing.fromString ("physicalSharing");
    controller.busNumber = scsiBusNumber;
    Controller.Key = - 100;
    scsiControllerKey = - 100;

    var deviceChange = new VcVirtualDeviceConfigSpec();
    deviceChange.operation = VcVirtualDeviceConfigSpecOperation.add;
    deviceChange.device = controller;

    dcArr.push (deviceChange);
    }

    device of var = new VcVirtualDisk();
    Device.Key = - 101;
    Device.backing = support;
    Connectables = device.connectable;
    device.controllerKey = scsiControllerKey;
    device.unitNumber = scsiChannelNumber;

    device.capacityInKB = size * 1024 * 1024;

    var deviceChange = new VcVirtualDeviceConfigSpec();
    deviceChange.operation = VcVirtualDeviceConfigSpecOperation.add;
    deviceChange.device = device;

    dcArr.push (deviceChange);

    spec var = new VcVirtualMachineConfigSpec();
    spec.deviceChange = like;

    This enables the multi-writer on disk

    option of var = new VcOptionValue();
    option. Key = 'scsi' + scsiBusNumber + ': ' + scsiChannelNumber + '.sharing;
    option. Value = "multi-writer";

    var extraConfig = [];
    extraConfig.push (option);
    spec.extraConfig = extraConfig;

    task = vm.reconfigVM_Task (spec);

  • Problem fixing existing vmdk to the new virtual machine

    Hello

    Just upgraded to Fusion 6 and things seem ok (except for the dreaded license bug, but it's ok now).

    I'm having a problem attaching a form of virtual disk existing a VM - operation - existing. Basically, all the vmdk files are grayed out and non-eligible, regardless of the option to share / copy / to support the disc.

    I checked that I have full R/W access to the fie (and it works fine if I fire up the other virtual machine).

    Any idea?

    Well I ended up adding another player new to the virtual machine, I wanted to and the drafting of the description of disk (Disk DescriptorFile #)

    in the manually - vmdk file works great...

  • Cannot open the hard file. One of the disks in this virtual machine is already in use by a virtual machine or a snapshot

    Hi all

    Tried my level best to solve, but still the same problem persists. . Lck tried but as soon close VMware workstation, it disappears. This problem starts when yesterday instead of powering down, suspended. The next resume when it gives captioned error. Tried creating new virtual machine using an existing vmdk file but my mainly all the data disappeared. Now I want to resume the suspended state. Kindly help on the same. Thank you

    OK, we will first focus on the first virtual disk (System) on the D: drive which has enogh of disk space to create a clone.

    The "Windows Server 2003 Enterprise Edition.vmdk" dated from 19/07/13 is probably exactly what we need, and if it has approximately the same size of file than current/changing, then you can replace the one changed with it. Once restored, proceed as follows (with VMware Workstation closed):

    from the command line run:

    cd /d "C:\Program Files (x86)\VMware\VMware Workstation"
    cd /d D:\win2k3
    md Clone
    C:vmware-vdiskmanager.exe -r "Windows Server 2003 Enterprise Edition-000002.vmdk" -t 0 "Clone\Windows Server 2003 Enterprise Edition.vmdk"
    

    Once the cloning done so, create a subfolder "Backup" and move all over existing files (as a backup). Copy the .vmx file and .vmxf the subdirectory "Backup" in the D:\win2k3 folder, then do the same with the file hard cloned since the 'Clone' subdirectory, so that you end up with the following files:

    Windows Server 2003 Enterprise Edition.vmx

    Windows Server 2003 Enterprise Edition.vmxf

    Windows Server 2003 Enterprise Edition.vmdk

    Before you can try to start the virtual machine, you must edit the .vmx file and replace

    scsi0:0. FileName = "Windows Server 2003 Enterprise Edition - 000002.vmdk"

    with

    scsi0:0. FileName = "Windows Server 2003 Enterprise Edition.vmdk"

    Please do the above and report. If you have any questions please ask.

    André

  • How to create disk shared across virtual machines on different hosts

    Hello

    We implement Oracle RAC on two virtual machines, one on each of the two armies for redundancy. For our installation:

    • The two ESXi hosts two SAN access a logical unit number.
    • Two virtual machines on the hosts must have access to a single virtual disk on this LUN (or unit number logic itself) at the same time.

    We tried the following:

    • Creation of a data store associated with the LUN, and then creating a new hard drive on each virtual machine using the same virtual disk on the data store. This operation failed because as soon as a virtual computer runs, the other virtual computer cannot run since the first has a lock on the file from the disk.
    • Creation of a new hard drive on the virtual machine through RDM. This operation failed because only the first virtual machine has this option of disc. Once the ROW has been assigned to the LUN, the other virtual computer cannot create its own RDM for the LUN.

    I'm learning just VMware so I can miss a fundamental method to accomplish this, or perhaps, it is not possible at all. You know a way to create the installer I described?

    Welcome to the community,

    I can not specifically help with the Oracle RAC, however, I would recommend that you take a look at MSCS documentation for how to configure shared disks. There is a difference in the way in which you have installed the VM, for example all VMs on an ESXi host or on different hosts. Please keep in mind that MSCS is a cluster without sharing, which means that only one node at a time has access to a shared virtual disc/RDM.

    André

    PS: I forgot to add the link: http://kb.vmware.com/kb/1004617

  • How can change the end of thick disk when a virtual machine has been placed on the disk?

    After you have moved the virtual computer to another stage, chose the thin disk bad. Now, the virtual machine cannot start. the error message says that it must be thick for clustering. So, I need to change it back if possible. Then I moved it back and thick chosed. But, after that, I got a same error. So, after you move, the atatuse disk was not be changed. Is it a way not both directions? How can change the staus thin to thick?

    Thank you!

    George

    Hello George,.

    You can also convert virtual disks in eagerzeroedthick from the command line.

    vmkfstools-j VMname.vmdk allows to convert a thin disk in eagerzeroedthick

    vmkfstools k VMname.vmdk that will do it on a thick disk

    It can also work for a thin disk, click with the right button on the vmdk in browser data store, and then click 'inflate '.

    André

Maybe you are looking for

  • Satellite click Mini L9W - B: loading new problem?

    Hi all I have some serious looking problems with my mini load click again (6 weeks) satellite.It seems to be a new addition to an already long list, but I had a glance at previous posts and has not found the same problem. The battery ran out a week a

  • Satellite A655-11 t - GbE card won't get a dynamic IP address

    I have improved my family Windows 7 SP1 on a Toshiba A655-11 t.Then, on each reboot the GbE onboard, if enabled, will not get a new IP from a DHCP server.Without doing anything with the adapter, renewing the IP wifi from the same DHCP server, causing

  • MicroBlaze soft core with Spartan-3F kit

    Hello guys,. Is it possible to implement a Microblaze soft core with kit-LABVIEW FPGA and Spartan-3E? Examples? In addition, examples of executing a Picoblaze soft-core on Spartan-3E and using LabVIEW FPGA CLIP node kit? Thanks in advance!

  • On-demand VPN with AnyConnect

    Hi all For a need for one of my clients, I am trying to configure VPN on demand with a Cisco ASA 5520 The goal is that AnyConnect will prompt you for a connection when users use a specific application (SAP portal) & only at this time They use for Win

  • Replacement of hard drive HP PAVILION MS214 necessary

    The hard drive failed and I need to replace.  Original drive is WD3200AAJS-65M0A0.  I can replace it with any hard drive 3 1/2 in.?  I ran diagnostics on it and the result has been OMITTED. Thanks for your help. Eileen