SlideShare a Scribd company logo
LVM
VIMAL THAMIZHARASAN
SENIOR LINUX TRAINER
MAZENET SOLUTION-CHENNAI,T-NAGAR.
Agenda
• Some basic background about Files and
Filesystems under Linux
• What is LVM and why should I use it
• How to create a simple LVM environment
What is Logical Volume Management?
• Software that allows the user to edit the
storage configuration without
• manipulating the actual hardware and vice
versa.
When to and not use LVMs
• USE WHEN:
-Lots of DISKs and you need to simplify
-Need flexiblity of file system expansion
-When you want to learn an advanced storage
management topic
• DON'T USE:
-SINGLE Partition Environments
-If Command line (CLI) is scary to you
-Without access to a System Administrator :
How Does LVM Work?
The LVM hides information
about where information is
stored, on which hardware,
and where exactly on that
hardware from the entire
Operating System allowing
it to manipulate the
configuration of the storage
capacities.
Layers to make it easier
• Layers in a typical system (before LVM)
Files/Dirs
Filesystems
Partitions
Disks
What is a Disk?
• The harddisk is the only Hardware piece we're
going to talk about here
• It has various techie things in it:
- Cylinders, Heads, Sectors, mbr, partitions
- It's own cpu, cache, firmware etc.
• but for this discussion a hard disk on a modern
system can be seen as one continuous row of
logical blocks.
• Typical disk names in Linux are hda, sda,vda.
Partitions
• To store data on a disk this continuous row of
logical blocks needs to be cut in sections called
Partitions.
• The original IBM PC from 1981 only had 4 primary
partitions.
• This was later improved by adding extended partitions
• Normally managed by fdisk or some graphical
partition/volume manager.
• One partition must be a continuous chunk of blocks .
Filesystems
• Filesystems are a fancy way to hold together a
group of files and directories.
• Without LVM one filesystem=one partition.
• Common File Systems:
-In the Windows World:
FAT (dos) FAT12/16/32
NTFS
-In Linux
Ext2/3, Reiserfs,jfs,xfs
And many many more
Files on a linux (and unix) system
• At last we are at the top, the user level
• Within User Level we have
–Files
–Directories
–Filesystems
Files Hold Data
• Directories hold files and directories
• Filesystems holds directories and files
• Mount points hold Filesystems
Time for volumes
Volumes
• By adding another layer between partitions
and filesystems we break the
OneFS=OnePartition relation
• This have many advantages
• 2 special reasons:
–Can carve out non continues filesystems
–Can add disks partitions together so they
look like one big disk
Commands used in LVM
Directory and Files
Directories and Files
## Directories
/etc/lvm - default lvm directory location
/etc/lvm/backup - where the automatic backups go
/etc/lvm/cache - persistent filter cache
/etc/lvm/archive - where automatic archives go after a volume group change
/var/lock/lvm - lock files to prevent metadata corruption
# Files
/etc/lvm/lvm.conf - main lvm configuration file
$HOME/.lvm - lvm history
Physical Volumes
display
pvdisplay -v
pvs -v
pvs -a
Commands used in LVM
adding
pvcreate /dev/sdb1
## Create physical volume with specific UUID, used to recover volume groups (see
miscellaneous section)
pvcreate --uuid <UUID> /dev/sdb1
removing pvremove /dev/sdb1
moving
pvmove -v /dev/sdb2 /dev/sdb3
Note: moves any used extents from this volume to another volume, in readiness to remove that
volume. However you cannot use this on mirrored volumes, you must convert back to non-
mirror using "lvconvert -m 0"
Volume Groups
creating
vgcreate VolData00 /dev/sdb1 /dev/sdb2 /dev/sdb3
vgcreate VolData00 /dev/sdb[123]
vgcreate VolData00 -s 32 /dev/sdb1
Common Attributes that you may want to use:
-l maximum logical volumes
-p maximum physical volumes
-s physical extent size (default is 4MB)
-A autobackup
Commands used in LVM
extending vgextend VolData00 /dev/sdb3
reducing
vgreduce VolData00 /dev/sdb3
vgreduce --removemissing --force VolData00
removing
vgremove VolData00
Common Attributes that you may want to use:
-f force the removal of any logical volumes
merging
# the old volumes group will be merged into the new volume group
vgmerge New_Vol_Group Old_Vol_Group
Note: you must unmount any fielsystems and deactivate the vg that is being
merged "vgchange -a n <vg>", then you can activiate it again afterwards
"vgchange -a y <vg>", then perform a vgscan, dont forget to backup the
configuration
spliting
vgsplit Old_Vol_Group New_Vol_Group [physical volumes] [-n logical
volume name]
Commands used in LVM
Logical Volumes
display
lvdisplay -v
lvdisplay --maps display mirror volumes
lvs -v
lvs -a -o +devices
## lvs commands for mirror volumes
lvs -a -o +devices
lvs -a -o +seg_pe_ranges --segments
## Stripe size
lvs -v --segments
lvs -a -o +stripes,stripesize
scanning
lvscan -v
lvmdiskscan
creating
## plain old volume
lvcreate -L 10M VolData00
## plain old volume but with a specific name web01
lvcreate -L 10M -n web01 VolData00
## plain old volume but on a specific disk
lvcreate -L 10M VolData00 /dev/sdb1
## a striped volume called lvol1 (note the captial i for the stripe size), can use -l
(extents) instead of -L
lvcreate -i 3 -L 24M -n lvol1 vg01
extending
lvextend -L 20M /dev/VolData00/vol01
Note: you can extend a ext2/ext3 filesystem using the "resize2fs" or "fsadm"
command
fsadm resize /dev/VolData01/data01
resize2fs -p /dev/mapper/VolData01-data01 [size]
The -p option displays bars of progress while extendingthe filesystem
reducing/resizing
lvreduce -L 5M /dev/VolData00/vol01
lvresize -L 5M /dev/VolData00/vol01
Note: rounding will occur when extending and reducing volumes to the next extent
(4MB by default), you can use resize2fs or fsadm to shrink the filesystem
fsadm resize /dev/VolData01/data01 [size]
resize2fs -p /dev/mapper/VolData01-data01 [size]
removing lvremove /dev/VolData00/vol01
THANK YOU ALL

