Curitiba/PR Contato
Administração e Suporte em Ti

O PVE está instalado no disco “/dev/sda” e quero adicionar um segundo disco que no nosso caso é o “/dev/sdb”

Apos adicionar um disco fisico no mesmo hardware da instalacao do Proxmox. Digite no shell:

pve:~# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): 
pve:~# 
Command (m for help): n
Partition number (1-128, default 1): 
First sector (34-976773134, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-976773134, default 976773134): 

Created a new partition 1 of type 'Linux filesystem' and of size 465.8 GiB.

Command (m for help): p
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk model: TOSHIBA MQ01ABF0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 64903441-9AB6-432C-82BB-210F9869FDE8

Device     Start       End   Sectors   Size Type
/dev/sdb1   2048 976773134 976771087 465.8G Linux filesystem

Command (m for help): 
Command (m for help): t
Selected partition 1
Partition type (type L to list all types): 31
Changed type of partition 'Linux LVM' to 'Linux LVM'.

Command (m for help): p
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk model: TOSHIBA MQ01ABF0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 64903441-9AB6-432C-82BB-210F9869FDE8

Device     Start       End   Sectors   Size Type
/dev/sdb1   2048 976773134 976771087 465.8G Linux LVM

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Antes de adiconarmos um disco, temos um disco de 500G ja instalado como volume pve conforme as linhas de comando a seguir

pve:~# vgs
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  VG  #PV #LV #SN Attr   VSize    VFree  
  pve   1   3   0 wz--n- <465.26g <16.00g
pve:~# lvs
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  LV   VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data pve twi-a-tz-- 339.33g             0.00   0.50                            
  root pve -wi-ao----  96.00g                                                    
  swap pve -wi-ao----   7.00g                                                    
pve:~# 

Criando um volume fisico

pve:~# pvcreate /dev/sdb1
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  Physical volume "/dev/sdb1" successfully created.

Listando os volums fisicos:

pve:~# pvs
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  PV         VG  Fmt  Attr PSize    PFree  
  /dev/sda3  pve lvm2 a--  <465.26g <16.00g
  /dev/sdb1      lvm2 ---   465.76g 465.76g

A listar os volumes, constatamos que ainda nao adicionamos um novo volume logico

pve:~# vgs
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  VG  #PV #LV #SN Attr   VSize    VFree  
  pve   1   3   0 wz--n- <465.26g <16.00g

Vamos então extender o volume pve com o disco sdb

pve:~# vgextend pve /dev/sdb1
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  Volume group "pve" successfully extended

Agora podemos verificar que o volume foi adicionado

ve:~# vgdisplay
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  --- Volume group ---
  VG Name               pve
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               <931.02 GiB
  PE Size               4.00 MiB
  Total PE              238340
  Alloc PE / Size       115011 / 449.26 GiB
  Free  PE / Size       123329 / 481.75 GiB
  VG UUID               OA62pR-UsZS-cSiI-rutJ-4Mdn-jgWa-KU4OYR
   

Anteriormente o volume foi adiconado, mas noa foi extendido

Extendendo todo o primeiro volume no primeiro disco

pve:~# lvextend -l 100%FREE pve/data
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  Size of logical volume pve/data_tdata changed from 339.33 GiB (86869 extents) to 481.75 GiB (123329 extents).
  Logical volume pve/data_tdata successfully resized.
pve:~# lvs
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  LV   VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data pve twi-a-tz-- 481.75g             0.00   0.51                            
  root pve -wi-ao----  96.00g                                                    
  swap pve -wi-ao----   7.00g                                                    
pve:~# 

Extendendo mais 200 GB no volume pve do segundo disco

pve:~# lvextend -L +200G  pve/data
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  Size of logical volume pve/data_tdata changed from 481.75 GiB (123329 extents) to 681.75 GiB (174529 extents).
  Logical volume pve/data_tdata successfully resized.
pve:~# 

Extendo mais 50GB no volume local do Proxmox

e:~# lvextend -L +50G  pve/root
  /dev/sdc: open failed: No medium found
  /dev/sdd: open failed: No medium found
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  Size of logical volume pve/root changed from 96.00 GiB (24576 extents) to 146.00 GiB (37376 extents).
  Logical volume pve/root successfully resized.

Agora vamos imaginar que você queira criar um outro volume, isolado do inicial. Você iria criar umm volume com nome diferente:

root@pve1:~# vgcreate vg_glusterfs /dev/sdb1
Volume group "vg_glusterfs" successfully created

root@pve1:~# lvcreate -L 1MB -n lv_vms vg_glusterfs
Rounding up size to full physical extent 4.00 MiB
Logical volume "lv_vms" created.