As in the previous entry, we are going to see how to extend a logical and physical volume to expand a file system but this time the disk is partitioned
We check how much space the disk has
Bash
fdisk -l /dev/sda2
Disk /dev/sda2: 50 GB, 53687091200 bytesWe rescan the disk
Bash
echo 1 > /sys/block/sdb/device/rescan
echo ‘1’ > /sys/class/scsi_disk/0\:0\:0\:0/device/rescanWe check the disk size again
Bash
fdisk -l /dev/sda2
Disk /dev/sdb: 60 GB, 64424509440 bytesWe create a new primary partition
Bash
fdisk /dev/sda
Orden (m para obtener ayuda): n
Acción de la orden
e Partición extendida
p Partición primaria (1-4)
p
Número de partición (1-4): 3
Primer cilindro (1-19457, valor predeterminado 1):
Último cilindro, +cilindros o +tamaño{K,M,G} (1-3232, valor predeterminado 3232):
Se está utilizando el valor predeterminado 3232
Orden (m para obtener ayuda): t
ex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): wFinally we run partprobe to reread the disks
text
partprobeWe check that we now have a new partition with 10GB
Bash
fdisk -l /dev/sda3
Disk /dev/sda: 10 GB, 10737418240 bytesWe create the physical volume with the new disk
text
pvcreate /dev/sda3We 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_app /dev/sda3
lvextend -l+100%FREE /dev/vg_app/lv_webWe resize the disk
text
resize2fs /dev/mapper/vg_app/lv_webAll the best.
Comments