User Tools

Site Tools


proxmox:disks:add_storage_drives:add_a_disk_to_a_config_via_the_shell

Proxmox - Disks - Add Storage Drives - Add a disk to a config via the shell

qm set {vm id} -{bus/device} /dev/disk/by-id/{DISK ID}

Identify Disks

lsblk -o +MODEL,SERIAL

returns:

NAME                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT    MODEL                     SERIAL
sda                      8:0    0 232.9G  0 disk               Samsung_SSD_870_EVO_250GB S61WNJ0R322118X
├─sda1                   8:1    0  1007K  0 part                                         
├─sda2                   8:2    0   512M  0 part /boot/efi                               
└─sda3                   8:3    0 232.4G  0 part                                         
  ├─pve-swap           253:30   0     8G  0 lvm  [SWAP]                                  
  ├─pve-root           253:31   0    58G  0 lvm  /                                       
  ├─pve-data_tmeta     253:32   0   1.5G  0 lvm                                          
  │ └─pve-data         253:34   0 147.4G  0 lvm                                          
  └─pve-data_tdata     253:33   0 147.4G  0 lvm                                          
    └─pve-data         253:34   0 147.4G  0 lvm                                          
sdb                      8:16   0 232.9G  0 disk               Samsung_SSD_860_EVO_250GB S4CJNF0M751860H
└─sdb1                   8:17   0 232.9G  0 part /mnt/pve/ISO1                           
sdc                      8:32   0  14.6T  0 disk               ST16000NM001G-2KK103      ZL2JTP65
sdd                      8:48   0  14.6T  0 disk               ST16000NM001G-2KK103      ZL2JS9LB
sde                      8:64   0  14.6T  0 disk               ST16000NM001G-2KK103      ZL2DT8DM
├─VM1-vm--100--disk--0 253:0    0   100G  0 lvm                                          
├─VM1-vm--101--disk--0 253:1    0    32G  0 lvm                                          
├─VM1-vm--201--disk--0 253:2    0     8G  0 lvm                                          
├─VM1-vm--103--disk--0 253:3    0    32G  0 lvm                                          
├─VM1-vm--104--disk--0 253:4    0    32G  0 lvm                                          
├─VM1-vm--109--disk--0 253:5    0    60G  0 lvm                                          
├─VM1-vm--107--disk--0 253:6    0     8G  0 lvm                                          
├─VM1-vm--108--disk--0 253:7    0     8G  0 lvm                                          
├─VM1-vm--110--disk--0 253:8    0     8G  0 lvm                                          
├─VM1-vm--111--disk--0 253:9    0    50G  0 lvm                                          
├─VM1-vm--112--disk--0 253:10   0    50G  0 lvm                                          
├─VM1-vm--106--disk--0 253:11   0     8G  0 lvm                                          
├─VM1-vm--202--disk--0 253:12   0    50G  0 lvm                                          
├─VM1-vm--113--disk--0 253:13   0    64G  0 lvm                                          
├─VM1-vm--113--disk--1 253:14   0     4M  0 lvm                                          
├─VM1-vm--114--disk--0 253:15   0     2T  0 lvm                                          
├─VM1-vm--105--disk--0 253:16   0     8T  0 lvm                                          
├─VM1-vm--115--disk--0 253:17   0     8G  0 lvm                                          
├─VM1-vm--116--disk--0 253:18   0   100G  0 lvm                                          
├─VM1-vm--117--disk--0 253:19   0     8G  0 lvm                                          
├─VM1-vm--203--disk--0 253:20   0     8G  0 lvm                                          
├─VM1-vm--118--disk--0 253:21   0    32G  0 lvm                                          
├─VM1-vm--119--disk--0 253:22   0     2G  0 lvm                                          
├─VM1-vm--119--disk--1 253:23   0     2G  0 lvm                                          
├─VM1-vm--120--disk--0 253:24   0     2G  0 lvm                                          
├─VM1-vm--120--disk--1 253:25   0     2G  0 lvm                                          
├─VM1-vm--121--disk--0 253:26   0    32G  0 lvm                                          
├─VM1-vm--121--disk--1 253:27   0     4M  0 lvm                                          
├─VM1-vm--122--disk--0 253:28   0    32G  0 lvm                                          
└─VM1-vm--122--disk--1 253:29   0     4M  0 lvm                                          
sdf                      8:80   0  14.6T  0 disk               ST16000NM001G-2KK103      WL2091XL
└─sdf1                   8:81   0  14.6T  0 part                                         
sdg                      8:96   0  14.6T  0 disk               ST16000NM001G-2KK103      ZL2B032M
├─VM2-vm--102--disk--0 253:35   0  14.2T  0 lvm                                          
└─VM2-vm--102--disk--1 253:36   0     4M  0 lvm                                          
sr0                     11:0    1  1024M  0 rom                HL-DT-STDVDRRW_GSA-H30L   HL-DT-STDVDRRW_GSA-H30L

