There is a point to this story, but it has temporarily escaped my mind...
Contact Me MyFaceBook MyLinkedIn MyGitHub MyTwitter

Logical Volume Manager (LVM) Management

Logical Volume Manager (LVM) is used in Linux to abstract the filesystems away from the physical disk they sit on.

Mounting Volume Groups

Volumes can be grown online BUT cannot be reduced online. In order to reduce a volume group, the volume must be unmounted. For volumes containing the root file system, you need to boot using a live boot CD. Once the live CD is loaded, you can activate the Volume Groups by typing:

vgchange -a y

Grow Volume

Check file system

e2fsck -f /dev/vgNAME/lvNAME

Extend the logical volume. For example, to increase the file system from 15G to 20G:

lvextend -L +5 /dev/vgNAME/lvNAME

ext3 file systems can be grown on-line.

ext2online -v /dev/vgNAME/lvNAME

Others file systems will need to resized while the file system is unmounted.

resize2fs -p /dev/vgNAME/lvNAME

Check file system

e2fsck -f /dev/vgNAME/lvNAME

Reduce Volume

REDUCE THE FILESYSTEM FIRST

If you reduce the size of the logical volume without first reducing the size of the file system, reduction will not work, since the file system will be incorrect after the volume is reduced.

Check file system

e2fsck -f /dev/vgNAME/lvNAME

Resize the file system. For example, resize the file system from 20G to 15G.

resize2fs -p /dev/vgNAME/lvNAME 15G

Reduce the size of the logical Volume, in our example 20G to 15G is 5GB difference.

lvreduce -L -5G /dev/vgNAME/lvNAME

Check file system again

e2fsck -f /dev/vgNAME/lvNAME

Adding a New Disk

fdisk new disk and create primary partition of entire disk and set the partition type to be linux LVM (8e). Add partition to LVM.

pvcreate /dev/cciss/c1d2p1

Either create a new Volume group

vgcreate vgNEWNAME /dev/cciss/c1d2p1

or extend an existing Volume Group

vgextend vgNAME /dev/cciss/c1d2p1

Then, either create a new logical volume

lvcreate -L 120G -n lvNEWNAME vgNAME

or use the “Grow Volume” to resize a logical volume to use the new drive.

Copyright © 2022 by Julian Easterling. SOME RIGHTS RESERVED.
Privacy Policy              Terms of Use             


Creative Commons License
Except where otherwise noted, content on this site is
licensed under a Creative Common Attribution-Share Alike 4.0 International License.


All of the opinions expressed on this website are those of Julian Easterling and
do not represent the views of any of my current and previous clients or employers in any way.

If you notice an error on the site or content that has not been properly attributed, bring
it to my attention using the contact page and I will endeavor to fix it as soon as I can.

I accept no responsibility or liability for any damages incurred by following any of
my advice or by using any of the information on my site or of those sites that I link to.