VMware Cloud Community
rub1
Contributor
Contributor
Jump to solution

identify on which vmdk runs a specific guest OS device .

Hello

first. if I am in the wrong discussion group please point me the correct one .

I am trying to find a way to identify on which vmdk runs a specific guest OS disk .

example : on my virtual Centos I get a problem with /dev/sda device.

the OS shows in /var/messages retries or abends.

I would like to know in which xxxx.vmdk this device is included in order to know

which datastore/ physical drive might have a problem.

in the simplest configuration :

from vSphere I can browse the Datastores and get all the ( vmdk) files which belong to a VM and their size.

via perl scripts or vSphere GUI. I see that my vm configuration includes 2 hard disks , disk 1 and disk 2

from the guest OS I can get the available disks and the partition definition. ( df -k , sfdisk ..)

I can see two devices /dev/sda and /dev/sdb.

is there some tool ( linux or vmware ) that can map "/dev/sdxxx" in guest OS to " xxxx.vmdk" in the ESX. ?

as far as I understood from community discussion search is that this kind of information is not simply available via API

because of security needs to isolate between the ESX and the guest OS.

any suggestions ?

Best Regards

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

If you have VMware Tools running, you can get the disks within the OS and space consumed/etc. and then you can use some scripting logic to map that back to the VMDK(s).

Here is a health report script that extracts information about the guest disk utilization amongst other things to give you an idea how this can be done" .

Specifically, you'll want to look at guestInfo, again this information is only available if you have VMware Tools running and then you can get list of VMDK(s) the VM is running and compare.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
2 Replies
lamw
Community Manager
Community Manager
Jump to solution

If you have VMware Tools running, you can get the disks within the OS and space consumed/etc. and then you can use some scripting logic to map that back to the VMDK(s).

Here is a health report script that extracts information about the guest disk utilization amongst other things to give you an idea how this can be done" .

Specifically, you'll want to look at guestInfo, again this information is only available if you have VMware Tools running and then you can get list of VMDK(s) the VM is running and compare.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
DSTAVERT
Immortal
Immortal
Jump to solution

Have a look at the Ghetto Script Repository There are several disk related scripts. You can at least see which vmdk is which from the vSphere Client for each VM. Edit settings / Hardware. Select the hard disk. The vmdk name will show up and it will indicate the SCSI Node ID. Unless changed in the BIOS your VM would boot from the SCSI 0:0 disk Hard Disk 1.

-- David -- VMware Communities Moderator
0 Kudos