Añadir disco a VolumGroup

    En este capítulo vamos a añadir espacio al actual Logical Volum (root) del VolumGroup (system) que tiene un total de 53% libre (51Gb)

    Vemos el espacio:

    [root@RHEL8 tmp]# df -h
    Filesystem               Size  Used Avail Use% Mounted on
    devtmpfs                 953M     0  953M   0% /dev
    tmpfs                    973M     0  973M   0% /dev/shm
    tmpfs                    973M   21M  952M   3% /run
    tmpfs                    973M     0  973M   0% /sys/fs/cgroup
    /dev/mapper/system-root   51G   39G   13G  76% /
    /dev/sda1                495M  259M  237M  53% /boot
    tmpfs                    195M     0  195M   0% /run/user/0
    

    Y los discos:

    [root@RHEL8 tmp]# fdisk -l | grep Disk | grep bytes
    Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
    Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
    Disk /dev/sdc: 15 GiB, 16106127360 bytes, 31457280 sectors
    Disk /dev/mapper/system-root: 51 GiB, 54723084288 bytes, 106881024 sectors
    Disk /dev/mapper/system-swap: 2 GiB, 2181038080 bytes, 4259840 sectors
    

    Ahora, añadiremos un nuevo disco. En este caso con VMWare:

    En la imagen se aprecia que tenemos 3 discos por lo que si añadimos uno adicional, deberemos de ver un dispositivo nuevo llamado /dev/sdd.
    Volvemos a verificar los discos del equipo:

    [root@RHEL8 tmp]# fdisk -l | grep Disk | grep bytes
    Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
    Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
    Disk /dev/sdc: 15 GiB, 16106127360 bytes, 31457280 sectors
    Disk /dev/mapper/system-root: 51 GiB, 54723084288 bytes, 106881024 sectors
    Disk /dev/mapper/system-swap: 2 GiB, 2181038080 bytes, 4259840 sectors
    

    Oh! El disco no está. Donde está? Bien, el motivo es que hay que hacer un rescan de los discos. Lo haremos con el siguiente comando:

    [root@RHEL8 tmp]# ls /sys/class/scsi_host/ | while read host ; do echo "- - -" > /sys/class/scsi_host/$host/scan ; done
    

    Ahora si. Tenemos disco. Ya lo vemos en /dev/sdd y sus respectivos 10 GiB:

    [root@RHEL8 tmp]# fdisk -l | grep Disk | grep bytes
    Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
    Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
    Disk /dev/sdc: 15 GiB, 16106127360 bytes, 31457280 sectors
    Disk /dev/mapper/system-root: 51 GiB, 54723084288 bytes, 106881024 sectors
    Disk /dev/mapper/system-swap: 2 GiB, 2181038080 bytes, 4259840 sectors
    Disk /dev/sdd: 10 GiB, 10737418240 bytes, 20971520 sectors
    

    Ahora crearemos un Physical Volume para /dev/sdd:

    [root@RHEL8 tmp]# pvcreate /dev/sdd
      Physical volume "/dev/sdd" successfully created.
    

    Extenderemos el VolumGroup (system) ya existente con el dispositivo /dev/sdd:

    [root@RHEL8 tmp]# vgextend system /dev/sdd
      Volume group "system" successfully extended
    

    Añadiremos todo el espacio del nuevo disco al Logical Volume (root):

    [root@RHEL8 tmp]# lvextend -l +100%FREE /dev/system/root
      Size of logical volume system/root changed from 50.96 GiB (13047 extents) to 61.95 GiB (15860 extents).
      Logical volume system/root successfully resized.
    

    Y una vez añadido, tendremos que forzar su escritura en el sistema de ficheros actual (xfs) para redimensionar su espacio

    [root@RHEL8 tmp]# xfs_growfs /dev/system/root
    meta-data=/dev/mapper/system-root isize=512    agcount=8, agsize=1767168 blks
             =                       sectsz=512   attr=2, projid32bit=1
             =                       crc=1        finobt=1, sparse=1, rmapbt=0
             =                       reflink=1    bigtime=0 inobtcount=0
    data     =                       bsize=4096   blocks=13360128, imaxpct=25
             =                       sunit=0      swidth=0 blks
    naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
    log      =internal log           bsize=4096   blocks=3451, version=2
             =                       sectsz=512   sunit=0 blks, lazy-count=1
    realtime =none                   extsz=4096   blocks=0, rtextents=0
    data blocks changed from 13360128 to 16240640
    

    Fin. Ahora ya vemos que el Logical Volum (root) del VolumGroup (system) ya tiene 10 Gib, pasando al 63% libre con 62 GiB de espacio total:

    [root@RHEL8 tmp]# df -h
    Filesystem               Size  Used Avail Use% Mounted on
    devtmpfs                 953M     0  953M   0% /dev
    tmpfs                    973M     0  973M   0% /dev/shm
    tmpfs                    973M   21M  952M   3% /run
    tmpfs                    973M     0  973M   0% /sys/fs/cgroup
    /dev/mapper/system-root   62G   39G   24G  63% /
    /dev/sda1                495M  259M  237M  53% /boot
    tmpfs                    195M     0  195M   0% /run/user/0
    

    Leave a Reply

    Your email address will not be published. Required fields are marked *