In this entry we are going to see how to add a new disk to an existing volume to increase the size of the VG since there is no free space left to increase more space.
Once the disk has been added, using the dmesg command we try to check if it has been detected.
sdf: Write Protect is off
sdf: Mode Sense: 31 00 00 00
sdf: cache data unavailable
sdf: assuming drive cache: write through
SCSI device sdf: 104857600 512-byte hdwr sectors (53687 MB)
sdf: Write Protect is off
sdf: Mode Sense: 31 00 00 00
sdf: cache data unavailable
sdf: assuming drive cache: write through
sdf: unknown partition table
sd 0:0:5:0: Attached scsi disk sdf
sd 0:0:5:0: Attached scsi generic sg5 type 0If the disk is not detected, we proceed to perform a scan.
echo – – – > /sys/class/scsi_host/host0/scanWe create the physical volume with the new disk
pvcreate /dev/sdb1
We add the disk to the VG
To check the VG where we want to add the disk we use the vgdisplay command
vgextend vg_datos /dev/sdfWe verify using the lvscan command the LV to which we want to add the new disk
lvscan
ACTIVE ‘/dev/system/lv_root’ [10.00 GB] inherit
ACTIVE ‘/dev/datos/lv_datos’ [100.00 GB] inheritWe extend the volume with the size we want
lvextend -L +10G /dev/datos/lv_datosWe resize the disk
resize2fs /dev/mapper/datos/lv_datosIn the case of Suse it could give us the following error:
/dev/mapper/vuelingprd-lv_oracle_VLP_sapdata3 is mounted; can’t resize a mounted filesystem!To solve the problem we execute the following command.
resize_reiserfs /dev/mapper/data/lv_data
All the best.
Comments