Features:
1. Ability to create volume sets and stripe sets
2. LVM masks the underlying physical technology (ATA,ATAPI,IDE,SCSI,SATA,PATA,etc.)
3. LVM represents storage using a hierarchy:
a. Volume groups
a1. Physical volumes (/dev/sda2, /dev/sdb2, etc.)
b. Logical Volumes
b1. File systems
3. LVM physical volumes can be of various sizes
4. Ability to resize volumes on the fly
Note: Volume groups join: physical volumes (PVs) and Logical Volumes (LVs)
6 Steps to setup LVM:
1. Create LVM partitions via fdisk or parted
a. fdisk /dev/sda, /dev/sdb, /dev/sdc
b. n
c. p
d. +10G
e. t - change to type '8e' (LVM)
f. w
g. partprobe /dev/sda
2. Create Physical Volumes using 'pvcreate'
a. pvcreate /dev/sda3 /dev/sdb3 /dev/sdc3
3. Create Volume Groups using 'vgcreate'
a. vgcreate volgroup001 /dev/sda3 /dev/sdb3 /dev/sdc3
Note: Volume groups can be segmented into multiple logical volumes
4. Create one or more Logical Volumes
a. lvcreate -L 10GB -n logvolvar1 volgroup001
b. lvcreate -L 10GB -n logvolusr1 volgroup001
5. Create File system on logical volume(s)
a. mke2fs -j /dev/volgroup001/logvolvar1
b. mke2fs -j /dev/volgroup001/logvolusr1
6. Mount logical volume
a. mkdir /var1
b. mount /dev/volgroup001/logvolvar1 /var1
c. mkdir /usr1
d. mount /dev/volgroup001/logvolusr1 /usr1
Note: Be certain to update: /etc/fstab so that volumes are mounted when the system reboots
3-tiers of LVM display commands include:
a. pvdisplay - physical volumes - represent raw LVM partitions
b. vgdisplay - volume groups - aggregate physical volumes
c. lvdisplay - logical volumes - file systems - mount here
Rename of Logical Volume:
1. lvrename volume_group_name old new - used to rename volumes
Task: Rename 'logvolvar1' to 'logvolopt1'
a. lvrename volgroup001 logvolvar1 logvolopt1
Note: LVM is updated immediately, even while volume is mounted
However, you must remount the logical volume to see the changes
b. umount /var1 && mount /dev/mapper/volgroup001-logvolopt1 /opt1
c. Update /etc/fstab
Remove Logical Volume:
Task: Remove 'logvolusr1' from the logical volume pool
a. umount /usr1
b. lvremove /dev/mapper/volgroup001-logvolusr1
c. use 'lvdisplay' to confirm removal
Resize Logical Volume:
Task: Grow (resize) 'logvolopt1' to 20GB
a. lvresize -L 20GB /dev/volgroup001/logvolopt1
b. lvdisplay - to confirm new size of logical volume
c. df -h - will still reveal the current size
d. Resize the file system to update the INODE table on the logical volume to account for the new storage in 'logvolopt1'
'resize2fs -f -p /dev/volgroup001/logvolopt1'
Note: You may resize file systems online if the following are met:
1. 2.6x kernel series
2. MUST be formatted with ext3
Task: Shrink (resize) 'logvolopt1' to 15GB
a. lvresize -L 15GB /dev/volgroup001/logvolopt1
b. lvdisplay
c. df -h
d. resize2fs -f -p /dev/volgroup001/logvolopt1
Note: online shrinking is not supported
e. df -h
Note: Check disk utilization prior to shrinking to reduce the risk of losing data
LVM GUI Utility:
system-config-lvm
1. Ability to create volume sets and stripe sets
2. LVM masks the underlying physical technology (ATA,ATAPI,IDE,SCSI,SATA,PATA,etc.)
3. LVM represents storage using a hierarchy:
a. Volume groups
a1. Physical volumes (/dev/sda2, /dev/sdb2, etc.)
b. Logical Volumes
b1. File systems
3. LVM physical volumes can be of various sizes
4. Ability to resize volumes on the fly
Note: Volume groups join: physical volumes (PVs) and Logical Volumes (LVs)
6 Steps to setup LVM:
1. Create LVM partitions via fdisk or parted
a. fdisk /dev/sda, /dev/sdb, /dev/sdc
b. n
c. p
d. +10G
e. t - change to type '8e' (LVM)
f. w
g. partprobe /dev/sda
2. Create Physical Volumes using 'pvcreate'
a. pvcreate /dev/sda3 /dev/sdb3 /dev/sdc3
3. Create Volume Groups using 'vgcreate'
a. vgcreate volgroup001 /dev/sda3 /dev/sdb3 /dev/sdc3
Note: Volume groups can be segmented into multiple logical volumes
4. Create one or more Logical Volumes
a. lvcreate -L 10GB -n logvolvar1 volgroup001
b. lvcreate -L 10GB -n logvolusr1 volgroup001
5. Create File system on logical volume(s)
a. mke2fs -j /dev/volgroup001/logvolvar1
b. mke2fs -j /dev/volgroup001/logvolusr1
6. Mount logical volume
a. mkdir /var1
b. mount /dev/volgroup001/logvolvar1 /var1
c. mkdir /usr1
d. mount /dev/volgroup001/logvolusr1 /usr1
Note: Be certain to update: /etc/fstab so that volumes are mounted when the system reboots
3-tiers of LVM display commands include:
a. pvdisplay - physical volumes - represent raw LVM partitions
b. vgdisplay - volume groups - aggregate physical volumes
c. lvdisplay - logical volumes - file systems - mount here
Rename of Logical Volume:
1. lvrename volume_group_name old new - used to rename volumes
Task: Rename 'logvolvar1' to 'logvolopt1'
a. lvrename volgroup001 logvolvar1 logvolopt1
Note: LVM is updated immediately, even while volume is mounted
However, you must remount the logical volume to see the changes
b. umount /var1 && mount /dev/mapper/volgroup001-logvolopt1 /opt1
c. Update /etc/fstab
Remove Logical Volume:
Task: Remove 'logvolusr1' from the logical volume pool
a. umount /usr1
b. lvremove /dev/mapper/volgroup001-logvolusr1
c. use 'lvdisplay' to confirm removal
Resize Logical Volume:
Task: Grow (resize) 'logvolopt1' to 20GB
a. lvresize -L 20GB /dev/volgroup001/logvolopt1
b. lvdisplay - to confirm new size of logical volume
c. df -h - will still reveal the current size
d. Resize the file system to update the INODE table on the logical volume to account for the new storage in 'logvolopt1'
'resize2fs -f -p /dev/volgroup001/logvolopt1'
Note: You may resize file systems online if the following are met:
1. 2.6x kernel series
2. MUST be formatted with ext3
Task: Shrink (resize) 'logvolopt1' to 15GB
a. lvresize -L 15GB /dev/volgroup001/logvolopt1
b. lvdisplay
c. df -h
d. resize2fs -f -p /dev/volgroup001/logvolopt1
Note: online shrinking is not supported
e. df -h
Note: Check disk utilization prior to shrinking to reduce the risk of losing data
LVM GUI Utility:
system-config-lvm