Advanced Storage part Flashcards
list availabe physical volumes
sudo pvs
-v for detailed output
list availabel Volume Groups
sudo vgs
explaing Physical Extent and how to see its current setting
An exten is the smallest allocatable unit of space in LVM. Default is 4 MB. In a 20GB physical volume, there would be 5,000 PE’s
sudo vgdisplay rhel | grep ‘PE Size’
list availabel logical volumes
sudo lvs
What is a Logical Extent
a set of physical extents allocated to the logical volume
create a physical volume and volume group
- Make partition - see previous chapter
- Set the flag on the partition to lvm - not required
sudo parted /dev/sdd set 1 lvm on - verify with print
- create PV with sdd1 and sde
sudo pvcreate /dev/sdd1 /dev/sde - Create Volume Group (-s = PE size)
sudo vgcreate -vs 16 vgbook /dev/sdd1 /dev/sde - Verify
sudo vgs vgbook
sudo vgdisplay -v vgbook
sudo pvs
sudo pvdisplay /dev/sdd1
“ “ /dev/sde
create logical volume
- create LV with default name, -L to specify volume size in MB (can specify GB or TB if needed)
sudo lvcreate -vL 120 vgbook
- with a different name and custome logical extent
sudo lvcreate -l 12 -n lvbook1 vgbook
2 verify
sudo lvs
sudo vgdisplay -v vgbook
sudo lvdisplay /dev/vgbook/lvol0
sudo lvdisplay /dev/vgbook/lvbook1
extend VG
sudo vgextend vgbook /dev/sdd2
sudo vgs
extend LV
sudo lvextend -L +144 /dev/vgbook/lvbook1
sudo vgdislplay -v vgbook
rename lvol0 to lvbook2
sudo lvrename vgbook lvol0 lvbook2
reduce size of LV lvbook2
sudo lvreduce -L 50 /dev/vgbook/lvbook2
add storage to LV
sudo lvresize -L +32 /dev/vgbook/lvbook2
(32MB)
remove LV
sudo lvremove /dev/vgbook/lvbook1 -f
***desrtuctive, back up all data!!!
reduce size of VG
then remove VG
sudo vgreduce vgbook /dev/sd1 /dev/sde
removes sdd1 and sde
sudo vgremove vgbook
uninitialize PV
sudo pvremove /dev/sdd1 /dev/sdd2 /dev/sde