SCSI LUN disk passthrough to VM

loffan

Member
Jul 19, 2017
4
0
6
34
Hi, Im in a quest to have the VM (OpenMediaVault) as direct access to two dedicated disks as possible.
I really want OMV to have S.M.A.R.T access to the disks but its not possilbe with the current setup.

Maybe I can use smart if i passthrough the whole LUN divice as stated on ovirt. org?
Adding a DirectLUN Disk (lun passthrough)
<devices>
<disk type='block' device='lun' rawio='no' sgio='unfiltered'>
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0' target=0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='virtio-scsi'/>
</devices>

How is this added in Proxmox?
Searched the web but cant find a proxmox config that passes throug the LUN.
Thanks!

Current config:
root@server:~# cat /etc/pve/qemu-server/100.conf
balloon: 2048
bootdisk: virtio0
cores: 2
ide2: local:iso/debian-8.8.0-amd64-netinst.iso,media=cdrom
keyboard: sv
memory: 6144
name: OMV
net0: virtio=9A:8F:3C:80:9A:4B,bridge=vmbr0
numa: 0
onboot: 1
ostype: other
scsi2: /dev/disk/by-id/ata-WDC_WD40EFRX-68N32N0_WD-WCC7K2HRAYS5,size=3907018584K
scsi3: /dev/disk/by-id/ata-WDC_WD40EFRX-68N32N0_WD-WCC7K2AAV0V5,size=3907018584K
scsihw: virtio-scsi-pci

smbios1: uuid=d5aabc1c-c6d5-4033-b473-90495217ad23
sockets: 1
usb0: host=1-10,usb3=yes
usb1: host=2-4,usb3=yes
virtio0: local:100/vm-100-disk-1.qcow2,size=31G

root@server:~# ps -ef | grep "kvm -id 100" | sed -r 's/ -/\n-/g' | grep scsi
-iscsi initiator-name=iqn.1993-08.org.debian:01:82e57f89a6bb
-device virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5
-drive file=/dev/disk/by-id/ata-WDC_WD40EFRX-68N32N0_WD-WCC7K2HRAYS5,if=none,id=drive-scsi2,format=raw,cache=none,aio=native,detect-zeroes=on
-device scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=2,drive=drive-scsi2,id=scsi2
-drive file=/dev/disk/by-id/ata-WDC_WD40EFRX-68N32N0_WD-WCC7K2AAV0V5,if=none,id=drive-scsi3,format=raw,cache=none,aio=native,detect-zeroes=on
-device scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=3,drive=drive-scsi3,id=scsi3
 
Hi,
thanks for the reply.

My config works for passthrough, the disks shows up as /dev/sda and /dev/sdb in the vm, its just that smart doesnt work. The disks have the name QEMU HARDDISK instead of the real name WDC WD40EFRX-68N32N0 (see below) i guess that LUN passthrough will enable smart access to the disks from the VM.

The LUN passthrough is possible with the added parameter: device='lun' I just dont know if or how I can add that to my config.
ovirtdotorg/develop/release-management/features/storage/virtio-scsi/

About PCI passthrough, is it feasable to move the controller as I only want two of my six sata disks to be passed on to this VM?
lspci shows me this, must be the 00:17:0 SATA controller.
root@server:~# lspci
00:00.0 Host bridge: Intel Corporation Device 5918 (rev 05)
00:01.0 PCI bridge: Intel Corporation Skylake PCIe Controller (x16) (rev 05)
00:13.0 Non-VGA unclassified device: Intel Corporation Sunrise Point-H Integrated Sensor Hub (rev 31)
00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-H Thermal subsystem (rev 31)
00:16.0 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #1 (rev 31)
00:16.1 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #2 (rev 31)
00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA controller [AHCI mode] (rev 31)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #1 (rev f1)
00:1c.1 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #2 (rev f1)
00:1c.6 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #7 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Sunrise Point-H LPC Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-H PMC (rev 31)
00:1f.4 SMBus: Intel Corporation Sunrise Point-H SMBus (rev 31)
01:00.0 VGA compatible controller: NVIDIA Corporation GF104 [GeForce GTX 460] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GF104 High Definition Audio Controller (rev a1)
02:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
03:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
04:00.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge (rev 03)
05:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 30)

SMART on host:
root@server:~# smartctl /dev/sdc -a
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.10.17-1-pve] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke,

=== START OF INFORMATION SECTION ===
Model Family: Western Digital Red
Device Model: WDC WD40EFRX-68N32N0
Serial Number: WD-WCC7K2HRAYS5
LU WWN Device Id: 5 0014ee 20e9727d9
Firmware Version: 82.00A82
User Capacity: 4 000 787 030 016 bytes [4,00 TB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Rotation Rate: 5400 rpm
Form Factor: 3.5 inches
Device is: In smartctl database [for details use: -P show]
ATA Version is: ACS-3 T13/2161-D revision 5
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Wed Jul 19 22:34:04 2017 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: (45600) seconds.
Offline data collection
capabilities: (0x7b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 483) minutes.
Conveyance self-test routine
recommended polling time: ( 5) minutes.
SCT capabilities: (0x303d) SCT Status supported.
SCT Error Recovery Control supported.
SCT Feature Control supported.
SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x002f 200 200 051 Pre-fail Always - 0
3 Spin_Up_Time 0x0027 188 165 021 Pre-fail Always - 5583
4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 52
5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0
7 Seek_Error_Rate 0x002e 100 253 000 Old_age Always - 0
9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 146
10 Spin_Retry_Count 0x0032 100 253 000 Old_age Always - 0
11 Calibration_Retry_Count 0x0032 100 253 000 Old_age Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 51
192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 31
193 Load_Cycle_Count 0x0032 200 200 000 Old_age Always - 77
194 Temperature_Celsius 0x0022 118 115 000 Old_age Always - 32
196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0030 100 253 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x0008 100 253 000 Old_age Offline - 0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Extended offline Interrupted (host reset) 90% 19 -
# 2 Extended offline Interrupted (host reset) 10% 19 -
# 3 Conveyance offline Completed without error 00% 0 -
# 4 Short offline Completed without error 00% 0 -

SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

SMART In VM:
root@nas:~# smartctl /dev/sda -a
smartctl 6.4 2014-10-07 r4002 [x86_64-linux-4.9.0-0.bpo.3-amd64] (local build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke,
=== START OF INFORMATION SECTION ===
Vendor: QEMU
Product: QEMU HARDDISK
Revision: 2.5+
User Capacity: 4,000,787,030,016 bytes [4.00 TB]
Logical block size: 512 bytes
LU is thin provisioned, LBPRZ=0
Rotation Rate: 5400 rpm
Device type: disk
Local Time is: Wed Jul 19 22:33:06 2017 CEST
SMART support is: Unavailable - device lacks SMART capability.

=== START OF READ SMART DATA SECTION ===

Error Counter logging not supported

Device does not support Self Test logging
 
I ordered a M2 SSD to use as the host disk, this will enable me to test to pass through the PCI SATA controller to the VM.
But it would still be good to know if its possible to pass through LUNs as described in the ovirt.org site in proxmox.

Best
Christoffer
 
If you need the lun flag you can also add the disk with args:

Code:
qm showcmd 100

Extract the 2 disk and add it to the config as arg: <cmd> extendet with lun
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!