Categories
SysOps

How to extend LVM logical volume without free space on the root partition

Extend LVM logical volume without free space on the root partition.

Sometimes you can encounter such a problem when there is no free space on the root partition, so the volume group configuration backup cannot be created in /etc/lvm/archive directory.

$ lvextend --extents +100%FREE /dev/mapper/vg01-root
Couldn't create temporary archive name.

The solution is to disable the metadata backup.

$ lvextend --autobackup n --extents +100%FREE /dev/mapper/vg01-root
Size of logical volume vg01/root changed from 20 GiB (5120 extents) to <36.00 GiB (9215 extents).
WARNING: The metadata update is NOT backed up.
Logical volume vg01/root successfully resized.

So you extend LVM logical volume and resize the filesystem.

Additional notes

Sample metadata backup.

# cat /etc/lvm/archive/vgbackup_00001-687854914.vg 
# Generated by LVM2 version 2.03.07(2) (2019-11-30): Wed Feb 17 00:12:27 2021

contents = "Text Format Volume Group"
version = 1

description = "Created *before* executing 'lvcreate -n backup -l +100%FREE vgbackup'"

creation_host = "desktop"       # Linux desktop 5.8.0-43-generic #49-Ubuntu SMP Fri Feb 5 03:01:28 UTC 2021 x86_64
creation_time = 1613517147      # Wed Feb 17 00:12:27 2021

vgbackup {
        id = "TdI3hV-Nh3D-LFrL-pqrY-0T4K-HGfe-zSeqkI"
        seqno = 1
        format = "lvm2"                 # informational
        status = ["RESIZEABLE", "READ", "WRITE"]
        flags = []
        extent_size = 8192              # 4 Megabytes
        max_lv = 0
        max_pv = 0
        metadata_copies = 0

        physical_volumes {

                pv0 {
                        id = "9BAkBH-C2uE-k80V-1KfN-bjhm-HVmi-c4xoR9"
                        device = "/dev/mapper/sda_crypt"        # Hint only

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 1953492400   # 931,498 Gigabytes
                        pe_start = 2048
                        pe_count = 238463       # 931,496 Gigabytes
                }
        }
}