How can I add a disk then use it in one VM?

NickH

Member
Aug 13, 2020
31
1
13
64
I currently have Proxmox installed on a 1TB HDD and it is running 4 VM's at the moment, until I can get some more memory.

I have one VM running ClearOS7 (based on Centos7) set up as a Sia node and it has currently synchronised the blockchain which is great. I now need to set up some storage (the VM has just a 64GB virtual disk). I have a spare 2TB disk that I can add to the server, and I'd like to make the disk uniquely available to the Sia VM. Formatting the disk and mounting it in Proxmox isn't a problem. How can I then mount it in the VM?
 
you can either pass it through as a disk to the VM (e.g., with qm set VMID -DISKCONTROLLER /dev/path/to/full/disk), which will mean that PVE does not manage that disk at all, you can't do snapshots, etc.pp.. or you define a storage on top of that disk, and then just allocate a regular volume and assign that to the VM (which means one layer of indirection between the VM and the disk, but full support for everything that the storage type you choose supports).
 
Hmm. That option is not covered in the qm(1) docs.

[edit]
Never mind. I see I need to identify the -DISKCONTROLLER as something like -scsi4 or however it shows up.
[/edit]
 
Last edited:
A bit of a bump, but I've tried to do this again and got it wrong. How do I undo:
Code:
qm set 117 -scsi2 /dev/sda1
I failed in my format of the disk and it should have been a single blank partition so I need to start again
 
It looks like this does the trick:
Code:
qm set 117 --delete scsi2
I find it confusing when you do and don't use the '-' infront of scsi2.
 
It looks like this does the trick:
Code:
qm set 117 --delete scsi2
I find it confusing when you do and don't use the '-' infront of scsi2.
You could also remove the partition from the VMs hardware tab in the webUI.
 
Bumping this again.

I added another HDD to the server and got seriously shot in the foot because the device names of the disks changed, so what was /dev/sda became /dev/sdb and the new disk went in as /dev/sda. As /dev/sda was the device passed through to a guest with an earlier 'qm set 117 -scsi2 /dev/sda' that guest then saw the wrong disk and would not boot. Is there an alternative form of the command, perhaps using UUIDs or something where the disks won't shuffle themselves around if a new one is added?
 
yeah, just use any of the stable paths (/dev/disk/by-.../...)
 
OK, but isn't that by partition only? In this case it doesn't matter as there is a single partition on the disk:
Code:
root@pve:~# ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 Mar  2 14:34 181d729e-6e7d-4177-9abe-4f9c112e5377 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Mar  2 14:13 2BD9-4E15 -> ../../sdc2
lrwxrwxrwx 1 root root 10 Mar  2 14:13 85503a3f-9b34-412d-bcee-ce1c10c2cee9 -> ../../dm-2
lrwxrwxrwx 1 root root 10 Mar  2 14:35 947d4845-8bf9-4f4d-b61f-f621ffc9253a -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar  2 14:13 f2205a62-f67f-4ce7-baf1-f509eda257f8 -> ../../dm-3
I passed the whole disk through to the guest, and then I partitioned it in the guest, so the guest initially only saw an unpartitioned disk.
 
there is also by-path and by-id , which (among other things) should contain symlinks based on hardware topology (controller/port) and metadata (WWN, model+serial), both for the disks themselves and their partitions (and possibly also for logical devices like LVM LVs, ZFS zvols, ..)
 