More Related Content

ODP
Logical Volume Manager. An Introduction
PDF
Lvm advanced topics
ODP
4. storage lvm
PPT
Storage Management using LVM
PDF
Linux LVM Logical Volume Management
PDF
Linux: LVM
PDF
Control your service resources with systemd
PDF
Improve your storage with bcachefs
Logical Volume Manager. An Introduction
Lvm advanced topics
4. storage lvm
Storage Management using LVM
Linux LVM Logical Volume Management
Linux: LVM
Control your service resources with systemd
Improve your storage with bcachefs

What's hot (20)

PDF
Comparison of-foss-distributed-storage
PPTX
PPT
Linux memory consumption
PDF
Ltsp talk
PPTX
Linux Kernel Init Process
ODP
LSA2 - 01 Virtualization with KVM
PPTX
Samba power point presentation
PDF
Cgroup resource mgmt_v1
PDF
Performance comparison of Distributed File Systems on 1Gbit networks
PDF
LizardFS-WhitePaper-Eng-v3.9.2-web
PDF
Comparison of foss distributed storage
PPTX
Samba server linux (SMB) BY ROHIT MALAV
PDF
High Availability Storage (susecon2016)
PDF
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
PDF
Scale2013
ODP
Optimizing Linux Servers
PDF
Ltsp Slide
PPT
Samba server
PDF
Using cobbler in a not so small environment 1.77
Comparison of-foss-distributed-storage
Linux memory consumption
Ltsp talk
Linux Kernel Init Process
LSA2 - 01 Virtualization with KVM
Samba power point presentation
Cgroup resource mgmt_v1
Performance comparison of Distributed File Systems on 1Gbit networks
LizardFS-WhitePaper-Eng-v3.9.2-web
Comparison of foss distributed storage
Samba server linux (SMB) BY ROHIT MALAV
High Availability Storage (susecon2016)
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
Scale2013
Optimizing Linux Servers
Ltsp Slide
Samba server
Using cobbler in a not so small environment 1.77
Ad

