Posts tagged VMware

Unmounting/Deleting a datastore used for Host Cache on ESXi 5.5 fails

0

When you are trying to unmount/delete a datastore you can get on of the following error messages:

Cannot unmount volume <datastore> because file System is busy

or

Cannot delete volume <datastore> because file System is busy

 

To resolve this issue proceed as follows:

 

If you are not using VSAN:

1. Connect to your ESXi Host via SSH

This Service isn´t enabled by default. You can enable it

a. with the vSphere Client: in the Security Profile in the Configuration tab of your ESXi Host

b with the Web Client: in Manage -> Settings -> Security Profile of your ESXi Host

2. Stop the vsantraces by running the command:

#/etc/init.d/vsantraced stop

3. Perfom a Refresh for Storage

4. Unmount/Delete the datastore.

5. Start the Service by entering the following command:

#/etc/init.d/vsantraced start

 

To permanently turn off this Service run the following command:

chkconfig vsantraced off

 

If you are using VSAN:

1. Run this command to change the Location of the VSAN trace:

# esxcli vsan trace set -p <datastore>

2. Unmount/Delete the datastore

 

Source and further information: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2069171

 

Unmount CD-Drives using PowerCLI

0

In some cases it would be good to know that your VMs don´t have an ISO-File or Host device configured e.g. if you want to vMotion some VMs to another Host. Here´s how you could solve this problem:

 
[vSphere PowerCLI] C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Get-VM | Get-CDDrive | 
Set-CDDrive -NoMedia -Connected:$false -StartConnected:$false -Confirm:$false

PowerCLI 5.1 Poster

0

Some of you guys are knowing there are posters for reference for the VMware products.

I´ve attached a link to the updated PowerCLI 5.1 reference poster for you.

http://blogs.vmware.com/vipowershell/files/2012/09/PowerCLI_5_1_Poster.pdf

Reference Cards for vSphere 4.x und 5.x

0

Some time ago I´ve found some reference cards for vSphere 4.x and 5.x from Forbes Guthrie (vreference.com)

They are quite helpful and Forbes has released them under CC License.

Here are the links to the reference cards:

vSphere 4

vSphere 5

Connection & Ports in ESX/ESXi

Repeating ADAM VMwareVCMSDS Error Every Minute in Windows Active Directory Web Services Log

0

To fix this you have to go into the registry and look for in the key

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet?\Services\ADAM_VMwareVCMSDS\Parameters for Port SSL.

If Port SSL is already there as a string (REG_SZ), delete it and create a new REG_DWORD named Port SSL and set the value to 636 (Decimal). Then you need to restart the two services “Active Directory Web Services” and “VMwareVCMSDS”.

Increasing the size of a virtual disk

0

In ESX 4.1, you can extend and add virtual disks to a virtual machine when it is powered on (after installing VMware Tools).

1. Open VMware Infrastructure (VI) Client and connect to VirtualCenter or the ESX host.

2. Right-click the virtual machine.

3. Click Edit Settings.

4. Select the virtual disk you want to increase

5. Increase the size of the disk.

Note: If this option is greyed out then the disk may be running on snapshots or the disk may be at the maximum allowed size depending on the block size of the datastore

6. Follow the steps Increasing the size of a disk partition (1004071) so the guest operating system is aware of the change in disk size.

Note: If you´re using Windows Server 2008 R2 you only have to open Computer Management > Storage > Disk Management and eventually press F5 to refresh the view, right-click on your drive you want to increase, choose Extend Volume… and to follow the instructions given in the wizard.

Source:http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004047

How to enable Clipboard Copy and Paste in vSphere Client 4.1 and later

0

To be able to copy and paste between the guest operating system and the remote console, you must enable the Copy and Paste options using the vSphere Client.

To enable this option for a specific virtual machine:

1. Log into a vCenter Server system using the vSphere Client and power off the virtual machine.

2. Select the virtual machine and click the Summary tab.

3. Click Edit Settings.

4. Navigate to Options > Advanced > General and click Configuration Parameters.

5. Click Add Row.

6. Type these values in the Name and Value columns:

  • isolation.tools.copy.disable – false
  • isolation.tools.paste.disable – false

7. Click OK to close the Configuration Parameters dialog, and click OK again to close the Virtual Machine Properties dialog.

8. Power On the virtual machine.

Note: If you vMotion a virtual machine to a host where the isolation.tools.*=”FALSE” is already set, the copy and paste options are automatically activated for that virtual machine.

To enable this option for all the virtual machines in the ESX/ESXi host:

1. Log in to the ESX/ESXi host as a root user and open the /etc/vmware/config file using a text editor.

