Storage VMotion for several data stores

I'm looking for some advice and assistance with the help of the vSphere PowerCLI to SVMotions.

I found that I can use virtual vmname Get-machine | Move-VM - datastore (Get-Datastore datastorename) that has worked very well and I was ready to roll. However, it occurred to me that I can only refer to a data store in the cmdlet and some of our virtual machines have their drives located on different data warehouses.

So I set up a test VM with two disks of different data warehouses and began a SVMotion. The result was that it has migrated all disks in their separate data warehouses in a single folder on the target.

What I need to be able to do is to migrate a disk and leave the other in its original location, or migrate two disks of different locations in two different places again. As you can do if you switch the machine virtual and migrate through the graphical interface, moving storage with advanced options (and probably what you can do via the graphical interface with the virtual machine in vSphere).

I've got ESX 3.5 Update 5 with vCenter 2.5 update 6 If no GUI in VirtualCenter and the free snap option not taken in charge is not an option.

Is there a way to do it with the PowerCLI or am I limited to migration the data store's unique virtual machine?

Thank you very much.

This can be achieved using the. RelocateVM_Task() method of the VirtualMachine SDK object

See the code below:

$configDatastoreName = "DataStore_01"
$HardDisk1DatastoreName = "DataStore_02"
$HardDisk2DatastoreName = "Datastore_03"

$vm = Get-VM VM001

$spec = New-Object VMware.Vim.VirtualMachineRelocateSpec
#Get MoRef for Destination datastore for Config files
$spec.Datastore = (Get-Datastore $configDatastoreName | Get-View).MoRef

#for each disk specify where the vmdk files should be placed.
#If a vmdk should NOT be moved, enter its CURRENT datastore
#If you forget to specify a disks location, it will be moved to the datastore
#specified in $spec.Datastore

#HardDisk 1
$objDisk = New-Object VMware.Vim.VirtualMachineRelocateSpecDiskLocator
$objDisk.DiskID = $vm.HardDisks[0].Id.Split('/')[1]
$objDisk.DataStore = (Get-Datastore $HardDisk1DatastoreName | Get-View).MoRef
$spec.Disk += $objDisk

#HardDisk 2
$objDisk = New-Object VMware.Vim.VirtualMachineRelocateSpecDiskLocator
$objDisk.DiskID = $vm.HardDisks[1].Id.Split('/')[1]
$objDisk.DataStore = (Get-Datastore $HardDisk2DatastoreName | Get-View).MoRef
$spec.Disk += $objDisk

#When all harddisks are specified call the RelocateVM_task()
$vm.ExtensionData.RelocateVM_Task($spec, "defaultPriority")

-

Tags: VMware

