WARNING: Backup your data before attempting this.
First, we’ll check the file system disk space usage and logical volume information:
sudo df -h
sudo lvs

Get the information about newly added hard disk using the following command:
sudo fdisk -l
Note: /dev/sdb is the newly added hard disk!To create the partition on the second Hard disk, use the following command and follow the “on screen” instructions and change the partition type from Linux to LVM (8e):
sudo fdisk /dev/sdb

Identify the already mounted lvm file system type:
df -T

Format the newly created partition using the following command:
sudo mkfs.ext4 /dev/sdb1

Initialize the newly created partition as a physical volume:
sudo pvcreate /dev/sdb1

Check the volume groups using the following command:
sudo vgs
Note: vg_centos6 is the volume group that I want to extend, you can change according to your volume group.Extend the VG (vg_centos6) with new PV (/dev/sdb1):
sudo vgextend vg_centos6 /dev/sdb1

Extend the logical volume (lv_root) with all the free space of the VG(vg_centos6):
sudo lvextend -l +100%FREE /dev/vg_centos6/lv_root

Finally, resize the file-system:
sudo resize2fs /dev/vg_centos6/lv_root

Verify the file-system is larger using the following commands:
sudo df -h
sudo lvs
sudo vgs

Hope this will help you!
No comments:
Post a Comment