[CentOS] getting a CentOS6 VM on VMware ESXi platform to recognize a new disk device

Wed Nov 4 20:31:23 UTC 2015
John R Pierce <pierce at hogranch.com>

On 11/4/2015 11:36 AM, Boris Epstein wrote:
> Absolutely, I see your point. This was the starting point - you add the
> device on the ESXi server, you reboot the VM, the VM sees the device, no
> problem. Now, I ask - do I have to reboot the VM? Logically I hope there
> ought to be a way for me not to have to do that - but I have yet to figure
> out how to get there.
>

vmware esxi 5.5.0 (free, using vsphere client to manage), vm is minimal 
centos 7 64bit.   I added a 16gb vdisk and immediately see this in dmesg...

[155484.386792] vmw_pvscsi: msg type: 0x0 - MSG RING: 1/0 (5)
[155484.386796] vmw_pvscsi: msg: device added at scsi0:1:0
[155484.388250] scsi 0:0:1:0: Direct-Access     VMware   Virtual 
disk     1.0  PQ: 0 ANSI: 2
[155484.391275] sd 0:0:1:0: [sdb] 33554432 512-byte logical blocks: 
(17.1 GB/16.0 GiB)
[155484.391552] sd 0:0:1:0: [sdb] Write Protect is off
[155484.391556] sd 0:0:1:0: [sdb] Mode Sense: 61 00 00 00
[155484.391593] sd 0:0:1:0: [sdb] Cache data unavailable
[155484.391595] sd 0:0:1:0: [sdb] Assuming drive cache: write through
[155484.396148]  sdb: unknown partition table
[155484.396356] sd 0:0:1:0: [sdb] Attached SCSI disk

and lsblk shows...

# lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                         8:0    0   32G  0 disk
....
sdb                         8:16   0   16G  0 disk
...

so I can immediately...

# mkfs.xfs /dev/sdb
meta-data=/dev/sdb               isize=256    agcount=4, agsize=1048576 blks
.....
# mount /dev/sdb /mnt
#

(normally, I'd partition and lvm it, this is just for demo)
I'm using a paravirtual scsi controller, and have previously installed 
open-vm-tools via yum.

I then umounted it, and in vsphere deleted the vdisk and dmesg 
immediately shows...

[155820.730477] vmw_pvscsi: msg type: 0x1 - MSG RING: 2/1 (5)
[155820.730481] vmw_pvscsi: msg: device removed at scsi0:1:0
[155820.754176] sd 0:0:0:0: Attached scsi generic sg0 type 0
[155820.754247] sr 2:0:0:0: Attached scsi generic sg1 type 5


I also did much the same with a CentOS 6.7 VM, also using a 'paravirtual 
SCSI' vm on the same esxi host, when I added the vdisk, it immediately 
shows...

# dmesg
.....
vmw_pvscsi: msg type: 0x0 - MSG RING: 1/0 (5)
vmw_pvscsi: msg: device added at scsi0:1:0
scsi 2:0:1:0: Direct-Access     VMware   Virtual disk     1.0  PQ: 0 ANSI: 2
sd 2:0:1:0: Attached scsi generic sg2 type 0
sd 2:0:1:0: [sdb] 33554432 512-byte logical blocks: (17.1 GB/16.0 GiB)
sd 2:0:1:0: [sdb] Write Protect is off
sd 2:0:1:0: [sdb] Mode Sense: 61 00 00 00
sd 2:0:1:0: [sdb] Cache data unavailable
sd 2:0:1:0: [sdb] Assuming drive cache: write through
sd 2:0:1:0: [sdb] Cache data unavailable
sd 2:0:1:0: [sdb] Assuming drive cache: write through
  sdb: unknown partition table
sd 2:0:1:0: [sdb] Cache data unavailable
sd 2:0:1:0: [sdb] Assuming drive cache: write through
sd 2:0:1:0: [sdb] Attached SCSI disk

# lsblk
NAME                               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0                                 11:0    1 1024M  0 rom
sda                                  8:0    0   16G  0 disk
├─sda1                               8:1    0  500M  0 part /boot
└─sda2                               8:2    0 15.5G  0 part
   ├─vg_svfisc6test5-lv_root (dm-0) 253:0    0  9.6G  0 lvm  /
   └─vg_svfisc6test5-lv_swap (dm-1) 253:1    0  5.9G  0 lvm  [SWAP]
sdb                                  8:16   0   16G  0 disk

and I note this VM is *not* running vmware tools

NEITHER of these two VMs required rebooting or any echo "- - -" 
 >/sys/scsi/.. stuffs.


-- 
john r pierce, recycling bits in santa cruz