Similar Questions

  • VM have been storage vMotioned to another data store, and now I have 3 VM with white "!" inside a red square and I want to understand the cause of this.

    VM have been storage vMotioned to another data store, and now I have 3 VM with white "!" inside a red square and I want to understand the cause of this.

    Can you try to make a vmotion host and see if it gets resolved? If not, can you close the virtual machine and start again? I have seen this problem before and a stop and start resolved.

  • Storage vmotion to another data store on a different san

    Hello

    We have a 3.5 ESX cluster running 4 host ESX and Virtual Center. The licensing is ESX Server standard edition. We are migrating to ESXi 4.1 vSphere and a new SAN. One of the issues that we are going through is because we are only in standard edition, we have no storage vmotion to migrate the virtual machines of data stores in the old SAN for data warehouses in the new San. Other than purchasing the add-on storage vmotion, what other options can I. I thought to add a new ESX 3.5 server to the cluster and make storage vmotion from this server while it is running trial license. I would probably need only a few days to storage vmotion on about 45 VMs. Please let me know if one were to do this or any other alternatives available.

    Hello

    There is an unofficial plugin that does not require an authorization.

    More about http://www.virtualizationadmin.com/articles-tutorials/vmware-esx-and-vsphere-articles/vmotion-drs-high-availability/storage-vmotion-svmotion-vi-plugin.html

    plugin http://sourceforge.net/projects/vip-svmotion/

  • Several data stores?

    Hello.

    I create a configuration on my VM project and future document.

    I run x 4 company vSphere5 hosts running on a Dell R710 all connected to a Dell EqualLogic PS6100XS for their shared iSCSI storage.

    Looking at best practices and not knowing the correct limits of data warehouses... What is the best Setup here. It is better to create a large (7 by TB) Volume and transfer this to vSphere as storage... Or...

    Create several data warehouses (each 1 TB in size) for use with Storage vMotion?

    Thank you

    J.

    Theres more to it than just the workload, IMO.

    You must consider that usually get you slightly better performance (5-10%) with several data warehouses/LUN, simply because there is more available queues.

    Also, several data stores means that you have more options to make backups, prioritization, etc.  Finally, you also have more possibilities for reproduction in the future.

    I would * not * create a unique 7TB data store.  I'd be more likely to create a smaller data warehouses from 7-10 and broadcast my virtual machines around on them.

  • Separate the VMkernel for pulse data store traffic?

    Hello.

    I was just reading Tech EqualLogic report 'Configuring iSCSI connectivity with VMware vSphere 5 and Dell EqualLogic PS Series storage' and saw something again on pages 3-4.

    Dell recommends to create a vmkernel port highly available on the subnet iSCSI serving as vmkernel default port for pulse data store traffic, so that the pulsation of data store traffic will then sit outside the iSCSI Software initiator and consumes any connection of additional iSCSI storage. He goes on to say that the traffic of pulsation of the data store will always use the lowest numbered VMkernel ports on the vSwitch.

    It makes sense, but this is the first I've heard of this. Everybody does that, with EQ or other iSCSI solutions?

    Thank you

    Brian


    Not sure that what talking about Dell, but the heartbeat "traffic" data store using the links normal iSCSI. Each host will have a file on one of the heartbeat data stores and open it which means there a lock on the file. The overhead is minimal and there is no need to worry at all.

  • get support scsi LUNS for the data store?

    I've been delving into the different classes available to HostSystem.queryHostConnectionInfo () and none of the properties appear to contain the id of naa I see when I look at LUNS on an HBA.  How do you get to LUN support for a data store?

    Figured it out.  For anyone else who wants to know:

    I created two actions, one to return a hash of the id of naa-online data store object and another action to return a hash of the naa-online drive scsi id

    // actions
    //getDatastoresKeyedByLUN
    var o_diskHash = new Properties();
    
    for each (var scsiDisk in u_host.config.storageDevice.scsiLun)
    {
      //System.log("-> LUN: " + scsiDisk.canonicalName);
      for each (var dataStore in u_host.datastore)
      {
      if (dataStore.info.hasOwnProperty("extent"))
      {
      for each (var scsiDiskPartition in dataStore.info.vmfs.extent)
      {
      if (scsiDiskPartition.diskName == scsiDisk.canonicalName)
      {
      o_diskHash.put(scsiDisk.canonicalName, dataStore);
      }
      }
      }
      }
    }
    
    return o_diskHash;
    
    // getScsiDisksKeyedByLUN
    var o_diskHash = new Properties();
    
    for each (var scsiDisk in u_host.config.storageDevice.scsiLun)
    {
      o_diskHash.put(scsiDisk.canonicalName, scsiDisk);
    }
    
    return o_diskHash;
    
    // in workflow
    for each (var can in dstoreMap.keys)
    {
      System.log(dstoreMap.get(can).name + "(" + lunMap.get(can).canonicalName + ")");
    
    }
    
  • POS supports several data stores?


    I noticed that a limit of 2 TB data store VPD and 8 to VIENNA. Can I create several data stores if I the size of the data more than that?

    Thanks in advance.

    Hello

    I Don t think it is possible to go to more than 8 GB in the Advanced edition. I Don t find anything in the documentation to go further than 8 GB.

    But if you need multiple data stores, you can go up to 10 devices POS by vCenter.

    VMware KB: vSphere Data Protection (WTP) FAQ

    Frank

  • Get the scsi for a data store information if the data store is known

    Hello

    I'm looking for a way to get the information of scsci for a data store if the name of the data store is known. In perl/powershell, this is not a big problem, but how to do this using the Orchestrator. It seems that some information is not available/accessible in vCO, as information volume.extent (object VcHostFileSystemVolume).

    For an example on how to do who, in powershell, see

    http://vwiki.co.UK/Datastore_to_LUN_Mapping_%28PowerCLI%29

    No idea on how to do the same with the Orchestrator.

    Concerning

    Thomas

    Hello

    Onyx would not help in this case. After thinking a bit, I found the solution. I looks like:

    for each {(var Mon in wfHostObject.configManager.storageSystem.storageDeviceInfo.multipathInfo.lun)

    System.Debug ("number of paths:" + lun.path.length);

    for each {(var path in lun.path)

    If (path.state == 'active') {}

    //

    Download the mountinfo

    //

    System.Debug ("mountinfo length:" + wfHostObject.configManager.storageSystem.fileSystemVolumeInfo.mountInfo.length);

    for each {(Mount var in wfHostObject.configManager.storageSystem.fileSystemVolumeInfo.mountInfo)

    If (mount.volume.hasOwnProperty ("extent")) {}

    for each {(measure of var in mount.volume.extent)

    var tmp = extent.diskName.split(/\./);

    var regExp = new RegExp(tmp[1],'gi');

    If (lun.id.match (regExp)) {}

    System.Debug ("mount.type:" + mount.volume.type);

    System.Debug ("mount.name:" + mount.volume.name);

    System.Debug ("extent.diskName:" + extent.diskName);

    }

    }

    }

    }

    }

    }

    }

  • Stats for each data store

    I am writing a script to determine the way to read and write rates, the average number of read and write average requests read and write latency for each data store.

    I tried to do two different ways, with my numbers to end 0.

    $startdate = (get-Date-time Minute 7 - 0 - 0 second). AddDays(-1)

    $enddate = (get-Date)

    $datastores = get-datastore

    {foreach ($DS in $datastores)

    #1

    = [string] $dswriterate ([Math]: Round ((($DS.datastore.write.average |))) Measure - Object - average value). Average), 2))

    #2

    = [string] $dswriterate ([Math]: Round ((($DS.write.average |))) Measure - Object - average value). Average), 2))

    }

    I understand that Get-Stat does not work with a store of data entity.  It would be great if I could get help with that!

    That is right.

    You can use my Get-Stat2 function to retrieve available data store counters.

    See monitor the size of your vDisks

    With the QueryMetrics switch you can see which parameters are available.

    See the usage statistics for the data store

  • View the number of paths and the political path for each data store

    Hi all

    Seem to be stuck on this one. and all that seems to be able to find through topis and scripts for the air path setting. All I have to do is list each data store to its policy of access road and the number of path for the data store on the host computer.

    I'm gussiing it uses the get-vmhoststorage cmdlet?

    Any help much appriciated.

    Phil

    Try something like this

    Get-VMHost | %{
         $esxImpl = $_
         $_ | Get-ScsiLun | where {$_.LunType -eq "Disk"} | %{
              $_ | Select @{N="HostName";E={$esxImpl.Name}},
              @{N="Path";E={$_.CanonicalName}},
              @{N="Policy";E={$_.MultiPathPolicy}},
              @{N="Number";E={($_ | Get-ScsiLunPath).Count}}
         }
    }
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Migration of storage when the virtual machine has several data stores

    How can I (or can I) use Storage vMotion on ESX4.0 U1 to migrate part of a virtual computer to a new data store?  I have a virtual machine with 5 data stores attached and move 1 data warehouses to a LUN of larger size.  What is the best method?

    On the "Select the data store" window, click on the button "Advanced". You can specify the location of each VMDK and configuration files.

  • Nobody knows the largest available space supported for vmfs data store when creating a new form of vmfs data store a 3T lun mapped from FC storage.

    I traced a form of lun 3 t FC storage.

    And the project to create a vmfs on this lun, creating, data store, space available by default is 1024 G, no 3 t, so I guess that maybe some limitations.

    Anyone know? Thank you very much.

    Hello

    The limit is 2 TB - 512Bytes

    That 512 bytes is VERY important to remember.

    You will see that 1 TB as it roles once you exceed 2 tablespoons.

    As Anton suggested you can use two 1.5 TB LUN safely. However, you can in fact more than 500 GB LUNS or such. Will the LARGEST you can is not always the most efficient allocation of resources.

    Best regards

    Edward L. Haletky VMware communities user moderator, VMware vExpert 2009, url = http://www.virtualizationpractice.comvirtualization practical analyst [url]
    "Now available: url = http://www.astroarch.com/wiki/index.php/VMware_Virtual_Infrastructure_Security' VMware vSphere (TM) and Virtual Infrastructure Security: securing the virtual environment ' [url]
    Also available url = http://www.astroarch.com/wiki/index.php/VMWare_ESX_Server_in_the_Enterprise"VMWare ESX Server in the enterprise" [url]
    [url =http://www.astroarch.com/wiki/index.php/Blog_Roll] SearchVMware Pro [url] | URL = http://www.astroarch.com/blog Blue Gears [url] | URL = http://www.astroarch.com/wiki/index.php/Top_Virtualization_Security_Links Top security virtualization [url] links | URL = http://www.astroarch.com/wiki/index.php/Virtualization_Security_Round_Table_Podcast Virtualization Security Table round Podcast [url]

  • Displacement of the VM attached to several data stores

    ESX 5.1.  I'm moving from one SAN to another.  I have a Windows VM file server that is attached to the "OS" data store which is 100 GB (for the OS, program installation, etc.) and the data store 'Data' that is 500 GB (where the file real stock data is stored).  On the new San, I created new warehouses of data, "New_OS" and "See you."

    What is the best way to move my data to the new data warehouses?  I know that I can use storage VMotion to move the virtual computer, but who will attempt to move the 'BONES' and 'Data' to 'New_OS' correct?  (Which of course will not work, since there is not enough space.)  I think that I have to remove 'Data' of the existing virtual computer, move it to 'See you' via a browser data store, move the computer virtual using VMotion, then add "you see?"  This sounds more complicated than it should be.  Am I missing something here?

    Thank you.

    Am I missing something here?

    Yes, it lacks the 'Advanced' option in Storage vMotion which will allow that move you each hard to a data store different... to do this, just follow the screens of Storage vMotion and select the data store, click on advanced and for each virtual hard disk and virtual machine configuration file, select the data store you want.

    Take a look at the documentation: http://pubs.vmware.com/vsphere-51/index.jsp#com.vmware.vsphere.vcenterhost.doc/GUID-A15EE2F6-AAF5-40DC-98B7-0DF72E166888.html

    Store the configuration of virtual machines and disks files in different places.

    one

    Click Advanced.

    b

    For the virtual machine for each virtual disk configuration file, select Browse and select a data store or cluster storage DRS.

    c

    (Optional) If you selected a cluster DRS for storage and do not use Storage DRS to this virtual machine, select Disable DRS storage for this virtual machine and select a store of data within the storage DRS cluster.

    d

    Click Next.

  • Storage vMotion for a virtual machine on vCD

    Hello

    I saw this cluster data store is not yet supported, but is it possible to make a storage vmotion, a computer virtual managed by vCloud Director, on the same vDC data store?

    Imagine that I present you 2 store data for the provider vDC, I can move the virtual machine between two data store?

    Thanks for your reply.

    Cédric

    See this Q & A blog.

    http://www.virtual-blog.com/2010/10/VMware-vCloud-Director-QA-part-2/

  • Using several data stores, cannot migrate the vmx file in a data store

    I am host migration between 3.5 and 4.0, and part of the migration requires me to vmotion data to a single shared LUN data warehouses.  From there on, I import the virtual machine in 4.0 and using the script to migrate the two VM disks at different stores of data below.  The problem I have is that the configuration (vmx) file not migrated and is left on the shared storage LUNS.  Anyone knows how to go beyond this?

    The Script:

    $VMDisk = 'disk 1 '.

    $VMName = 'TestVM '.

    $TargetDS = get-Datastore - VMHost (Get-VMHost-$S.id Id) | Where-Object {$_.} Name - like "PMV"} | "" FreeSpaceMB tri-objet-descending | SELECT name - first of all 1

    $vm = get-View - ViewType VirtualMachine-filter @{"Name" = $VMName}

    foreach ($dev in $vm. Config.Hardware.Device) {if ($dev. DeviceInfo.Label - eq $vmDisk) {$diskId = $dev. Key}}

    $spec = new-Object VMware.Vim.VirtualMachineRelocateSpec

    $diskspec = new-Object VMware.Vim.VirtualMachineRelocateSpecDiskLocator

    $diskspec. Data store = (Get-Datastore-name $TargetDS.Name |) Get - View). MoRef

    $diskspec.diskId = $diskId

    $spec. Disk = @($diskspec)

    $task = get-View ($vm. RelocateVM_Task ($spec, "lowpriority"))

    OK, I think I understand your problem now.

    I fear that in the current construction of PowerCLI, the Move-VM cmdlet does not destinations of individual data for each virtual hard disk store.

    With the RelocateVM_Task method, it is possible.

    The following script moves a guest at 3 different data warehouses:

    -the. VMX file for DS2

    -hard disk 1 for DS3

    -hard drive 2 TB DS4

    $vmName = "MyGuest"
    $vmxDS = "DS2"
    $osDS = "DS3"
    $dataDS = "DS4"
    
    $vm = Get-VM -Name $vmName
    
    $vm.Extensiondata.Config.Hardware.Device | %{
         if ($_.DeviceInfo.Label -eq "Hard disk 1"){
              $osDiskId = $_.Key
         }
         elseif($_.DeviceInfo.Label -eq "Hard disk 2"){
              $dataDiskId = $_.Key
         }
    }
    
    $spec = New-Object VMware.Vim.VirtualMachineRelocateSpec
    
    $osRelocate = New-Object VMware.Vim.VirtualMachineRelocateSpecDiskLocator
    $osRelocate.Datastore = (Get-Datastore -Name $osDS).Extensiondata.MoRef
    $osRelocate.diskId = $osDiskId
    
    $dataRelocate = New-Object VMware.Vim.VirtualMachineRelocateSpecDiskLocator
    $dataRelocate.Datastore = (Get-Datastore -Name $dataDS).Extensiondata.MoRef
    $dataRelocate.diskId = $dataDiskId
    
    $spec.Disk = @($osRelocate,$dataRelocate)
    $spec.Datastore = (Get-Datastore -Name $vmxDS).Extensiondata.MoRef
    $spec.Host = $vm.Extensiondata.Summary.Runtime.Host
    
    $task = Get-View ($vm.Extensiondata.RelocateVM_Task($spec, "lowpriority"))
    while("running","queued" -contains $task.Info.State){
         $task.UpdateViewData("Info")
         sleep 5
    }
    

    BTW, you can use the cmdlet Set - hard disk to a virtual disk that is specific to a data store.

    But as I understood what is not possible in your environment.

    ____________

    Blog: LucD notes

    Twitter: lucd22

Maybe you are looking for

  • What happened to my stationery and my sizer of photo on my front page of e-mail?

    original title: WHAT HAPPENED to MY STATIONERY & MY PHOTO SIZER ON MY E-MAIL FRONT PAGE? My computer has a virus.  After repair my Microsoft Internet has been upgraded to a new version with Hotmail.  I don't see the drop-down list called stationery a

  • An error has occurred. not all features have been changed successfully - installation of games

    When you try to install the package of games in the Turn Windows features On or Off, I get the error "an error has occurred. not all features have been changed successfully"and then asks me to restart. Restarting does not solve the problem, nothing i

  • The LMS 3.2 directory

    Hello I have a problem with the directory of sahdow, it is empty. I checked the box, as you can see in the image: I read something on the dcmaservice.log, but I do not know how to interpret it. I have attached the log file. Someone who can help me? T

  • BlackBerry Z10 application best GPS/map

    I know it would be very subjective taking into account preferences and individual needs, how ever I bought a Z10 and I think that memory is at a premium and probably, I should not charge the device with the applications that do essentially the same f

  • Internal Fax problems

    I have an internal fax modem... It was working fine until yesterday. Now, I can only send faxes, cannot receive. Also the attachments I have send with faxes are being shortened in half vertically. Any help?