Proxmox Serial Number passthrough

I see a couple git tickets on adding serial numbers to Vmware and KVM block devices when passed through to the guest(rockstor). Anyone have a workaround for doing this with Proxmox? Trying to get rid of the dreaded “disk serial number or uuid is not legitimate or unique” warnings in the interface.

Here’s a solution/work-around that works regardless of the hypervisor or hdd source.

  1. Create a file /etc/udev/rules.d/10-local.rules
  2. For each drive, add a line like so:
    DEVPATH=="/devices/vbd-51792/block/xvdf" ENV{ID_SERIAL}=“vbd-51792” ENV{ID_SERIAL_SHORT}=“vbd-51792”

suppose your device is /dev/xvdf, you can get the DEVPATH with this command udevadm info --name=xvdh. ID_SERIAL and ID_SERIAL_SHORT are something you can set to anything unique. Obviously, this assumes that /dev/xvdf doesn’t change name upon reboot. I think for testing purposes you should be fine with this. And if your hypervisor assures static device names, this method is no longer a work-around but a simple solution.

After creating the udev rules above, reload them with udevadm control --reload-rules. Then rescan your drives from the web-ui and see if that helps. If not, reboot and try again.

2 Likes

Thanks, that seems to work.

It’s possible to get Proxmox to passthrough a Serial number for the HDD but it’s a right Pain in the rear to do.

see http://bos-info.com/freebsd/hhd-serial-number-proxmox.html

  1. Add the drives to the VM as usual

  2. run qm showcmd XXX (Where XXX is the vm id)

Copy the command to notepad.etc, find the lines that deal with the drives e.g

-drive file=/dev/disk/by-id/scsi-SATA-MYDRIVE-SN,if=none,id=drive-virtio1,cache=writethrough,aio=threads,detect-zeroes=on -device virtio-blk-pci,drive=drive-virtio1,id=virtio1,bus=pci.0,addr=0xb

(Yours will be a file if you’ve not passed through a drive)

Copy them.

Edit the config file for the container and comment out the lines relating to your virtual HDD with a #

add the line

args: -drive file=/dev/disk/by-id/scsi-SATA-MYDRIVE-SN,if=none,id=drive-virtio1,cache=writethrough,aio=threads,detect-zeroes=on,serial=MYSERIAL -device virtio-blk-pci,drive=drive-virtio1,id=virtio1,bus=pci.0,addr=0xb

1 Like

What my 100.conf looks like now (Rockstor was the first VM is setup when I installed proxmox)

root@pve:/var/log# cat /etc/pve/qemu-server/100.conf

boot: cdn
bootdisk: sata0
cores: 8
cpu: host
ide2: none,media=cdrom
memory: 2048
name: Rockstor
net0: virtio=00:XX:XX:XX:XX:XX,bridge=vmbr0
numa: 0
ostype: l26
sata0: VMS1:100/vm-100-disk-1.qcow2,format=qcow2,cache=writethrough,size=49G
smbios1: uuid=1721a17b-xxxx-xxxxx-xxxxx-xxxxx
sockets: 1
vga: qxl

#virtio0: /dev/disk/by-id/scsi-SATA_WDC_Drive1,cache=writethrough,backup=no
#virtio1: /dev/disk/by-id/scsi-Toshiba_drive2,cache=writethrough,backup=no
#virtio2: /dev/disk/by-id/scsi-SATA_Toshiba_drive3,cache=writethrough,backup=no

args: -drive file=/dev/disk/by-id/scsi-Toshiba_drive2,if=none,id=drive-virtio1,cache=writethrough,aio=threads,detect-zeroes=on,serial=TOSHIBA_Drive2 -device virtio-blk-pci,drive=drive-virtio1,id=virtio1,bus=pci.0,addr=0xb -drive file=/dev/disk/by-id/scsi-SATA_Toshiba_drive3,if=none,id=drive-virtio2,cache=writethrough,aio=threads,detect-zeroes=on,serial=Toshiba_drive3 -device virtio-blk-pci,drive=drive-virtio2,id=virtio2,bus=pci.0,addr=0xc -drive file=/dev/disk/by-id/scsi-SATA_WDC_Drive1,if=none,id=drive-virtio0,cache=writethrough,aio=threads,detect-zeroes=on,serial=WDC_Drive1 -device virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa

1 Like

https://bugzilla.proxmox.com/show_bug.cgi?id=153

