Steps:
1. Locate new physical disk.
2. Create new LVM physical volume in the newly added disk.
3. Extend the existing volume group by adding the new LVM physical volume.
4. Extend the concerned logical volume.
5. Resize the filesystem of the logical volume.
1. Locate new physical disk
After adding new disk, reboot the system and run following command:
fdisk -l
Output:
Disk /dev/sdb: .....
The new physical disk is available at /dev/sdb
The new disk can also be found with following command:
lvmdiskscan
2. Create new LVM physical volume in the newly added disk
pvcreate /dev/sdb
Confirm this with following commands:
- pvs
- pvdisplay
- lvmdiskscan -l
3. Extend the existing volume group by adding the new LVM physical volume
vgextend <volume-group-name> /dev/sdb
Find out the name of the existing volume group with following command vgs or vgdisplay
4. Extend the logical volume as required
lvm lvextend -l +100%FREE /dev/<volume group name>/<logical volume name>
example:
lvm lvextend -l +100%FREE /dev/ubuntu-vg/root
5. Resize the filesystem of the logical volume
For ext file system:
resize2fs -p <file system>
For xfs file system
xfs_growfs <file system>
The filesystem details can be found from df -h