Proxmox VE 4.4 / 5.0 physical storage configuration

One of the purposes of my Proxmox Environment is providing remote storage for my home data. For example photos, videos, music and some other files. What I’m going to do is following: I want to configure data replication from my PC (which is running Windows 10) to Proxmox virtual machine with direct storage attached.

First thing I’m going to do is host packages update and upgrade.

# apt update  
# apt upgrade

For direct (physical) hard drive connection you will need to install lshw on Proxmox host. It will help us with getting hard drive id.

# apt install lshw

After you have installed it check storage devices connected to the host by using this command and find your HDD id

$ lshw -class disk -class storage
     *-scsi:3
       physical id: 5
       logical name: scsi3
       capabilities: emulated
     *-disk
          description: ATA Disk
          <strong>product</strong>: <strong>ST3000DM008-2DM1</strong>
          vendor: Seagate
          physical id: 0.0.0
          bus info: scsi@3:0.0.0
          logical name: /dev/sdd
          version: CC26
          <strong>serial</strong>: <strong>Z504948J</strong>
          size: 2794GiB (3TB)
          capabilities: gpt-1.00 partitioned partitioned:gpt
          configuration: ansiversion=5 guid=78bdc06f-ec7b-491d-b450-0f5b3134e50b logicalsectorsize=512 sectorsize=4096

We need this information because device names like /dev/sdd because those might change. For this scenario Proxmox team tells it is better use /dev/disk/by-id/…

Lets find our disk in that directory /dev/disk/by-id/ata-PRODUCTSERIAL:

# ls -l /dev/disk/by-id/ata-**ST3000DM008-2DM166**_**Z504948J**  
lrwxrwxrwx 1 root root 9 May 14 23:42 /dev/disk/by-id/ata-ST3000DM008-2DM166_Z504948J -> ../../sdd

or just do a search in directory using ls and grep

# ls -l /dev/disk/by-id | grep **Z504948J**  
lrwxrwxrwx 1 root root 9 May 14 23:42 ata-ST3000DM008-2DM166_Z504948J -> ../../sdd  
lrwxrwxrwx 1 root root 10 May 14 23:42 ata-ST3000DM008-2DM166_Z504948J-part1 -> ../../sdd1

Now lets add this physical hard drive to your VM using this command (change 100 with your VM ID):

# qm set 100 -virtio2 /dev/disk/by-id/ata-ST3000DM008-2DM166_Z504948J  
update VM 100: -virtio2 /dev/disk/by-id/ata-ST3000DM008-2DM166_Z504948J

Check if change applied to the VM configuration file:

# grep Z504948J /etc/pve/qemu-server/100.conf  
virtio2: /dev/disk/by-id/ata-ST3000DM008-2DM166_Z504948J,size=2930266584K

Then stop and restart your modified VM. Drive should appear available in your VM after restart.