Having a look, I don't know how stable by-path is:
Code:
root@pve:~# ls -l /dev/disk/by-path
total 0
lrwxrwxrwx 1 root root  9 Mar  2 14:35 pci-0000:00:1f.2-ata-2 -> ../../sda
lrwxrwxrwx 1 root root  9 Mar  2 14:35 pci-0000:00:1f.2-ata-2.0 -> ../../sda
lrwxrwxrwx 1 root root 10 Mar  2 14:35 pci-0000:00:1f.2-ata-2.0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar  2 14:35 pci-0000:00:1f.2-ata-2-part1 -> ../../sda1
lrwxrwxrwx 1 root root  9 Mar  2 14:34 pci-0000:00:1f.2-ata-3 -> ../../sdb
lrwxrwxrwx 1 root root  9 Mar  2 14:34 pci-0000:00:1f.2-ata-3.0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Mar  2 14:34 pci-0000:00:1f.2-ata-3.0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Mar  2 14:34 pci-0000:00:1f.2-ata-3-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Mar  2 14:13 pci-0000:00:1f.2-ata-4 -> ../../sdc
lrwxrwxrwx 1 root root  9 Mar  2 14:13 pci-0000:00:1f.2-ata-4.0 -> ../../sdc
lrwxrwxrwx 1 root root 10 Mar  2 14:13 pci-0000:00:1f.2-ata-4.0-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Mar  2 14:13 pci-0000:00:1f.2-ata-4.0-part2 -> ../../sdc2
lrwxrwxrwx 1 root root 10 Mar  2 14:13 pci-0000:00:1f.2-ata-4.0-part3 -> ../../sdc3
lrwxrwxrwx 1 root root 10 Mar  2 14:13 pci-0000:00:1f.2-ata-4-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Mar  2 14:13 pci-0000:00:1f.2-ata-4-part2 -> ../../sdc2
lrwxrwxrwx 1 root root 10 Mar  2 14:13 pci-0000:00:1f.2-ata-4-part3 -> ../../sdc3
lrwxrwxrwx 1 root root 13 Mar  2 14:13 pci-0000:0f:00.0-nvme-1 -> ../../nvme0n1
Would the paths change if another disk were added? Almost certainly it would if their slots moved (I have a 1*SAS -> 4*SATA cable so moving slots means using a different connector).

By-id looks more interesting:
Code:
root@pve:~# ls -l /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root  9 Mar  2 14:13 ata-ST1000DM010-2EP102_Z9A7YCWG -> ../../sdc
lrwxrwxrwx 1 root root 10 Mar  2 14:13 ata-ST1000DM010-2EP102_Z9A7YCWG-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Mar  2 14:13 ata-ST1000DM010-2EP102_Z9A7YCWG-part2 -> ../../sdc2
lrwxrwxrwx 1 root root 10 Mar  2 14:13 ata-ST1000DM010-2EP102_Z9A7YCWG-part3 -> ../../sdc3
lrwxrwxrwx 1 root root  9 Mar  2 14:34 ata-WDC_WD20EFRX-68EUZN0_WD-WMC4M1334155 -> ../../sdb
lrwxrwxrwx 1 root root 10 Mar  2 14:34 ata-WDC_WD20EFRX-68EUZN0_WD-WMC4M1334155-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Mar  2 14:35 ata-WDC_WD40EFZX-68AWUN0_WD-WX32DB048AZT -> ../../sda
lrwxrwxrwx 1 root root 10 Mar  2 14:35 ata-WDC_WD40EFZX-68AWUN0_WD-WX32DB048AZT-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar  9 11:01 dm-name-nvme_2g_01-vm--108--disk--0 -> ../../dm-8
lrwxrwxrwx 1 root root 10 Mar  2 14:13 dm-name-nvme_2g_01-vm--111--disk--0 -> ../../dm-9
lrwxrwxrwx 1 root root 11 Mar  2 14:13 dm-name-nvme_2g_01-vm--112--disk--0 -> ../../dm-12
lrwxrwxrwx 1 root root 11 Mar  2 14:13 dm-name-nvme_2g_01-vm--115--disk--0 -> ../../dm-10
lrwxrwxrwx 1 root root 11 Mar  2 14:13 dm-name-nvme_2g_01-vm--116--disk--0 -> ../../dm-11
lrwxrwxrwx 1 root root 11 Mar  2 14:13 dm-name-nvme_2g_01-vm--117--disk--0 -> ../../dm-13
lrwxrwxrwx 1 root root 10 Mar  2 14:13 dm-name-pve-root -> ../../dm-3
lrwxrwxrwx 1 root root 10 Mar  2 14:13 dm-name-pve-swap -> ../../dm-2
lrwxrwxrwx 1 root root 11 Mar  2 14:13 dm-name-pve-vm--100--disk--0 -> ../../dm-16
<snip>
As I suspect they will remain stable.

Thanks.
 

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!