Manipulate the vmdk is attached to a virtual machine

I'm looking for an API or SDK or method or library or hack that will allow me to move the virtual disks between the virtual machines. I'm looking for a way to "detach" a VMDK to a VM (power off) and then "link" it to another virtual machine, which would then be able to read and write to and from the (virtual) disk, like his own boot disk? Something along the lines of: (Java psuedocode)

The API method you use is the ReconfigVM_Task - http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.VirtualMachine.html#reconfigure and who is a generic method on the reconfiguration of your virtual machine under the name of the States method. What you need to do as part of the reconfiguration, is to create a specification of deviceChange that performs a specific operation for the VMDK in question. You will perform a 'delete' operation that allows you to detach and you can then create a new file deviceChange for the virtual machine specifications in question perform an operation 'Add '.

Here's vSphere SDK for Perl script that implements the basic functionality that you can use as a reference

http://communities.VMware.com/docs/doc-11213

Tags: VMware

Similar Questions

  • Try copying the VMDK operating system of a virtual machine

    I m trying to copy the OS vmdk to a VM with 2 also with the cmd - left hard drive copy.

    When Itry to the following syntax:

    copy-hard drive - HDD "[RZ1_FG34_Infrastruktur_B] uxms0005/uxms0005.vmdk"-DestinationPath "Klon/uxms0005klon.vmdk [RZ1_FG34_Infrastruktur_B] '.

    I get an error:

    CategoryInfo: InvalidArgument: (:)) [copy-hard drive], ParameterBindingException)

    Thank you.

    Hi, Lutz, Yes, you must use the get-hard way it returns only one of the discs you want: Get - hard - drive vSphere PowerCLI cmdlets reference

    Like this for example:

    Get - VM uxms0005 |  Get-Harddisk? | { $_. Filename-match "uxms0005.vmdk"}

    It must return a drive and you can run in your hard drive copy.

    Tim

  • 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.

  • What is the best way to backup of virtual machines on a standalone ESX with the data store local

    Hello

    I want to save the virtual machines on a host ESX autonomous. and all of these virtual machines is the local data store.  What is the best way to save these virtual machines in this situation?

    And probably we don't provision VTL on the local data center, so it is possible to use VCB to backup? And VCB is a good choice compared to the traditional method that installs the backup client in each virtual machine?   Because I think that in this situation with the data store local, it cannot not reduced the load on ESX hosts and network overhead can be avoided.

    Thank you!

    LAN

    > 1. VCB usable remote tape library? I mean it's not local library and uses the tape library to another network data center.

    VCB is completely unrelated to the tape library, it is a framework, not a backup solution. If your standard backup software can work with the remote tape library you can try it to ungrateful with VCB.

    > 2. what the difference bwteen hot - added NBD and modes if there is that an ESX host with store data local and want to use a virtual machine like VCB proxy? I think that they are the same: the VCB proxy read data through the I/O of the ESX host stack in this situation.

    NBD works on network and the backup traffic goes through the service console connection. Hot add uses special machine for assistance to connect vmdk to and uses of e/s disk stack instead of e/s network.

    > 3. Veeam Backup is free software?

    No, it isn't.

    ---

    MCSA, MCTS, VCP, VMware vExpert 2009

    http://blog.vadmin.ru

  • Find all the unique ID associated with a virtual machine

    is there some sort or any command that I could find all the unique ID associated with a virtual machine?

    I mean like ID: ID hardware, CPU ID, UUID, MAC address and etc...

    This should help you

    https://psvmware.WordPress.com/tag/VM-UUID/

  • Change the default options for a NEW virtual machine in ESXI 5.1

    Hello

    I am looking for a solution change the 'default' options for a new virtual machine created in ESXI 5.1

    I want to have parameters such as 'cpu/memory HOT-add' default to enabled instead of disabled.

    There may be more options to change to a new virtual machine.

    All those who have an option to change the 'default' options for new virtual machines?

    THX

    You can change the/etc/vmware/config of vSphere host file and add the lines mem.hotadd = 'TRUE' and vcpu.hotadd = 'TRUE '.
    The settings then apply to any VM on this host when virtual machines are turned on...

    I just tried this on a 5.1 ESXi host and it seems to work perfectly...

    / Rubeck

  • Why the GUI vmware.exe resizes when virtual machines?

    Why the GUI vmware.exe resizes when virtual machines?
    For me, it's very annoying - how can I disable this behavior?

    Hi Continuum,

    Have you checked the settings of automatic adjustment under "Preference-> Display? I guess that your "Autofit window" is checked.

  • What is the proper way to remove a virtual machine in VMware Player?

    I created a machine virtual in VMware Player but not yet installed the operating system. I would like to delete the virtual machine and start from the beginning of the process. What is the proper way to remove a virtual machine in VMware player?

    Just curious, have you even looked in the help file in VMware Player?  It tells you how to remove a Virtual Machine.

    With the Virtual Machine off, right-click in the Virtual Machine library and select: remove VM disk

  • How can I pay for the reservation of memory on all virtual machines to "0"?

    I am trying to write a script that will pay for the reservation of memory on all virtual machines that are invited in a cluster to '0 '.  We have book too much memory, and this setting should allow VMWare facilities manage reserves memory for me.  I have hundreds of virtual machines to update, so I can't do it by hand.  I hope that it is possible via the CLI.

    Can someone help me with this please?

    Matt example work certainly, and I'm sure that he was going to follow up with something similar to this after having confirmed if it worked or not because it is much more serious on the optimization of code for speed, but I'll (try to) save the effort. To test its extract on a cluster of 45 VMS, it took more than four minutes to complete.  The excerpt below took about 25 seconds.  The difference is of course to use the cmdlet "Get-View" and that it can run asynchronously so (it begins a vCenter task and immediately passes the following).  Of course, this will also put more of a strain to your vCenter server, so keep that in mind.

    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.memoryAllocation = New-Object VMware.Vim.ResourceAllocationInfo
    $spec.memoryAllocation.Reservation = 0
    Get-Cluster "YOUR_CLUSTER" | Get-VM | Get-View -Property Config.MemoryAllocation | %{$_.ReconfigVM_Task($spec)}
    
  • the request to turn off this virtual machine failed because the corresponding vmware tools script didn't run successfully

    using vmware fusion 2.0.5

    the request to turn off this virtual machine failed because the corresponding vmware tools script didn't run successfully

    now vmware cant off power

    is vmware tools script to run when windows is running

    If I power off (mac - force quit) now... what happens

    VMware Fusion 2.x...

    VMware Fusion (menu bar) > help > VMware Fusion help > running VMware Fusion and Virtual Machines > Shutting Down a virtual machine operating system

    VMware Fusion (menu bar) > help > VMware Fusion help > running VMware Fusion and Virtual Machines > Options for VMware Fusion food orders

    VMware Fusion (menu bar) > help > VMware Fusion help > running VMware Fusion and Virtual Machines > orders of switching power supply from the default Options

    ==========

    Note: It's like pulling the plug of the wall on a physical computer. Whatever this is not saved will be lost and there is always the possibility of corrupting the file system where preforming a hard stop! (Even if you have no choice but to do.)

    VMware Fusion menu bar > VM > press the option key and select Power Off

    By pressing the keys alt/option "Shutdown called" changes to "Power Off".

    Note: It also changes orders of "Suspend comments" and "Restart Guest' too.

    Or if this does not work then...

    On the library Virtual Machine ctrl - click on the target of the Virtual Machine and select Show in Finder and delete the .vmss file, the ctrl + click the target package of Virtual Machine, and then after the merger closed. Note: All that was not justified for the suspended state will be lost by deleting the .vmss file. Note: However: you have no other choice if the Virtual Machine does not suspend/resume/stop/start correctly.

  • Move a vmdk attached to a virtual machine

    We have two Equallogic 4000 s in a group and three ESXi servers attached to them by a network of dedicated storage.  ESXi servers have essentially more license with HA activated.  I have a virtual machine that is an Exchange 2007 server.  It has 5 VMDK attached to it.  I want to spend one of them in a different data store.  It is install the vmdk that hosts the Exchange 2007 application.  I want the rest of the VMDK to remain in data warehouses that they reside currently in.  How can I do this so that I do not destroy the installation of application Exchange 2007?

    Thank you

    Brian

    You must power off the virtual computer, then use migrate / change data store / advanced.

    Unfortunately the most essential edition doesn't have the SVMotion license, so you can not with the virtual machine.

    André

  • Command to list all the hard files that are attached to a virtual machine

    Hi people,

    I am documenting our infrastructure. I would like to a command that lists all the vmdk files and the virtual machine, they are attached. I'm sure that I've done it before, but I don't remember the command. Thank you

    in advance.

    Paul

    You could use Powershell and make a request to Virtual Center, if they are available:

    A basic example:

    SE connect-VIserver

    Get - vm | Select Name, @{Name = "VMDK disks"; {Expression = {$_ | get-harddisk | select filename}}

    / Rubeck

  • The list of all names of virtual machines that are attached to the computer with script group

    I need a script that would list all the virtual machines names that are attached to the Machine group as the bellows screenshot:

    vcm.jpg


    Ce can be in any language I just need to get this information.

    I tried to Watch in database and found vm names of in table [ecm_dat_machines] and Group of/ids in names of table [ecm_sysdat_machine_groups] but I don't find table that would be assign vm to the Group.

    I serait appreciate any help or clue as I already spent a lot of time on this task.

    Attached file of import/export includes a view created for the SQL below, as well as a SQL report that uses this perspective to the computers by group in the VCM UI.

    Note that the functions used in the join of the query criteria are there to ensure that only valid/active/license machines are displayed, these date data and time are adjusted to the time zone of the user, and that the users do not see that their role does not have access to groups of computers.

    SELECT

    m.machine_name,

    mg.machine_group_name,

    mg.machine_group_desc,

    DATEADD (mi, utc.utc_offset, m.date_last_contact) as date_last_contact

    OF dbo.ecm_dat_machine_group_machines_xref mgx

    JOIN dbo.ecm_dat_machines m

    ON mgx.machine_id = m.machine_id

    Join dbo.ecm_dat_machine_groups mg

    ON mgx.machine_group_id = mg.machine_group_id

    JOIN dbo.ecm_dat_roles_machine_group_xref rmx

    ON mgx.machine_group_id = rmx.machine_group_id

    AND rmx.role_id = dbo.role_current)

    JOIN dbo.ecm_fn_machines_valid_t (vm)

    ON mgx.machine_id = vm.machine_id

    JOIN dbo.ecm_user_utc_offset (utc)

    1 = 1

  • What is the best method to transfer a virtual machine from one PC to another?

    I am a novice in VMWare workstation. I created my first SharePoint 2010 development VM, and my boss wants me to give him a copy of my SP 2010 VM. He told me to just give him the. VMX file, but I believe that there must be a better method to transfer a virtual machine from one PC to another.

    Thanks in advance.

    Coltrane.

    Coltrane,

    to transfer a virtual machine from one PC to another, shut down the virtual computer and copy the complete folder with all the files (vmx, vmdk,...) on another PC.

    A thin to keep in mind (outside the Windows license) if the virtual machine is one attached to your network, you must change the copied disk - as you would with a cloned physical system - to have a unique host name, MAC address and IP address.

    André

  • Add physical disk to disk attached in ESXi virtual machine

    Hi friends,

    I would have attached physical disk to the virtual machine, I explain:

    I have a freenas VM create in ESXi 5.5 but I want to add a new hard drive, this hard drive is a physical, fixed equipment in my 5.5 ESXi, possible? If Yes, how?

    After I want to mount iSCSI in freenas and I'll make backups

    Thank you very much

    Rapici

    Hi brunofernandez1

    very thanks for the doc, I'll try Raw Device Mapping and explain

    Thank you very much

    Rapici

Maybe you are looking for