Which vmdk was deleted?

An admin has deleted a disk from a VM. The only task you see in vCenter simply states “Reconfigure virtual machine”. So which disk was deleted? Where was it located? You can check this in the hostd log.

 

Enable SSH on the host that the VM was running on at the time of the deletion, log on, run:

cat /var/log/hostd.log | grep [VM name]

 

You will see entries like this:

2015-06-17T02:30:57.351Z [FFD9C920 verbose ‘Vmsvc.vm:/vmfs/volumes/550c429f-8eb29ae1-4ebb-b82a71234f1d/[VM name]/ [VM name].vmx’ opID=F669BF69-00005F62-4c-70 user=vpxuser] Adjusting tracking state for disk /vmfs/volumes/550c429f-8eb29ae1-4ebb-b82a71234f1d /[VM name]/ [VM name].vmdk to state disabled.

2015-06-17T02:30:57.355Z [FFD9C920 verbose ‘Vmsvc.vm:/vmfs/volumes/550c429f-8eb29ae1-4ebb-b82a71234f1d/[VM name]/[VM name].vmx’ opID=F669BF69-00005F62-4c-70 user=vpxuser] Disk /vmfs/volumes/550c429f-8eb29ae1-4ebb-b82a71234f1d/[VM name]/[VM name].vmdk: Tracking is already deactivated, skipping.

 

There you can see the location and name of vmdk that was deleted.

PowerCLI One Liners

I have come across various powercli one liners as I work with vSphere that are helpful for quickly collecting information. Some of these come from blogs or the VMware communities pages, thanks to all those contributors! 

This will list the details of RDMs for a VM (very useful if you have many gatekeepers for example):

get-vm -name [VM Name] | get-harddisk -disktype “RawPhysical”,”RawVirtual” | select Parent,Name,DiskType,ScsiCanonicalName,DeviceName | fl

 

This will list VM mapping to physical vmnic:

Connect-viserver [hostname]

Get-EsxTop -CounterName NetPort | Select PortID, ClientName, TeamUplink

 

This will get your host DNS settings (Primary / Secondary DNS servers):

Get-VMHost [hostname] | Get-VMHostNetwork | Select Hostname,DnsAddress

 

This will set your host DNS settings (Primary / Secondary DNS servers)::

Get-VMHostNetwork -VMHost (Get-VMHost -Name [hostname]) | Set-VMHostNetwork -DnsAddress [Primary DNS],[Secondary DNS]

 

This will list the VMs connected to a specific port group:

Get-VM | where { ($_ | Get-NetworkAdapter | where {$_.networkname -match “portgroupname”})}

 

This will start the SSH service on all hosts in a cluster:

Get-Datacenter “[datacenter object name]” | Get-Cluster “[cluster name]” | Get-VMHost | Sort Name | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} | Start-VMHostService -confirm:$false

 

Stop SSH:

Get-Datacenter “[datacenter object name]” | Get-Cluster “[cluster name]” | Get-VMHost | Sort Name | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} | Stop-VMHostService -confirm:$false