Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

Add a new disk to an existing volume

Leer en espanol
Add a new disk to an existing volume

Table of contents

Once the disk is added, media ===

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.

text
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 0

If the disk is not detected, we proceed to perform a scan.

Bash
echo – – – > /sys/class/scsi_host/host0/scan

We create the physical volume with the new disk

text
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

 

text
vgextend vg_datos  /dev/sdf

We verify using the lvscan command the LV to which we want to add the new disk

text
lvscan
ACTIVE            ‘/dev/system/lv_root’ [10.00 GB] inherit
ACTIVE            ‘/dev/datos/lv_datos’ [100.00 GB] inherit

We extend the volume with the size we want

text
lvextend -L +10G  /dev/datos/lv_datos

We resize the disk

text
resize2fs /dev/mapper/datos/lv_datos

  In the case of Suse it could give us the following error:

text
/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