Viewers also liked (8)

PDF
Sito Maas-Workshop: Marko Forsblom, LVM
ODP
Using CloudStack With Clustered LVM
PPTX
Ceph and OpenStack - Feb 2014
PPTX
Colour vision with lvm
PDF
Red hat lvm cheatsheet
PDF
分散ストレージソフトウェアCeph・アーキテクチャー概要
PPTX
Ceph Intro and Architectural Overview by Ross Turk
Sito Maas-Workshop: Marko Forsblom, LVM
Using CloudStack With Clustered LVM
Ceph and OpenStack - Feb 2014
Colour vision with lvm
Red hat lvm cheatsheet
分散ストレージソフトウェアCeph・アーキテクチャー概要
Ceph Intro and Architectural Overview by Ross Turk
Ad

Similar to Red Hat - LVM - Mazenet Solution (20)

PDF
Master Logical Volume Management - RHCSA+.pdf
PDF
Putting some "logic" in LVM.
ODP
Disks and-filesystems
ODP
Disks and-filesystems
PPTX
3 - Disk Partitioning in Red Hat
ODP
Lvm and gang 2015
PPT
Storage Management in Linux OS.ppt
PDF
Managing Multiple Logical Volumes - RHCSA+.pdf
PDF
Inspection and maintenance tools (Linux / OpenStack)
PDF
lvm logical volume management is a tool in Linux that allows you to manage st...
PDF
Manage Logical Volume in RHEL - RHCSA (RH134).pdf
PPSX
Logical volume manager xfs
PPTX
Linux training in chandigarh
PPTX
Disk and File System Management in Linux
TXT
PPTX
CSA-lecture 6.pptx
PDF
Cluster logical volume_manager
PDF
Logical Volume Manager
PPTX
Linux Survival Kit for Proof of Concept & Proof of Technology
PDF
Configuring+Disks+and+Filsystems-pdf.pdf
Master Logical Volume Management - RHCSA+.pdf
Putting some "logic" in LVM.
Disks and-filesystems
Disks and-filesystems
3 - Disk Partitioning in Red Hat
Lvm and gang 2015
Storage Management in Linux OS.ppt
Managing Multiple Logical Volumes - RHCSA+.pdf
Inspection and maintenance tools (Linux / OpenStack)
lvm logical volume management is a tool in Linux that allows you to manage st...
Manage Logical Volume in RHEL - RHCSA (RH134).pdf
Logical volume manager xfs
Linux training in chandigarh
Disk and File System Management in Linux
CSA-lecture 6.pptx
Cluster logical volume_manager
Logical Volume Manager
Linux Survival Kit for Proof of Concept & Proof of Technology
Configuring+Disks+and+Filsystems-pdf.pdf

More from Mazenetsolution (20)

PPTX
Tally Auto E-mail Module | Mazenet Technologies
PPTX
Tally Auto SMS Module| Mazenet Technologies
PPTX
Tally auto synchronization
PPTX
Print barcode using voucher- Mazenettechnologies
PPTX
Copy user list | Tally | Tally Software | Accounting Software | Mazenet
PPTX
Auto synchronization | Tally Software | Mazenet Technologies
PPTX
Auto backup | Tally Coimbatore | Tally Software
PPTX
Mazenet Technologies-Tally
PPTX
Android - Intents - Mazenet Solution
PPT
Java - Servlet - Mazenet Solution
PPT
Software Testing - Tool support for testing (CAST) - Mazenet Solution
PPT
Software Testing - Test management - Mazenet Solution
PPT
PHP - Introduction to PHP - Mazenet Solution
PPT
Static testing techniques
PPTX
Java- GUI- Mazenet solution
PPT
Oracle- Introduction to Sql commands- Mazenet solution
PPTX
Process management in linux
PPT
Software Testing- Principles of testing- Mazenet Solution
PPTX
Java- JDBC- Mazenet Solution
PPT
Software Testing-Dynamic testing technique-Mazenet solution
Tally Auto E-mail Module | Mazenet Technologies
Tally Auto SMS Module| Mazenet Technologies
Tally auto synchronization
Print barcode using voucher- Mazenettechnologies
Copy user list | Tally | Tally Software | Accounting Software | Mazenet
Auto synchronization | Tally Software | Mazenet Technologies
Auto backup | Tally Coimbatore | Tally Software
Mazenet Technologies-Tally
Android - Intents - Mazenet Solution
Java - Servlet - Mazenet Solution
Software Testing - Tool support for testing (CAST) - Mazenet Solution
Software Testing - Test management - Mazenet Solution
PHP - Introduction to PHP - Mazenet Solution
Static testing techniques
Java- GUI- Mazenet solution
Oracle- Introduction to Sql commands- Mazenet solution
Process management in linux
Software Testing- Principles of testing- Mazenet Solution
Java- JDBC- Mazenet Solution
Software Testing-Dynamic testing technique-Mazenet solution

