Passthrough Physical Disk to Virtual Machine (VM): Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
No edit summary
(recommend virtio-scsi instead of virtio-block)
Line 33: Line 33:
*add to kvm :
*add to kvm :
<pre>
<pre>
qm set  592  -virtio2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC
qm set  592  -scsi2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC


update VM 592: -virtio2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC
update VM 592: -scsi2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC
</pre>
</pre>


Line 42: Line 42:
grep Z1F41BLC /etc/pve/qemu-server/592.conf
grep Z1F41BLC /etc/pve/qemu-server/592.conf


virtio2: /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC,size=2930266584K
scsi2: /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC,size=2930266584K
</pre>
</pre>


*stop and restart ... then configure disk from within the kvm.
*stop and restart ... then configure disk from within the kvm.

Revision as of 11:10, 23 December 2019

  • before adding physical disk to host make note of vendor,serial so that you'll know which disk to share in /dev/disk/by-id/
  • lshw on pve host after adding. note use apt-get install lshw if lshw is not already installed.
lshw -class disk -class storage

...
           *-disk
                description: ATA Disk
                product: ST3000DM001-1CH1
                vendor: Seagate
                physical id: 0.0.0
                bus info: scsi@3:0.0.0
                logical name: /dev/sda
                version: CC27
                serial: Z1F41BLC
                size: 2794GiB (3TB)
                configuration: ansiversion=5 sectorsize=4096
...
  • device names like /dev/sdc should never be used as those can change. instead use /dev/disk/by-id . check by listing all of that directory then look for the disk added by matching serial number from lshw and the physical disk :
ls -l /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC
lrwxrwxrwx 1 root root 9 Jan 21 10:10 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC -> ../../sda

or try

ls -l /dev/disk/by-id | grep Z1F41BLC


  • add to kvm :
qm set  592  -scsi2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC

update VM 592: -scsi2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC
  • check
grep Z1F41BLC /etc/pve/qemu-server/592.conf

scsi2: /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC,size=2930266584K
  • stop and restart ... then configure disk from within the kvm.