How to properly add a new disk and assign it to a VM

lumox

Member
May 29, 2020
111
5
23
42
Hi everyone,
I plugged a rather old SATA HD to my PC with Proxmox installed on it. I'd like now to assign it directly to OMV5 (one of my VMS installed in Proxmox) as a backup disk.
Some details about it (sdb):

disk.jpg


Code:
Disk /dev/sdb: 114.5 GiB, 122942324736 bytes, 240121728 sectors
Disk model: Maxtor 6Y120M0 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x73939156


det.jpg

Before initializing it, I'd like to make sure to understand what to do?
What do you suggest me to do to accomplish it smoothly?

Thanks
Thanks
 
Hi,

you have two possibilities to do this:

1. Add the disk to Proxmox VE, create a directory storage with it and add a new disk on that storage to the VM, this would be quite flexible, can be all done over the Webinterface, but the VM may have slightly reduced bandwidth available on that disk.

2. Pass the whole disk through to the VM, could be slightly more performant but needs to use the command line to do so.
Bash:
# first get a stable path to that disk, check the following output for the entry linking to /dev/sdb
ls -l /dev/disk/by-id

# then add it to the VM, replace VMID and the last part of the /dev path
# I'm assuming that scsi1 is available on that VM
qm set VMID --scsi1 /dev/disk/by-id/THE-ID-YOU-GOT-FROM-THE-PREVIOUS-STEP

# if running, reboot the VM to apply this change (can use webinterface again for this)
qm reboot VMID
 
  • Like
Reactions: Rayures and lumox
Hi,

you have two possibilities to do this:

1. Add the disk to Proxmox VE, create a directory storage with it and add a new disk on that storage to the VM, this would be quite flexible, can be all done over the Webinterface, but the VM may have slightly reduced bandwidth available on that disk.

2. Pass the whole disk through to the VM, could be slightly more performant but needs to use the command line to do so.
Bash:
# first get a stable path to that disk, check the following output for the entry linking to /dev/sdb
ls -l /dev/disk/by-id

# then add it to the VM, replace VMID and the last part of the /dev path
# I'm assuming that scsi1 is available on that VM
qm set VMID --scsi1 /dev/disk/by-id/THE-ID-YOU-GOT-FROM-THE-PREVIOUS-STEP

# if running, reboot the VM to apply this change (can use webinterface again for this)
qm reboot VMID


As for the second possibility, should I run the "Initialize disk with GPT" button first?
Thanks
 
Last edited:
You can, but you can also do this all in the VM, once passed through it has full control.

Ok

1) I quote a line above # I'm assuming that scsi1 is available on that VM.
I have this for my target VM. Is it ok to run
qm set VMID --scsi1 /dev/disk/by-id/THE-ID-YOU-GOT-FROM-THE-PREVIOUS-STEP ?

scsa1.jpg

2) The new disk is now recognized as /dev/sdb. What if I add another disk? Could it mess somethig up with the VM or Proxmox itself?

Thanks
 
Last edited:
Ok, I did it!! Everything went fine.
Still eager to know about question 2.
Thank you
 
I ran my Proxmox machine this morning and got this error message at the boot:

problem.jpg

It was taking a lot of time, so I turned off the machine and unplugged the HD. I then got this at the next boot:

problem2.jpg

It worked, Proxmox started.

What does it mean? What happened?

Thanks
 
Hi,

you have two possibilities to do this:

1. Add the disk to Proxmox VE, create a directory storage with it and add a new disk on that storage to the VM, this would be quite flexible, can be all done over the Webinterface, but the VM may have slightly reduced bandwidth available on that disk.

2. Pass the whole disk through to the VM, could be slightly more performant but needs to use the command line to do so.
Bash:
# first get a stable path to that disk, check the following output for the entry linking to /dev/sdb
ls -l /dev/disk/by-id

# then add it to the VM, replace VMID and the last part of the /dev path
# I'm assuming that scsi1 is available on that VM
qm set VMID --scsi1 /dev/disk/by-id/THE-ID-YOU-GOT-FROM-THE-PREVIOUS-STEP

# if running, reboot the VM to apply this change (can use webinterface again for this)
qm reboot VMID
This won't work if I try this with a container. Is there an equivilant? TIA
 

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!