====== 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.