---
title: >-
  Extending LVM
date: 2021-11-21 22:58:00
modified: 2026-05-23 09:11:49
lang: en
authors: Piotr Pelica
url: https://status.pelica.net/en/extending-lvm
tags:
 - notes
 - technology
 - self-hosting
 - homelab
 - linux
status: published
---

# Extending LVM

Check current virtual groups, physical and logical disks:

```bash
vgs
pvs
lvdisplay
```

Find disks and compare with output from `pvs` to find out which one was just added (which one is not used):

```bash
fdisk -l
```

Knowing that, create a partition:

```bash
fdisk /dev/sdf   # replace /dev/sdf with the new one
n                # new partition
p                # primary
### Then those are defaults to use the whole drive ###
t                # set partition type...
8e               # ...to Linux LVM
p                # show changes
w                # write changes
```

Create physical drive:

```bash
pvcreate /dev/sdf1
```

Add to the `vg0` group:

```bash
vgextend vg0 /dev/sdf1
```

Extend the group:

```bash
lvm lvextend -l +100%FREE /dev/vg0/lv-0
```

Resize filesystem:

```bash
resize2fs -p /dev/mapper/vg0-lv--0
```

Confirm changes:

```bash
df -h
```
