Differences
This shows you the differences between two versions of the page.
linux_wiki:extend_existing_logical_volumes [2016/03/03 22:00] billdozor [Extend a volume group] |
linux_wiki:extend_existing_logical_volumes [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Extend Existing Logical Volumes ====== | ||
- | |||
- | **General Information** | ||
- | |||
- | Expanding existing logical volumes non-destructively. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Basic LVM Setup ===== | ||
- | |||
- | **Create single partition on a new disk** | ||
- | <code bash> | ||
- | fdisk /dev/sdb | ||
- | n (new partition) | ||
- | (use defaults) | ||
- | t (change type) | ||
- | 8e (Linux LVM) | ||
- | w (write changes and quit) | ||
- | </ | ||
- | |||
- | \\ | ||
- | **Create physical volume** | ||
- | <code bash> | ||
- | pvcreate /dev/sdb1 | ||
- | pvdisplay | ||
- | </ | ||
- | |||
- | \\ | ||
- | **Create volume group** | ||
- | <code bash> | ||
- | vgcreate vglocal /dev/sdb1 | ||
- | vgdisplay | ||
- | </ | ||
- | |||
- | \\ | ||
- | **Create logical volume** | ||
- | <code bash> | ||
- | lvcreate -n lvstorage -L 20G vglocal | ||
- | lvdisplay | ||
- | </ | ||
- | |||
- | \\ | ||
- | **Create XFS Filesystem** | ||
- | <code bash> | ||
- | mkfs -t xfs / | ||
- | </ | ||
- | |||
- | \\ | ||
- | **Mount the volume** | ||
- | <code bash> | ||
- | mkdir -p / | ||
- | mount / | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Extend a volume group ===== | ||
- | |||
- | **Create a partition on a new disk** | ||
- | <code bash> | ||
- | gdisk /dev/sdc | ||
- | (same defaults + lvm type change as basic setup) | ||
- | </ | ||
- | |||
- | \\ | ||
- | **Create physical volume from created partition** | ||
- | <code bash> | ||
- | pvcreate /dev/sdc1 | ||
- | </ | ||
- | |||
- | \\ | ||
- | **Extend the " | ||
- | <code bash> | ||
- | vgextend vglocal /dev/sdc1 | ||
- | pvs | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | |||
- | |||
- | ==== Extend a logical volume ==== | ||
- | |||
- | **Extend volume to be 30G in size(from 20G original)** | ||
- | <code bash> | ||
- | lvextend -L 30G --resizefs / | ||
- | OR | ||
- | lvextend -L +10G --resizefs / | ||
- | </ | ||
- | * df -h shows that filesystem still needs to be resized to fill the LV container | ||
- | |||
- | \\ | ||
- | **Resize the filesystem - if you did NOT use the " | ||
- | <code bash> | ||
- | xfs_growfs / | ||
- | </ | ||
- | * If EXT filesystem, use: resize2fs / | ||
- | |||
- | ---- | ||