The Information Systems and Computer Applications examination covers material that is usually taught in an introductory college-level business information systems course.

Archive for October 9, 2013

Crear un disco LVM repartido entre dos discos físicos

Al crear un disco virtual con LVM, por defecto, se usan los extends (bloques) contiguos de un disco y luego los del otro. Si disponemos de dos controladoras y por lo tanto, acceso paralelo al medio, nos puede interesar repartir el disco virtual entre los discos físicos.

Vamos a suponer el siguiente volume group con dos discos físicos:

# vgdisplay -v
    Finding all volume groups
    Finding volume group "local"
  --- Volume group ---
  VG Name               local
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               1.99 GiB
  PE Size               4.00 MiB
  Total PE              510
  Alloc PE / Size       0 / 0   
  Free  PE / Size       510 / 1.99 GiB
  VG UUID               vAxoWU-VZfd-dJ6J-l0el-UFHX-RKeR-1qHkzh
   
 --- Physical volumes ---
PV Name /dev/loop0 PV UUID VbndMI-aDP2-zlDc-uW5z-c07r-zZSo-21Wkmz
PV Status allocatable
Total PE / Free PE 255 / 255
PV Name /dev/loop1 PV UUID RppzLL-b1aZ-2OLB-Zb0Q-1QyG-U8WM-IHQejd
PV Status allocatable
Total PE / Free PE 255 / 255

Si creamos un disco virtual de la mitad del tamaño libre:

# lvcreate -n test1 -l50%free local
  Logical volume "test1" created

Podemos ver con vgdisplay que se han usado los extends del primer disco y ninguno del segundo disco físico:

# vgdisplay -v
    Finding all volume groups
    Finding volume group "local"
  --- Volume group ---
  VG Name               local
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               1.99 GiB
  PE Size               4.00 MiB
  Total PE              510
  Alloc PE / Size       255 / 1020.00 MiB
  Free  PE / Size       255 / 1020.00 MiB
  VG UUID               vAxoWU-VZfd-dJ6J-l0el-UFHX-RKeR-1qHkzh
   
(...)
   
 --- Physical volumes ---
PV Name /dev/loop0 PV UUID VbndMI-aDP2-zlDc-uW5z-c07r-zZSo-21Wkmz
PV Status allocatable
Total PE / Free PE 255 / 0
PV Name /dev/loop1 PV UUID RppzLL-b1aZ-2OLB-Zb0Q-1QyG-U8WM-IHQejd
PV Status allocatable
Total PE / Free PE 255 / 255

Mediante la opción -i, podemos indicar entre el número de discos a repartir los extends que se usen. En la documentación de CentOS hay este gráfico que lo explica perfectamente:

LVM repartiendo entre discos virtuales

LVM repartiendo entre discos virtuales

Por lo que si repartimos entre los dos discos que tenemos, con la opción -i2:

# lvcreate -n test2 -l50%free -i2 local
  Using default stripesize 64.00 KiB
  Rounding size (255 extents) up to stripe boundary size (256 extents)
  Logical volume "test2" created

Podemos ver como ha cogido la mitad del disco de cada disco físico:

[root@dylan ~]# vgdisplay -v
    Finding all volume groups
    Finding volume group "local"
  --- Volume group ---
  VG Name               local
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               1.99 GiB
  PE Size               4.00 MiB
  Total PE              510
  Alloc PE / Size       256 / 1.00 GiB
  Free  PE / Size       254 / 1016.00 MiB
  VG UUID               vAxoWU-VZfd-dJ6J-l0el-UFHX-RKeR-1qHkzh
   
(...)
   
 --- Physical volumes ---
PV Name /dev/loop0 PV UUID VbndMI-aDP2-zlDc-uW5z-c07r-zZSo-21Wkmz
PV Status allocatable
Total PE / Free PE 255 / 127
PV Name /dev/loop1 PV UUID RppzLL-b1aZ-2OLB-Zb0Q-1QyG-U8WM-IHQejd
PV Status allocatable
Total PE / Free PE 255 / 127

Tags:

Relacionados

Crear un disco LVM repartido entre dos discos físicos was first posted on October 9, 2013 at 8:18 am.