NOTE: From this list, the following disks are identified as going to be used.

  • sdc 8:32 0 14.6T 0 disk ST16000NM001G-2KK103 ZL2JTP65
  • sdd 8:48 0 14.6T 0 disk ST16000NM001G-2KK103 ZL2JS9LB
  • sdf 8:80 0 14.6T 0 disk ST16000NM001G-2KK103 WL2091XL

List Disks by ID

ls /dev/disk/by-id/

returns:

ata-HL-DT-STDVDRRW_GSA-H30L
ata-Samsung_SSD_860_EVO_250GB_S4CJNF0M751860H
ata-Samsung_SSD_860_EVO_250GB_S4CJNF0M751860H-part1
ata-Samsung_SSD_870_EVO_250GB_S61WNJ0R322118X
ata-Samsung_SSD_870_EVO_250GB_S61WNJ0R322118X-part1
ata-Samsung_SSD_870_EVO_250GB_S61WNJ0R322118X-part2
ata-Samsung_SSD_870_EVO_250GB_S61WNJ0R322118X-part3
ata-ST16000NM001G-2KK103_WL2091XL
ata-ST16000NM001G-2KK103_WL2091XL-part1
ata-ST16000NM001G-2KK103_ZL2B032M
ata-ST16000NM001G-2KK103_ZL2DT8DM
ata-ST16000NM001G-2KK103_ZL2JS9LB
ata-ST16000NM001G-2KK103_ZL2JTP65
...

NOTE: The corresponding ID names for the 3 disks identified in the previous step is:

  • ata-ST16000NM001G-2KK103_ZL2JTP65
  • ata-ST16000NM001G-2KK103_ZL2JS9LB
  • ata-ST16000NM001G-2KK103_WL2091XL

Check HardWare Config of VM in Proxmox GUI

Navigator to the specific VM to which a disk is to be added.

In the Hardware there should be:

  • A SCSI Controller.
  • A Hard Disk (scsi0).

NOTE: This shows that there is a single Hard Disk scsi0.

  • But the SCSI Contoller can also support additional Hard Disks named:
  • scsi1
  • scsi2
  • …and so on…

Check also the Config File of the VM

cat /etc/pve/nodes/pve/qemu-server/122.conf 

returns:

balloon: 8192
boot: order=scsi0;ide2;net0
cores: 4
cpu: host
efidisk0: VM1:vm-122-disk-1,efitype=4m,pre-enrolled-keys=1,size=4M
ide2: none,media=cdrom
machine: q35
memory: 16384
name: TrueNASScale
net0: virtio=46:23:DF:15:1D:F6,bridge=vmbr1,firewall=1
numa: 0
ostype: l26
scsi0: VM1:vm-122-disk-0,size=32G
scsihw: virtio-scsi-pci
smbios1: uuid=b1bc7679-4024-4814-ac1f-05d4d13c94a2
sockets: 1
vmgenid: 976e446a-7469-4f60-ae71-e95101357f14

Add a Disk to the VM

qm set 122 -scsi1 /dev/disk/by-id/ata-ST16000NM001G-2KK103_ZL2JTP65

returns:

update VM 122: -scsi1 /dev/disk/by-id/ata-ST16000NM001G-2KK103_ZL2JTP65

IMPORTANT: Disks need to be identified by their ID and not by their /dev/sdc names.

  • The reason for this, is that after every boot the /dev/sdc names may be switched around.

Recheck the Config File of the VM

cat /etc/pve/nodes/pve/qemu-server/122.conf 

returns:

balloon: 8192
boot: order=scsi0;ide2;net0
cores: 4
cpu: host
efidisk0: VM1:vm-122-disk-1,efitype=4m,pre-enrolled-keys=1,size=4M
ide2: none,media=cdrom
machine: q35
memory: 16384
name: TrueNASScale
net0: virtio=46:23:DF:15:1D:F6,bridge=vmbr1,firewall=1
numa: 0
ostype: l26
scsi0: VM1:vm-122-disk-0,size=32G
scsi1: /dev/disk/by-id/ata-ST16000NM001G-2KK103_ZL2JTP65,size=14902G
scsihw: virtio-scsi-pci
smbios1: uuid=b1bc7679-4024-4814-ac1f-05d4d13c94a2
sockets: 1
vmgenid: 976e446a-7469-4f60-ae71-e95101357f14

NOTE: The scsi1 is showing.

  • The GUI should also show this additional drive.

Add Additional Disks as Required

qm set 122 -scsi2 /dev/disk/by-id/ata-ST16000NM001G-2KK103_ZL2JS9LB
update VM 122: -scsi2 /dev/disk/by-id/ata-ST16000NM001G-2KK103_ZL2JS9LB
qm set 122 -scsi3 /dev/disk/by-id/ata-ST16000NM001G-2KK103_WL2091XL
update VM 122: -scsi3 /dev/disk/by-id/ata-ST16000NM001G-2KK103_WL2091XL

IMPORTANT: For every additional disk, remember to use a different SCSI identifier:

  • -scsi2
  • -scsi3

proxmox/disks/add_storage_drives/add_a_disk_to_a_config_via_the_shell.txt · Last modified: 2021/10/17 16:38 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki