Hi,
I have a situation where there are 3 disks -> /dev/sdj, /dev/sdk, /dev/sdl -> all 3 of same size in a RHEL system.
I want to remove a disk(/dev/sdj) from the system from Vsphere.
How to find the corresponding .vmdk name?
I have been trying.
Needing your help.
You should be able to tell from the VM's properties ( In vmware client, right click VM -> Edit Settings -> The hard disk you want to remove ). You can tell by size or SCSI node which should be in same order as in linux.
hi,
In our vm which is running with RHEL 6. I notice that /dev/sdb, /dev/sdc and /dev/sdd and mapped to hard disk 1, hardisk 2 and harddisk 3 . You can co relate this at the VMs edit settings.
NOTE: While removing the Hardisk from VM make sure that you just remove the .vmdk from the VM and do not select the option delete from disk. In this way you can be in safer side and if everything works out as expected you can manually delete the .vmdk file from Datastore (If you wish).
Hi ssuvasanth,
It's easy to identify the device file(/dev/sdX) and VMware virtual hard disk.
right click your virtual machine on the vCenter ( or vSphere Client), and click "Edit Settings".
You will see your virtual hard disk as above.
On the right pane, SCSI address shows up like "SCSI(0:0)". The number of the SCSI(X:X) can map to Linux device file such as;
SCSI(0:0) -> /dev/sda
SCSI(0:1) -> /dev/sdb
・
・
・
So I guess /dev/sdj, which you wish to delete, SCSI(0:10). Note that the virtual hard disk name "Hard disk X" is not necessarily corresponding to /dev/sdX.
This mapping is based on Linux device naming mechanism, thus if you customize this configuration, say using /etc/udev.rules, you should check Red Hat document before you delete your vdisk.
Best,
MAC
Hello,
The best way to do it a mix of the above and the following:
Run the command "lssci". A sample output is provided below:
Next follow the above suggestion from macvirtual to find out the mapping of the disks with the VMDK. Now you are sure and safe to know which is which.
Hope this helps
We have found that when using multiple pvscsi controllers the only reliable thing one can count on seems to be the LUN number. Controller host (first column) is completely random. We believe that the only way to reliably map these is to embed the controller and LUN id into the label or volume group name (assuming 1 vmdk per volume group)
If there are any linux method to sequentially map the host controllers this would make it more reliable.
Ideas anyone?
eg:
[0:0:0:0] disk VMware Virtual disk 1.0 /dev/sda
[0:0:1:0] disk VMware Virtual disk 1.0 /dev/sdb
[0:0:2:0] disk VMware Virtual disk 1.0 /dev/sdc
[1:0:0:0] disk VMware Virtual disk 1.0 /dev/sdd
[1:0:1:0] disk VMware Virtual disk 1.0 /dev/sde
[2:0:0:0] disk VMware Virtual disk 1.0 /dev/sdf
[2:0:1:0] disk VMware Virtual disk 1.0 /dev/sdg
[3:0:0:0] disk VMware Virtual disk 1.0 /dev/sdh
[3:0:1:0] disk VMware Virtual disk 1.0 /dev/sdi
^
Update: The following link describes the problem and we believe the problem is as stated that the pvSCSI driver just does now pass the info through such as the wwn for the controller.
vmware esx - How does Linux determine the SCSI address of a disk? - Server Fault
1. Use the dmesg command to find the existing disk SCSI ID and try to map it with VMware scsi id.
2. Pefrom the sg name validation on Linux to get the exact hard-disk name in the virtual Machine level.
For step by step guide, Please go through the below link.
How to Map the VMware virtual Disks for Linux VM ? - UnixArena
dmesg is the easiest way to map the disk with vmdk files.
execute the following command on your linux.
# dmesg | grep -i 'Attached SCSI disk'
sample outout.
sd 2:0:1:0: [sdb] Attached SCSI disk
sd 2:0:3:0: [sdd] Attached SCSI disk
sd 2:0:6:0: [sdg] Attached SCSI disk
sd 2:0:4:0: [sde] Attached SCSI disk
sd 2:0:0:0: [sda] Attached SCSI disk
sd 2:0:5:0: [sdf] Attached SCSI disk
sd 2:0:2:0: [sdc] Attached SCSI disk
now match second and third number from first column sd '2:0:1:0' with VMWARE scsi Id mentioned in VM properties as mentioned in above screen shot.
now match second and third number from first column sd '2:0:1:0' with VMWARE scsi Id mentioned in VM properties as mentioned in above screen shot.
sorry to say that: but that is not correct. The second number is always 0 here.
And there is no relation between the first number and the number of the SCSI Controller in VM Propierties. (though it is very often the same, but you cannot rely on that)
So after years: this question is still open to be answered
Hi,
I think the second zero is for Bus Number and the third is for the Unit Number.
Using UDEV would simplify things greatly.
https://www.usn-it.de/2019/11/25/make-linux-disk-ids-visible-for-udev-in-vmware/
Regards
Martin Klier
Hi @macvirtual
Thanks for your post.
I am also trying to correlate devices onlinux and vmware disks.
In my case, on linux when run pv command, it returns:
PV | PSize |
/dev/sdf1 | 1.36t |
/dev/sdg1 | 3.29t |
/dev/sdh1 | 400.00g |
/dev/sdi1 | 200.00g |
/dev/sdj1 | 300.00g |
/dev/sdk1 | 250.00g |
/dev/sdb1 | 5.00t |
/dev/sdb2 | 376.70g |
/dev/sdb3 | 500.00g |
/dev/sdb4 | 560.00g |
/dev/sdb5 | 123.30g |
/dev/sdb6 | 500.00g |
/dev/sdf2 | 1.93t |
/dev/sdm1 | 400.00g |
/dev/sdn1 | 350.00g |
/dev/sdp1 | 500.00g |
/dev/sdq1 | 500.00g |
/dev/sdl1 | 510.00g |
/dev/sdo1 | 500.00g |
All of them are lvm2.
In My vm settings:
HD | Type | SCSI id | Size |
HD1 | VDISK | SCSI (0:0) | 180 |
HD2 | RAW | SCSI (0:1) | 7180 |
HD3 | RAW | SCSI (0:2) | 100 |
HD4 | RAW | SCSI (0:3) | 1024 |
HD5 | RAW | SCSI (0:4) | 130 |
HD6 | RAW | SCSI (0:6) | 3372 |
HD7 | RAW | SCSI (0:8) | 3372 |
HD8 | VDISK | SCSI (0:5) | 400 |
HD9 | VDISK | SCSI (0:9) | 200 |
HD10 | VDISK | SCSI (0:10) | 300 |
HD11 | VDISK | SCSI (0:11) | 250 |
HD12 | VDISK | SCSI (0:12) | 500 |
HD13 | VDISK | SCSI (1:0) | 510 |
HD14 | VDISK | SCSI (1:1) | 400 |
HD15 | VDISK | SCSI (1:2) | 350 |
HD16 | VDISK | SCSI (1:3) | 500 |
HD17 | VDISK | SCSI (1:4) | 500 |
So i can´t correlate SCSI(0:0) -> /dev/sda, SCSI(0:1) -> /dev/sdb and so on...
What do you suggest?
you should enable uuid on vm level