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

Extend an LVM volume

Leer en espanol
Extend an LVM volume

Table of contents

LVM is an implementation of a logical volume manager for the Linux kernel. It was originally written in 1998 by Heinz Mauelshagen, which was based on the volume manager ===

What is LVM?

LVM is an implementation of a logical volume manager for the Linux kernel. It was originally written in 1998 by Heinz Mauelshagen, which was based on the Veritas volume manager used on HP-UX systems.

LVM includes many of the features expected from a volume manager, including:

  • Resizing logical groups
  • Resizing logical volumes
  • Read-only snapshots (LVM2 offers read and write)
  • RAID0 of logical volumes.

Once we have reviewed the concepts, let's start:

We check that we have enough free space in our VG

Bash
[rokitoh@redorbita ~]# vgs

VG #PV #LV #SN Attr VSize VFree

vg_www 2 4 0 wz–n- 219.99g 36.28g

As we can see, there are still 36Gb free, so we use the lvextend command to extend the volume.

Bash
[rokitoh@redorbita ~]# lvextend -L+22G /dev/mapper/vg_www-lv_web

Size of logical volume vg_www/lv_web changed from 130.03 GiB (33288 extents) to 162.03 GiB (41480 extents).

Logical volume lv_web successfully resized

Next we only have to expand the file system

Bash
[rokitoh@redorbita ~]# resize2fs /dev/mapper/vg_www-lv_web
resize2fs 1.41.12 (17-May-2010)

Filesystem at /dev/mapper/vg_www-lv_web is mounted on /var/www; on-line resizing required

old desc_blocks = 9, new_desc_blocks = 11

Performing an on-line resize of /dev/mapper/vg_www-lv_web to 42475520 (4k) blocks.

The filesystem on /dev/mapper/vg_www-lv_web is now 42475520 blocks long.

All the best.

:wq!

Comments