VMware Cloud Community
sudhisht
Contributor
Contributor

SSD Emulation for Ubuntu VMs

I have an ESX server with datastore created on HDD and deployed Ubuntu VMs on it. For successful deployment of the application I want to have the Ubuntu VM detect the attached vmdk through SATA virtual adpater as SSD and report it in guest OS (ie, the output of cat /sys/block/sda/queue/rotational should be "0"). Is there a way I can achieve this with ESXi 6.0?

Note:- I have already tried the following with no luck

ESX server with 2*500GB HDD.

1) Created datastore on first disk with VMFS5 during installation.

2) After the ESXi installation, emulated second drive as SSD on ESXi host and then created VMFS5 datastore on it (I did this using SATP rule and also see that latest version of vSphere you can do it more easy way from Web Client)

3)      Created Ubuntu VM and attached 4 virtual disks as listed below

Disk Size

Adapter

VMDK ID

DataStore

Ubuntu VM Device Name

80GB

SCSI-LSI Logic Parallel

SCSI0:0

HDD

sda

6GB

SCSI-LSI Logic Parallel

SCSI0:5

SSD

sdb

16GB

SATA Controller

SATA1:0

HDD

sda

7GB

SATA Controller

SATA2:0

SSD

sdb

4)      Powered on the VM and noticed that the disk created on SSD datastore and attached through SCSI controller is detected as flash by Ubuntu OS

  root1@blr20-vm2:~$ sudo sg_inq --page=0xb1 /dev/sdb

VPD INQUIRY: Block device characteristcis page (SBC)

  Non-rotating medium (e.g. solid state)

  Product type=0

  WABEREQ=0

  WACEREQ=0

  Nominal form factor is not reported

  VBULS=0

root1@blr20-vm2:~$

5)      All other disks are detected as HDD by Ubuntu OS

root1@blr20-vm2:~$ sudo sg_inq --page=0xb1 /dev/sda

VPD INQUIRY: Block device characteristcis page (SBC)

Medium rotation rate is not reported

  Product type=0

  WABEREQ=0

  WACEREQ=0

  Nominal form factor is not reported

  VBULS=0

root1@blr20-vm2:~$ sudo sg_inq --page=0xb1 /dev/sdc

VPD INQUIRY: Block device characteristcis page (SBC)

  Medium rotation rate is not reported

  Product type=0

  WABEREQ=0

  WACEREQ=0

  Nominal form factor is not reported

  VBULS=0

root1@blr20-vm2:~$ sudo sg_inq --page=0xb1 /dev/sdd

VPD INQUIRY: Block device characteristcis page (SBC)

  Medium rotation rate is not reported

  Product type=0

  WABEREQ=0

  WACEREQ=0

  Nominal form factor is not reported

  VBULS=0

root1@blr20-vm2:~$

6)      Powered off the VM and edited .vmx file tagging these devices as SSD.

scsi0:0.virtualSSD = "1"

scsi1:0.virtualSSD = "1"

scsi2:0.virtualSSD = "1" (I have also tried sata2:0.virtualSSD = "1")

7)      After power-on noticed that the second disk attached through SCSI virtual adapter is also detected as SSD. Both disks attached through SATA virtual adapter is detected as HDD

root1@blr20-vm2:~$ sudo sg_inq --page=0xb1 /dev/sdb

VPD INQUIRY: Block device characteristcis page (SBC)

  Non-rotating medium (e.g. solid state)

  Product type=0

  WABEREQ=0

  WACEREQ=0

  Nominal form factor is not reported

  VBULS=0

root1@blr20-vm2:~$ sudo sg_inq --page=0xb1 /dev/sda

VPD INQUIRY: Block device characteristcis page (SBC)

  Non-rotating medium (e.g. solid state)

  Product type=0

  WABEREQ=0

  WACEREQ=0

  Nominal form factor is not reported

  VBULS=0

root1@blr20-vm2:~$ sudo sg_inq --page=0xb1 /dev/sdd

no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory

VPD INQUIRY: Block device characteristcis page (SBC)

  Medium rotation rate is not reported

  Product type=0

  WABEREQ=0

  WACEREQ=0

  Nominal form factor is not reported

  VBULS=0

root1@blr20-vm2:~$ sudo sg_inq --page=0xb1 /dev/sdc

VPD INQUIRY: Block device characteristcis page (SBC)

  Medium rotation rate is not reported

  Product type=0

  WABEREQ=0

  WACEREQ=0

  Nominal form factor is not reported

  VBULS=0

😎      But the following command listed all disks as “rotational =1

root1@blr20-vm2:~$ cat /sys/block/sda/queue/rotational

1

root1@blr20-vm2:~$ cat /sys/block/sdb/queue/rotational

1

root1@blr20-vm2:~$ cat /sys/block/sdc/queue/rotational

1

root1@blr20-vm2:~$ cat /sys/block/sdd/queue/rotational

1

root1@blr20-vm2:~$

9)      Conclusion on Ubuntu VM

1)      Disks connected through SCSI adapter can be simulated to detect as SSD by

      a)      Emulating the disk as SSD at ESXi Level and then creating the datastore and vmdk out of it

      b)      Modify the .vmx file and tag the vmdk as virtual SSD

2)      Both the above procedure does not work for disks attached through SATA controller for Ubuntu guest OS

3)      For the disks which are detected as SSD by Ubuntu guest using sg_inq command cat /sys/block/sda/queue/rotational report as “1”. This looks to be because the linux kernel expect SSDs to report a rotational speed of 1 RPM. See http://lxr.linux.no/#linux+v3.10.5/include/linux/ata.h#L914 in function ata_id_is_ssd() and probably ESX does not report 1RPM to guest OS??


10)  Windows VM SSD Emulation

To check if this issue is specific to guest OS I run the same procedure on Windows 8 VM.

1)      Windows VM detected all vmdks created on SSD datastore and attached through both SCSI and SATA virtual adapter as SSD within guest operating system.

2)      I have then modified .vmx file for vmdks created on HDD datastore. After this, Windows VM detected all vmdks created on HDD datastore also as SSD within guest operating system.

0 Kudos
0 Replies