Suppose we have already configured LVM, for example, as I described in this article – Setting up and using LVM
Switch to the root user:
sudo -i
If there is no hot-swap drive, turn off the server, connect a new disk, turn on the server and look at the name of the new disk (in my case it’s /dev/sdd):
fdisk -l
Let’s see the existing groups and how much space is left:
vgdisplay
Let’s see a list of physical volumes:
pvdisplay
Let’s start marking a new disk:
fdisk /dev/sdd n p 1 Enter Enter t 8e w
Now create a physical volume:
pvcreate /dev/sdd1
Let’s see a list of logical volumes:
lvdisplay
We extend it by adding a new partition (where ixnfo is a volume group):
vgextend ixnfo /dev/sdd1
See the list of physical volumes as follows:
pvscan
Let’s look at the path of the logical volume (in my case /dev/ixnfo/temp) and add a new section:
lvextend /dev/ixnfo/temp /dev/sdd1
Let’s see the size of the mounted logical volume:
df -h
So the size did not change, we’ll fix it with the command:
resize2fs /dev/ixnfo/temp
Done.