Extending Linux Root Partition using LVM

      No Comments on Extending Linux Root Partition using LVM

This is a continuation from the previous article Introduction to LVM on Linux.

Run the df -hT command to view disk information

Run fdisk -l command to view a list of all block devices and partitions

As shown above, our current root partition is approx 50GB. We’d like to increase this partition to 100GB.

Shutdown the Server and change the disk size to 100GB from your hypervisor.

In our case the current disk size is 50GB and we want to increase the disk to 100GB.

My environment is ovirt. Therefore I followed the steps below after shutting down the VM.

 

After this, boot up the server and login using ssh.

Run fdisk -l

The block device /dev/sda is now 107.4 GB

We need to create a new partition on this block device. Run fdisk /dev/sda and follow the steps below.

After this, reboot the VM to reload the partition table.

Run vgs command to view volume group information

Next we need to create a physical volume off sda3. Run the command below to create a physical volume.

Now extend the volume group named cl

Run vgs again

This shows us the new size of the volume group

Run lvs

Our root logical volume is still 47GB

Next, we can now extend the root logical volume to use the extra capacity

If we run df -h, the root disk size hasn’t chnaged yet

Therefore, we need to expand the file system

For xfs run xfs_growfs and for ext4 run resize2fs

Run df -h again to confirm the new capacity

 

The following two tabs change content below.

harun

Harun is a System Administrator with proficient knowledge in cloud technologies such as KVM, Cloudstack, Citrix Xen Server, Openstack and VMware Vsphere Suite, Ceph, NFS, ISCSI

Latest posts by harun (see all)

About harun

Harun is a System Administrator with proficient knowledge in cloud technologies such as KVM, Cloudstack, Citrix Xen Server, Openstack and VMware Vsphere Suite, Ceph, NFS, ISCSI

Leave a Reply

Your email address will not be published. Required fields are marked *