###Logical Volume Managment (LVM)###
Features:
1. Volume sets - aggreate storage from disparate sources
2. Resize storage on-the-fly
3. Provision storage as necessary
Tasks:
1. LVM Storage Hierarchy
Logical Volume - configure file system at this level
- Volume Groups - represents one or more physical volumes
- Physical Volumes: (i.e. /dev/sdb4, /dev/sdc3, etc.) - partition, using fdisk or parted: LVM type (8e)
2. Create LVM Storage Hierarchy - 6-Steps
a. Create LVM partitions on available disks
a1. 'parted /dev/sdb'
a2. 'mkpart primary start end'
a3. 'set partition_num lvm on'
a4. 'reboot'
b. 'pvcreate /dev/sdb4 /dev/sdc3' - create physical LVM volumes from partitions
b1. 'pvdisplay'
c. 'vgcreate volgroupvar /dev/sdb4 /dev/sdc3' - allocates both volumes to the volume group
d. 'lvcreate -L 5GB -n logvolvar volgroupvar'
e. 'mke2fs -t ext4 -j /dev/volgroupvar/logvolvar' - overlays EXT4 FS on LVM volume
f. 'mkdir /lvmvar1 && mount /dev/volgroupvar/logvolvar /lvmvar1'
g. Update: '/etc/fstab' for persistence
3. Resize LVMs
a. 'lvresize -L 6GB /dev/volgroupvar/logvolvar'
b. 'resize2fs /dev/volgroupvar/logvolvar 6G'
c. 'lvresize -L 4GB /dev/volgroupvar/logvolvar'
d. 'resize2fs /dev/volgroupvar/logvolvar 4G'
Note: Reductions will likely return errors resulting in re-provisioning of the FS
4. Rename Logical Volume
a. 'lvrename volgroupvar logvolvar logvolopt' - renames volume, NOT volume group
b. 'lvresize -L 6GB /dev/volgroupvar/logvolopt' - restores to 6GB
5. Rename Volume Group
a. 'vgrename volgroupvar volgroupopt' - renames the volume group
b. update: '/etc/fstab' - to reflect volume group name change
6. Assign more partitions(storage) to LVM
a. 'parted /dev/sdc'
b. 'mkpart primary 16.1GB 26.1GB'
c. 'set 4 lvm on'
d. 'pvcreate /dev/sdc4' - assigns LVM partition to LVM management
e. 'vgextend volgroupopt /dev/sdc4' - extends volume group: 'volgroupopt'
f. 'lvresize -L 15GB /dev/volgroupopt/logvolopt' - online resize
g. 'resize2fs /dev/volgroupopt/logvolopt 15G' - online resize
7. LVM GUI
a. 'system-config-lvm'
b. 'ssh -X
[email protected]' - redirects X.org session back to local GUI
c. Extend storage of: '/dev/volgroupopt/logvolopt' to: 16GB
Note: GUI will send appropriate commands to system to:
a. Resize logical volume (logvolopt)
b. Resize EXT4 FS to appropriate size
8. Recreate LVM hierarchy
a. Unmount any partitions tied to: '/dev/sd[bc]'
b. 'parted /dev/sdb' - remove partitions & create new LVM partitions
c. 'init 6' - reboot
d. Use: 'system-config-lvm' to create volume group from: '/dev/sdb1' & '/dev/sdc1'
e. Create logical volume: 'logvolopt'
f. Mount at: '/opt'