Sometimes there is a need to add another disk to your system. This is where Logical Volume Management (LVM) comes in handy. The cool thing about LVM is that it’s fairly flexible. There are several ways to add a disk. This article describes one way to do it.
### Heads up!
This article does not cover the process of physically installing a new disk drive into your system. Consult your system and disk documentation on how to do that properly.
**Important:** Always make sure you have backups of important data. The steps described in this article will destroy data if it already exists on the new disk.
### Good to know
This article doesn’t cover every LVM feature deeply; the focus is on adding a disk. But basically, LVM has _volume groups_, made up of one or more partitions and/or disks. You add the partitions or disks as _physical volumes_. A volume group can be broken down into many _logical volumes_. Logical volumes can be used as any other storage for filesystems, ramdisks, etc. More information can be found [here][2].
Think of the _physical volumes_ as forming a pool of storage (a _volume group_) from which you then carve out _logical volumes_ for your system to use directly.
### Preparation
Make sure you can see the disk you want to add. Use _lsblk_ prior to adding the disk to see what storage is already available or in use.
```
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
zram0 251:0 0 989M 0 disk [SWAP]
vda 252:0 0 20G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 19G 0 part
└─fedora_fedora-root 253:0 0 19G 0 lvm /
```
This article uses a virtual machine with virtual storage. Therefore the device names start with _vda_ for the first disk, _vdb_ for the second, and so on. The name of your device may be different. Many systems will see physical disks as _sda_ for the first disk, _sdb_ for the second, and so on.
Once the new disk has been connected and your system is back up and running, use _lsblk_ again to see the new block device.
```
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
zram0 251:0 0 989M 0 disk [SWAP]
vda 252:0 0 20G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 19G 0 part
└─fedora_fedora-root 253:0 0 19G 0 lvm /
vdb 252:16 0 10G 0 disk
```
There is now a new device named _vdb_. The location for the device is _/dev/vdb_.
```
$ ls -l /dev/vdb
brw-rw----. 1 root disk 252, 16 Nov 24 12:56 /dev/vdb
```
We can see the disk, but we cannot use it with LVM yet. If you run _blkid_ you should not see it listed. For this and following commands, you’ll need to ensure your system is [configured so you can use _sudo_][3]:
Initialize the disk using _pvcreate_. You need to pass the full path to the device. In this example it is _/dev/vdb_; on your system it may be _/dev/sdb_ or another device name.
```
$ sudo pvcreate /dev/vdb
Physical volume "/dev/vdb" successfully created.
```
You should see the disk has been initialized as an LVM2_member when you run _blkid_:
We now have 24G available to the logical volume. Look at the _/_ filesystem.
```
$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/fedora_fedora-root 19G 1.4G 17G 8% /
```
We are still showing only 19G free. This is because the logical volume is not the same as the filesytem. To use the new space added to the logical volume, resize the filesystem.
```
$ sudo resize2fs /dev/fedora_fedora/root
resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /dev/fedora_fedora/root is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 3
The filesystem on /dev/fedora_fedora/root is now 6290432 (4k) blocks long.
```
Look at the size of the filesystem.
```
$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/fedora_fedora-root 24G 1.4G 21G 7% /
```
As you can see, the root file system _(/)_ has taken all of the space available on the logical volume and no reboot was needed.
You have now initialized a disk as a physical volume, and extended the volume group with the new physical volume. After that you increased the size of the logical volume, and resized the filesystem to use the new space from the logical volume.