Python Notes for mca i year students osmania university.docx
Linux LVM Logical Volume Management
1. LVM in a nugget:
Merge your available disks (PVs) into one storage space
(VG). Use this space to manage easier your volumes (LVs)
Wikipedia
LVM - Logical Volume Manager
LVM Page 1
2. How do I work?
1)You need some partitions labeled as "Linux LVM"
better use 1 partition/disk
2)Create your VGs using partitions above
3)Create your volumes (LVs) using the available space in
your VGs
4)Make File systems on your LVs
5)Mount your new file systems somewhere under your
root.
Give me an answer!
How to remember all those commands!?
All commands start with two letters of what you need
them for:
LVM Page 2
3. Let's get into it!
CREATION
1)gdisk/fdisk [device] and create as many partitions as
needed
(don't forget the type to be "Linux LVM"
2)Label your new partitions as PV pvcreate partition1
partition2 … or go straight to create a VG.
3)Create a Volume Group with vgcreate name
partition1,2,3…
4)Create Logical Volumes with lvcreate -n name -l/L size
vgname
5)mkfs -t type lvname your new LVs
6)mount /fstab !
DELETION
easy… lv/vg/pvremove and gone…
DISPLAY MORE INFO
even easier… pv/lv/vgdisplay and check details
them for:
pv… => Physical Volumes commands
vg… => Volume Group commands
lv… => Logical Volumes commands
lvm… => Genetal LVM commands
LVM Page 3
4. REPLACE OR MOVE A DISK
pvmove disk if you have enough PEs available
vgreduce disk to remove disk from VG
pvremove disk to wipe out the disk
RESIZE
lvextend lvname -r -l +1395 to give some space
lvreduce lvname -r -l -800 to take back some space
DON'T FORGET -r to resize at the same time the file
system!
BONUS - TAKE A SHOT!
lvcreate -L 500M -s -n snapshotame source_lvname and
you now have a snapshot of your source volume!
to take back your files from snapshot either mount it and
copy what you need or merge it:
unmount your main LV and run
lvconvert --merge snapVolName
LVM Page 4