Expandindo Local Storage no Xen 6

E ai galera aqui eu vou demonstrar como podemos expandir o local storage no Xen Server 6, quando utilizamos um Xen Server em stand alone geralmente o armazenamento das VMs fica no local storage com isso as vezes precisamos aumentar esta área de armazenamento que é um VG ;)

Acrescente um novo disco no Xen Server.

Após inserir um novo disco vamos mandar o Xen listar o novo disco

fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 64.4 GB, 64424509440 bytes
256 heads, 63 sectors/track, 7801 cylinders
Units = cylinders of 16128 * 512 = 8257536 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        7802    62914559+  ee  EFI GPT

Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

O Xen reconheceu um novo disco de 32.2 GB, agora vamos mandar listar os nossos grupos de volumes

vgdisplay -v
    Finding all volume groups
    Finding volume group "VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4"
  --- Volume group ---
  VG Name               VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  12
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               51.99 GB
  PE Size               4.00 MB
  Total PE              13309
  Alloc PE / Size       2055 / 8.03 GB
  Free  PE / Size       11254 / 43.96 GB
  VG UUID               Jy3G3l-Wq0c-PR9T-eypB-CbmX-Tl3V-FB974H
   
  --- Logical volume ---
  LV Name                /dev/VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4/MGT
  VG Name                VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4
  LV UUID                eZsVES-buwZ-0umA-5So3-cVJR-X42L-6ATFop
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                4.00 MB
  Current LE             1
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1024
  Block device           252:0
   
  --- Logical volume ---
  LV Name                /dev/VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4/VHD-e822caa5-f42c-4d49-9264-8ca3216f6fd3
  VG Name                VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4
  LV UUID                jMoVQn-hKeb-B9lm-QTjo-8tMk-ofIn-PPCYg1
  LV Write Access        read/write
  LV Status              NOT available
  LV Size                8.02 GB
  Current LE             2054
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
   
  --- Physical volumes ---
  PV Name               /dev/sda3     
  PV UUID               9VkHhh-SYEY-x4zV-fvOF-45AI-3qkY-dF8bgj
  PV Status             allocatable
  Total PE / Free PE    13309 / 11254

Neste grupo de volumes temos somente uma partição fazendo parte dele que é /dev/sda3.

Para acrescentar um novo disco no grupo de volumes precisamos do seu nome que neste caso é VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4, notem que o tamanho do VG é 51.99 GB.

Agora vamos efetuar a expansão do grupo de volumes agora.

vgextend -v VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4 /dev/sdb
    Checking for volume group "VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4"
  No physical volume label read from /dev/sdb
    Set up physical volume for "/dev/sdb" with 62914560 available sectors
    Zeroing start of device /dev/sdb
  Physical volume "/dev/sdb" successfully created
    Adding physical volume '/dev/sdb' to volume group 'VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4'
    Volume group "VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4" will be extended by 1 new physical volumes
    Creating volume group backup "/etc/lvm/backup/VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4" (seqno 13).
  Volume group "VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4" successfully extended

Agora vamos mandar listar novamente o grupo de volumes

vgdisplay -v
    Finding all volume groups
    Finding volume group "VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4"
  --- Volume group ---
  VG Name               VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  13
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               81.98 GB
  PE Size               4.00 MB
  Total PE              20988
  Alloc PE / Size       2055 / 8.03 GB
  Free  PE / Size       18933 / 73.96 GB
  VG UUID               Jy3G3l-Wq0c-PR9T-eypB-CbmX-Tl3V-FB974H
   
  --- Logical volume ---
  LV Name                /dev/VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4/MGT
  VG Name                VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4
  LV UUID                eZsVES-buwZ-0umA-5So3-cVJR-X42L-6ATFop
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                4.00 MB
  Current LE             1
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1024
  Block device           252:0
   
  --- Logical volume ---
  LV Name                /dev/VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4/VHD-e822caa5-f42c-4d49-9264-8ca3216f6fd3
  VG Name                VG_XenStorage-9f43fd7b-92c1-00a1-6eba-ebea622c56c4
  LV UUID                jMoVQn-hKeb-B9lm-QTjo-8tMk-ofIn-PPCYg1
  LV Write Access        read/write
  LV Status              NOT available
  LV Size                8.02 GB
  Current LE             2054
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
   
  --- Physical volumes ---
  PV Name               /dev/sda3     
  PV UUID               9VkHhh-SYEY-x4zV-fvOF-45AI-3qkY-dF8bgj
  PV Status             allocatable
  Total PE / Free PE    13309 / 11254
   
  PV Name               /dev/sdb     
  PV UUID               Uh0E4U-vq6d-QeF4-2m03-ygC5-Z2Dk-rV5W0q
  PV Status             allocatable
  Total PE / Free PE    7679 / 7679

Agora o nosso grupo de volumes tem dois dispositivos que são /dev/sda3 e /dev/sdb e agora o grupo de volumes tem 81.98 GB é o que vai estar disponível para a criação de novas VMs.

Agora somente precisamos mandar fazer um scan no dispositivo Local Storage, vamos listar os dispositivos

xe sr-list 
uuid ( RO)                : 9f43fd7b-92c1-00a1-6eba-ebea622c56c4
          name-label ( RW): Local storage
    name-description ( RW): 
                host ( RO): xen01
                type ( RO): lvm
        content-type ( RO): user


uuid ( RO)                : d6db0f72-5b2c-17bf-1b33-a06622936b29
          name-label ( RW): DVD drives
    name-description ( RW): Physical DVD drives
                host ( RO): xen01
                type ( RO): udev
        content-type ( RO): iso


uuid ( RO)                : 7838edbb-f9e8-8591-568c-4a19ceb085fb
          name-label ( RW): XenServer Tools
    name-description ( RW): XenServer Tools ISOs
                host ( RO): xen01
                type ( RO): iso
        content-type ( RO): iso


uuid ( RO)                : ff76927c-3fba-3dbe-0689-ab241f377557
          name-label ( RW): Removable storage
    name-description ( RW): 
                host ( RO): xen01
                type ( RO): udev
        content-type ( RO): disk

Agora vamos mandar dar um scan no Local storage para que ele reconheça o novo tamanho do VG

xe sr-scan uuid=9f43fd7b-92c1-00a1-6eba-ebea622c56c4 

Agora vamos mandar dar um update nele

xe sr-update uuid=9f43fd7b-92c1-00a1-6eba-ebea622c56c4

Pronto o Xen já vai estar reconhecendo o Local Storage com o novo tamanho.

Referências