Looks like this might get a whole lot easier in future releases.

Just installed RockStor as a KVM in Proxmox 4.1, so this is my first post to this community. :smiley: :wave: I am not an IT pro just a home user/enthusiast in over his head and willing to learn.

I used the new method to pass my lone HDD to RS as described in the link in the post above. However, RS is only showing 100G of some 2TB.

“virtio0: local:100/vm-100-disk-1.qcow2,cache=writeback,size=1863G,serial=WDC_WD20EZRX-00DC0B0_WD-WMC1T1453223”

I am fairly certain this is not the proper syntax, so that could be my problem. So, I have posted a similar quest over at Proxmox.

If I use the old method “/dev/disk/by-id/”, RS see’s the whole disk but I get the dreaded warning about I.D.'s changing etc.etc.

I have not tried Suman’s method as Proxmox’s seems to be more straight forward or at least that’s what I thought.

Any help would be greatly appreciated. I realize this could be a Proxmox issue but was hoping someone has had success using Proxmox’s new method and can put me on the right path.

Thanks in advance.

I’ll see if I can give this a try on my Proxmox installation. Now at v4.1 as well. I think the reason you’re not seeing all of your 2TB, is because you’re using a local:100/vm-100-disk-1.qcow2 for the VMs disk. If you want to pass along the whole drive, try using the block device like /dev/sdb, etc.

I’l post back up when I’m able to test out the serial number pass through.

1 Like

AWESOME! Thank you.

Kinda got my media server build on hold until I get this pass-through issue straightened out.

BOOOM, That did the trick! Woooohooooo :open_mouth: :+1:

Thanks a million, or should I say thanks a 1887436.8 million mb, that is! :grinning:

“virtio0: /dev/sdc,cache=writeback,size=1863G,serial=serial#”

@baggar11, u da man. from a noob in waaayyy over his head

1 Like

I’d use the Disk by ID method incase the disk ever moves from /dev/sdc which it could do if it ever gets plugged in to a different port or if driver updates change the way they HDD’s are discovered

"virtio0: /dev/disk-by-id/#ID,cache=writeback,size=1863G,serial=serial#

just fyi:

  1. Setup your VM as you normally do in Proxmox via GUI.
  2. SSH into your proxmox-node
  3. nano /etc/pve/qemu-server/‘vmID’.conf
    edit in the following parts:

virtio0: ceph_P23_R3:vm-1092-disk-1,cache=none,discard=on,iothread=on,size=4G,serial='RS-Media2-OS-01’
virtio1: Rockstore:vm-1092-disk-1,cache=none,discard=on,backup=no,iothread=on,size=1024G,serial='RS-Media2-Data-01’
virtio2: Rockstore:vm-1092-disk-2,cache=none,discard=on,backup=no,iothread=on,size=1024G,serial='RS-Media2-Data-02’
virtio3: Rockstore:vm-1092-disk-3,cache=none,discard=on,backup=no,iothread=on,size=1024G,serial='RS-Media2-Data-03’
virtio4: Rockstore:vm-1092-disk-4,cache=none,discard=on,backup=no,iothread=on,size=1024G,serial=‘RS-Media2-Data-04’

4 Make sure your serial is unique (preferable for your Proxmox-Cluster) and within the limit (afaik that is 18 digits)
5 Start up your VM.

keeps with clone / backup / migrate and HA.

ps.:

virtio4: Rockstore:vm-1092-disk-4,cache=none,discard=on,backup=no,iothread=on,size=1024G,serial=‘RS-Media2-Data-04’

That is a (K)RDB based pool from my ceph-cluster. this will normally be based on what ever storage you have defined in “Proxmox > Datacenter > Storage”

1 Like

Bumping this as this seems to be the issue i’m facing with the host being Hyper-V 2012r2 any solution?

I’ve attempted the above 10-local.rules file to no avail at this point.

its because there should be no quotes arround serial number :slight_smile: snippet from my old config when I used virtio_blk:

virtio1: /dev/disk/by-id/ata-WDC_WD2003FYYS-05T8B0_WD-WMAUR0510553,size=1953514584K,serial=WD-WMAUR0510533
virtio2: /dev/disk/by-id/ata-WDC_WD2003FYYS-05T8B0_WD-WMAUR0510822,size=1953514584K,serial=WD-WMAUR0510822

with virtio_scsi this problem goes away since operating system is allowed to talk directly to the drive and query it for it’s real serial number.

1 Like