TECHIES WORLD

For Techs.... Techniques.... Technologies....

Linux

How to combine two logical volumes that reside on a single physical volume in LVM

LVM is a tool for logical volume management which includes allocating disks, striping, mirroring and resizing logical volumes. With LVM, a hard drive or set of hard drives is allocated to one or more physical volumes. LVM physical volumes can be placed on other block devices which might span two or more disks.

This tutotial explains the steps to combine two logical volumes that reside on a single physical volume in LVM.

Step1: Unmount the logical volume

#umount /dev/myvg/homevol

Step2: Disable the logical volume

#lvchange -an /dev/myvg/homevol

Step3: Remove logical volume

#lvremove /dev/myvg/homevol
    lvremove -- do you really want to remove "/dev/myvg/homevol"? [y/n]: y
    lvremove -- doing automatic backup of volume group "myvg"
    lvremove -- logical volume "/dev/myvg/homevol" successfully

Step4: Extend the logical volume

For example add 12G to existing volume.

#lvextend -L12G /dev/myvg/homevol
    lvextend -- extending logical volume "/dev/myvg/homevol" to 12 GB
    lvextend -- doing automatic backup of volume group "myvg"
    lvextend -- logical volume "/dev/myvg/homevol" successfully extended

Step5: Unmount the file system

#umount /dev/myvg/homevol

Step6: Resize the file system and mount it.

For ext2/ext3,

#resize2fs /dev/myvg/homevol
#mount /dev/myvg/homevol /home

For reiserfs,

#resize_reiserfs /dev/myvg/homevol
#mount -treiserfs /dev/myvg/homevol /home

For xfs,

Note that XFS file systems must be mounted to be resized and the mount-point is specified rather than the device name.

#xfs_growfs /home

for jfs,

Note that Just like XFS the JFS file system must be mounted to be resized and the mount-point is specified rather than the device name.

#mount -o remount,resize /home

That's all....

 

Leave a Reply