2. Add these entries to the file:

  • isolation.tools.copy.disable=’FALSE’
  • isolation.tools.paste.disable=’FALSE’

3. Save and close the file.

The Copy and Paste options are only enabled when the virtual machines restart or resume the next time.

Note: These options do not persist after an upgrade. If you upgrade to a newer version after enabling these options, the changes are lost and you may have to re-enable them.

For more information, see the Limiting Exposure of Sensitive Data Copied to the Clipboard section of the ESX Configuration Guide.

 

Source: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1026437

Shutdown and Recovery script in PowerShell

0

A few months ago I needed a script to shutdown my VMs and the underlying hosts in case of a power outage in one of our datacenters.

For this reason I´ve created some scripts that are shutting down our VMs or in case of recovery abort this process.

Because of security reasons I´ve also implemented the VICredentialStoreItem. So I didn´t had to put the username and password in clear-text into the scripts.

If you´re more interested in how to implement this Feature you can visit one of the following links:

http://www.vmware.com/support/developer/windowstoolkit/wintk40u1/html/New-VICredentialStoreItem.html

http://www.vmware.com/support/developer/windowstoolkit/wintk40u1/html/Get-VICredentialStoreItem.html

 

Shutdown script:

# Declaring the variables
$enddate = (Get-Date).tostring("yyyyMMdd")
$filename = 'C:\ShutDown' + $enddate + '.log'
$creds = Get-VICredentialStoreItem -file "C:\credentials.xml"
$scriptwaittime = 3600 #Seconds
$shutdownwaittime = 240 #Seconds
$Cluster = '"<Clustername>"'
$ESXSRV1 = Get-VMhost <ESXHost1>
$ESXSRV2 = Get-VMhost <ESXHost2>

# Main script
Start-Transcript $filename
Write-Host "Waiting for about $scriptwaittime seconds in case the power is back" -ForegroundColor Green Write-Host "and the VMs and ESX Host do not have to shut down" -ForegroundColor Green
Start-Sleep $scriptwaittime

# Importing the VMware PowerCLI Snapin into Powershell
if (((Get-PSSnapin -Name "VMware.VimAutomation.Core" -ErrorAction SilentlyContinue) -eq $null ) -and ((Get-PSSnapin –registered -Name "VMware.VimAutomation.Core") -ne $null)) {     Write-Host "Adding VMware vSphere PowerCLI" -ForegroundColor Green     Add-PSSnapin -name VMware.VimAutomation.Core     ."C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-VIToolkitEnvironment.ps1" }

# Connecting to vCenter Server
Connect-VIServer -Server $creds.Host -user $creds.User -password $creds.Password

# Set DRS to manual
Set-Cluster -Cluster $Cluster -DrsMode manual -Confirm:$false

# For each of the VMs on esxsrv1
# - Shutdown the guest cleanly
Foreach ($VM in ($ESXSRV1 | Get-VM | Where-Object {$_.Folder -notmatch “vCenter”})){$VM | Shutdown-VMGuest -Confirm:$false}

# For each of the VMs on esxsrv2
# - Shutdown the guest cleanly
Foreach ($VM in ($ESXSRV2 | Get-VM | Where-Object {$_.Folder -notmatch “vCenter”})){$VM | Shutdown-VMGuest -Confirm:$false}

# Set the amount of time to wait before assuming the remaining powered on guests are stuck
Write-Host "Sleep $shutdownwaittime seconds" -ForegroundColor Green Start-Sleep $Waittime

# Set Hoststate to Maintenance for esxsrv1
Set-VMHost -VMhost $ESXSRV1 -State “Maintenance”

# Shutdown of esxsrv1
$ESXSRV1 | Foreach {Get-View $_.ID} | Foreach {$_.ShutdownHost_Task($TRUE)} Write-Host "Shutdown $ESXSRV1 Complete" -ForegroundColor Green

# Set Hoststate to Maintenance for esxsrv2
Set-VMHost -VMhost $ESXSRV2 -State “Maintenance”

# Shutdown of esxsrv2
$ESXSRV2 | Foreach {Get-View $_.ID} | Foreach {$_.ShutdownHost_Task($TRUE)} Write-Host "Shutdown $ESXSRV2 Complete" -ForegroundColor Green
Stop-Transcript

Recovery script:

$enddate = (Get-Date).tostring("yyyyMMdd") $filename = 'C:\Recovery' + $enddate + '.log'
Start-Transcript $filename
Write-Host "Received recovery signal from ups" -ForegroundColor Green
Write-Host "Going to kill Powershell process" -ForegroundColor Green
Stop-Process -processname powershell*
Write-Host "Powershell process was killed" -ForegroundColor Green
Stop-Transcript
Go to Top