How to add new drive to Linux LVM

 

Let's say you had existing LVM configured. You also had only 2 partitions - root and swap, and now you ran out of space. You will need to extend your root partition.

Process:

 

Manually add physical drive to the system. Let it register.

List existing drives.

fdisk -l 

Create partition with the size equal to the physical hard disk size. Let's say we added 8GB drive, then we will need to format and create and format 8GB partition using fdisk utility. Keep in mind that you will need 8e - Linux LVM partition.

fdisk /dev/hdb 

Once formated, then we need to create Physical Volume out of it.

pvcreate /dev/hdb 

Verify creating of the physical volume

[root@rhel5 ~]# pvdisplay 
--- Physical volume ---
PV Name /dev/hdb
VG Name VolGroup00
PV Size 8.00 GB / not usable 32.00 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 255
Free PE 0
Allocated PE 255
PV UUID 2AsLK9-wAU1-bsHd-1eEZ-NqwU-Mzcf-QtAb3U

Now let's add our drive to the existing VolGroup00.

vgextend VolGroup00 /dev/hdb

 

Verify:

[root@rhel5 ~]# vgdisplay  

Extend LogVol00 by 8 GB

lvextend -L+8G /dev/VolGroup00/LogVol00 

Resize filesystem

resize2fs /dev/VolGroup00/LogVol00 

Check disk space

df -ah 

Moving your apps to Amazon or Miscrosoft Clouds?

We can help you analyze your existing infrastructure, identify the cost savings we can achieve by migrating to a cloud provider. We can then execute end-to-end migration plan of your infrastructure and bringing down your TCO.

Cloud Computing

Ready for IPv6 Migration?

The Internet is running out of the equivalent of phone numbers - familiar problem, non-trivial solution.

The world has to move to IPv6, with its 128-bit addresses. But that's easier said than done.

IPv6 Migration

Are you fluent in "Linux"?

Learn Linux from a leading expert and quickly master you Linux skills.

Learn how to simplify your workflow and increase your productivity using tips and techniques of the pros.

Ideal training for Corporate IT Beginners and Advanced IT Admins alike.

Corporate Linux Training

Who's Online

We have 9 guests and no members online