Difference between revisions of "LVM"

From Define Wiki
Jump to navigation Jump to search
(Intro)
 
m (LVM2 expanding of xfs file system.)
 
Line 1: Line 1:
 
LVM (specifically LVM2) is well supported by Red Hat/CentOS and is documented at https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/index
 
LVM (specifically LVM2) is well supported by Red Hat/CentOS and is documented at https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/index
 +
 +
= Initial Setup =
 +
 +
 +
<syntaxhighlight>
 +
parted /dev/sdX print # delete partitions with "rm <number>" if needed
 +
parted /dev/sdX mklabel gpt
 +
parted /dev/sdX mkpart LVM xfs 0% 100%
 +
parted /dev/sdX print
 +
pvdisplay
 +
pvcreate /dev/sdX1
 +
pvdisplay
 +
vgdisplay
 +
vgcreate vol_home /dev/sdX1
 +
vgdisplay
 +
lvcreate -l 100%FREE -n lv_home vol_home
 +
lvdisplay
 +
mkfs.xfs /dev/vol_home/lv_home
 +
mkdir /mnt/home_scalable
 +
chmod 555 /mnt/home_scalable
 +
mount /dev/vol_home/lv_home /mnt/home_scalable
 +
</syntaxhighlight>
 +
 +
= Expanding =
 +
 +
<syntaxhighlight>
 +
vgextend vol_home /dev/sdY1
 +
 +
lvextend -l 100%VG /dev/vol_home/lv_home
 +
 +
xfs_growfs /dev/vol_home/lv_home
 +
</syntaxhighlight>

Latest revision as of 15:30, 9 January 2018

LVM (specifically LVM2) is well supported by Red Hat/CentOS and is documented at https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/index

Initial Setup

parted /dev/sdX print # delete partitions with "rm <number>" if needed
parted /dev/sdX mklabel gpt
parted /dev/sdX mkpart LVM xfs 0% 100%
parted /dev/sdX print
pvdisplay
pvcreate /dev/sdX1
pvdisplay
vgdisplay
vgcreate vol_home /dev/sdX1
vgdisplay
lvcreate -l 100%FREE -n lv_home vol_home
lvdisplay
mkfs.xfs /dev/vol_home/lv_home
mkdir /mnt/home_scalable
chmod 555 /mnt/home_scalable
mount /dev/vol_home/lv_home /mnt/home_scalable

Expanding

vgextend vol_home /dev/sdY1

lvextend -l 100%VG /dev/vol_home/lv_home

xfs_growfs /dev/vol_home/lv_home