Recently uploaded (20)

PDF
01-Introduction-to-Information-Management.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Yogi Goddess Pres Conference Studio Updates
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Trump Administration's workforce development strategy
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
RMMM.pdf make it easy to upload and study
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
History, Philosophy and sociology of education (1).pptx
01-Introduction-to-Information-Management.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Anesthesia in Laparoscopic Surgery in India
Yogi Goddess Pres Conference Studio Updates
A systematic review of self-coping strategies used by university students to ...
Trump Administration's workforce development strategy
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Cell Types and Its function , kingdom of life
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
RMMM.pdf make it easy to upload and study
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Final Presentation General Medicine 03-08-2024.pptx
LDMMIA Reiki Yoga Finals Review Spring Summer
Paper A Mock Exam 9_ Attempt review.pdf.
Microbial disease of the cardiovascular and lymphatic systems
Chinmaya Tiranga quiz Grand Finale.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
History, Philosophy and sociology of education (1).pptx

Red Hat - LVM - Mazenet Solution

  • 1. LVM VIMAL THAMIZHARASAN SENIOR LINUX TRAINER MAZENET SOLUTION-CHENNAI,T-NAGAR.
  • 2. Agenda • Some basic background about Files and Filesystems under Linux • What is LVM and why should I use it • How to create a simple LVM environment
  • 3. What is Logical Volume Management? • Software that allows the user to edit the storage configuration without • manipulating the actual hardware and vice versa.
  • 4. When to and not use LVMs • USE WHEN: -Lots of DISKs and you need to simplify -Need flexiblity of file system expansion -When you want to learn an advanced storage management topic • DON'T USE: -SINGLE Partition Environments -If Command line (CLI) is scary to you -Without access to a System Administrator :
  • 5. How Does LVM Work? The LVM hides information about where information is stored, on which hardware, and where exactly on that hardware from the entire Operating System allowing it to manipulate the configuration of the storage capacities.
  • 6. Layers to make it easier • Layers in a typical system (before LVM) Files/Dirs Filesystems Partitions Disks
  • 7. What is a Disk? • The harddisk is the only Hardware piece we're going to talk about here • It has various techie things in it: - Cylinders, Heads, Sectors, mbr, partitions - It's own cpu, cache, firmware etc. • but for this discussion a hard disk on a modern system can be seen as one continuous row of logical blocks. • Typical disk names in Linux are hda, sda,vda.
  • 8. Partitions • To store data on a disk this continuous row of logical blocks needs to be cut in sections called Partitions. • The original IBM PC from 1981 only had 4 primary partitions. • This was later improved by adding extended partitions • Normally managed by fdisk or some graphical partition/volume manager. • One partition must be a continuous chunk of blocks .
  • 9. Filesystems • Filesystems are a fancy way to hold together a group of files and directories. • Without LVM one filesystem=one partition. • Common File Systems: -In the Windows World: FAT (dos) FAT12/16/32 NTFS -In Linux Ext2/3, Reiserfs,jfs,xfs And many many more
  • 10. Files on a linux (and unix) system • At last we are at the top, the user level • Within User Level we have –Files –Directories –Filesystems Files Hold Data • Directories hold files and directories • Filesystems holds directories and files • Mount points hold Filesystems
  • 12. • By adding another layer between partitions and filesystems we break the OneFS=OnePartition relation • This have many advantages • 2 special reasons: –Can carve out non continues filesystems –Can add disks partitions together so they look like one big disk
  • 13. Commands used in LVM Directory and Files Directories and Files ## Directories /etc/lvm - default lvm directory location /etc/lvm/backup - where the automatic backups go /etc/lvm/cache - persistent filter cache /etc/lvm/archive - where automatic archives go after a volume group change /var/lock/lvm - lock files to prevent metadata corruption # Files /etc/lvm/lvm.conf - main lvm configuration file $HOME/.lvm - lvm history Physical Volumes display pvdisplay -v pvs -v pvs -a
  • 14. Commands used in LVM adding pvcreate /dev/sdb1 ## Create physical volume with specific UUID, used to recover volume groups (see miscellaneous section) pvcreate --uuid <UUID> /dev/sdb1 removing pvremove /dev/sdb1 moving pvmove -v /dev/sdb2 /dev/sdb3 Note: moves any used extents from this volume to another volume, in readiness to remove that volume. However you cannot use this on mirrored volumes, you must convert back to non- mirror using "lvconvert -m 0" Volume Groups creating vgcreate VolData00 /dev/sdb1 /dev/sdb2 /dev/sdb3 vgcreate VolData00 /dev/sdb[123] vgcreate VolData00 -s 32 /dev/sdb1 Common Attributes that you may want to use: -l maximum logical volumes -p maximum physical volumes -s physical extent size (default is 4MB) -A autobackup
  • 15. Commands used in LVM extending vgextend VolData00 /dev/sdb3 reducing vgreduce VolData00 /dev/sdb3 vgreduce --removemissing --force VolData00 removing vgremove VolData00 Common Attributes that you may want to use: -f force the removal of any logical volumes merging # the old volumes group will be merged into the new volume group vgmerge New_Vol_Group Old_Vol_Group Note: you must unmount any fielsystems and deactivate the vg that is being merged "vgchange -a n <vg>", then you can activiate it again afterwards "vgchange -a y <vg>", then perform a vgscan, dont forget to backup the configuration spliting vgsplit Old_Vol_Group New_Vol_Group [physical volumes] [-n logical volume name]
  • 16. Commands used in LVM Logical Volumes display lvdisplay -v lvdisplay --maps display mirror volumes lvs -v lvs -a -o +devices ## lvs commands for mirror volumes lvs -a -o +devices lvs -a -o +seg_pe_ranges --segments ## Stripe size lvs -v --segments lvs -a -o +stripes,stripesize scanning lvscan -v lvmdiskscan creating ## plain old volume lvcreate -L 10M VolData00 ## plain old volume but with a specific name web01 lvcreate -L 10M -n web01 VolData00 ## plain old volume but on a specific disk lvcreate -L 10M VolData00 /dev/sdb1 ## a striped volume called lvol1 (note the captial i for the stripe size), can use -l (extents) instead of -L lvcreate -i 3 -L 24M -n lvol1 vg01
  • 17. extending lvextend -L 20M /dev/VolData00/vol01 Note: you can extend a ext2/ext3 filesystem using the "resize2fs" or "fsadm" command fsadm resize /dev/VolData01/data01 resize2fs -p /dev/mapper/VolData01-data01 [size] The -p option displays bars of progress while extendingthe filesystem reducing/resizing lvreduce -L 5M /dev/VolData00/vol01 lvresize -L 5M /dev/VolData00/vol01 Note: rounding will occur when extending and reducing volumes to the next extent (4MB by default), you can use resize2fs or fsadm to shrink the filesystem fsadm resize /dev/VolData01/data01 [size] resize2fs -p /dev/mapper/VolData01-data01 [size] removing lvremove /dev/VolData00/vol01