SlideShare uma empresa Scribd logo
1 de 5
Baixar para ler offline
7/6/2015 RedHat ­ LVM cheatsheet
http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm 1/5
Logical Volume Manager (LVM)
This is a quick and dirty cheat sheet on LVM using Linux, I have highlighted many of the common attributes for each command however
this is not an extensive list, make sure you look up the command.
With the pvs, vgs and lvs commands, the number of verboses added the more verbose information for example pvs ­vvvvv
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
Tools
diagnostic
lvmdump
lvmdump ‐d <dir>
dmsetup [info|ls|status]
Note: by default the lvmdump command creates a tar ball
Physical Volumes
display
pvdisplay ‐v
pvs ‐v
pvs ‐a
pvs ‐‐segments (see the disk segments used)
pvs attributes are:
1. (a)llocatable
2. e(x)ported
scanning
pvscan ‐v
Note: scans for disks for non‐LVM and LVM disks
adding
pvcreate /dev/sdb1
## Create physical volume with specific UUID, used to recover volume groups (see miscellaneous section)
pvcreate ‐‐uuid <UUID> /dev/sdb1
Common Attributes that you may want to use:
‐M2 create a LVM2 physical volume
removing pvremove /dev/sdb1
checking
pvck ‐v /dev/sdb1
Note: check the consistency of the LVM metadata
change physical attributes
## do not allow allocation of extents on this drive, however the partition must be in a vg otherwise you get an error
pvchange ‐x n /dev/sdb1
Common Attributes that you may want to use:
‐‐addtag add a tag
‐x allowed to allocate extents
‐u change the uuid
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
display
vgdisplay ‐v
vgs ‐v
vgs ‐a ‐o +devices
vgs flags:
#PV ‐ number of physical devices
#LV ‐ number of configured volumes        
vgs attributes are:
1. permissions (r)|(w)
2. resi(z)eable
7/6/2015 RedHat ­ LVM cheatsheet
http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm 2/5
3. e(x)ported
4. (p)artial
5. allocation policy ‐ (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited
6. (c)luster
scanning vgscan ‐v
creating
vgcreate VolData00 /dev/sdb1 /dev/sdb2 /dev/sdb3
vgcreate VolData00 /dev/sdb[123]
## Use 32MB extent size
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
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
checking
vgck VolData00
Note: check the consistency of the LVM metadata
change volume attributes
vgchange ‐a n VolData00
Common Attributes that you may want to use:
‐a control availability of volumes within the group
‐l  maximum logical volumes
‐p maximum physical volumes
‐s physical extent size (default is 4MB)
‐x resizable yes or no (see VG status in vxdisplay)
renaming
vgrename VolData00 Data_Vol_01
note: the volume group must not have any active logical volumes
converting metadata type
vgconvert ‐M2 VolData00
Note: vgconvert allows you to convert from one type of metadata format to another for example from LVM1 to LVM2, LVM2 offers
bigger capacity, clustering and mirroring
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]
importing
vgimport VolData00
Common Attributes that you may want to use:
‐a import all exported volume groups
exporting
## to see if a volume has already been export use "vgs" and look at the third attribute should be a x
vgexport VolData00
Common Attributes that you may want to use:
‐a export all inactive volume groups
backing up
## Backup to default location (/etc/lvm/backup)
vgcfgbackup VolData00
# Backup to specific location
vgcfgbackup ‐f /var/backup/VolData00_bkup VolData00
# Backup to specific location all volume groups (notice the %s)
vgcfgbackup ‐f /var/backup/vg_backups_%s
Note: the backup is written in plain text and are by default located in /etc/lvm/backup
vgcfgrestore ‐f /var/backup/VolData00_bkup VolData00
Common Attributes that you may want to use:
7/6/2015 RedHat ­ LVM cheatsheet
http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm 3/5
restoring
‐l list backups of file
‐f backup file
‐M metadataype 1 or 2
cloning
vgimportclone /dev/sdb1
Note: used to import and rename duplicated volume group
special files
vgmknodes VolData00
Note: recreates volume group directory and logical volume special files in /dev
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
## use complex command
lvs ‐a ‐o +devices,stripes,stripesize,seg_pe_ranges ‐‐segments
lvs attributes are:
1. volume type: (m)irrored, (M)irrored without initail sync, (o)rigin, (p)vmove, (s)napshot, invalid (S)napshot, (v)irtual, mirror (i)mage
                      mirror (I)mage out‐of‐sync, under (c)onversion
2. permissions: (w)rite, (r)ead‐only
3. allocation policy ‐ (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited
4. fixed (m)inor
5. state: (a)ctive, (s)uspended, (I)nvalid snapshot, invalid (S)uspended snapshot, mapped (d)evice present with‐out tables,
             mapped device present with (i)nactive table
6. device (o)pen (mounted in other words)
scanning
lvscan ‐v
lvmdiskscan
creating
## plain old volume
lvcreate ‐L 10M VolData00
## plain old volume but use extents, use 10 4MB extents (if extent size is 4MB)
lvcreate ‐l 10 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
## Mirrored volume
lvcreate ‐L 10M ‐m1 ‐n data01 vg01
## Mirrored volume without a mirror log file
lvcreate ‐L 10M ‐m1 ‐‐mirrorlog core ‐n data01 vg01
Common Attributes that you may want to use:
‐L size of the volume [kKmMgGtT]
‐l number of extents
‐C contiguous [y|n]
‐i stripes
‐I stripe size
‐m mirrors
‐‐mirrorlog
‐n volume name
extending
lvextend ‐L 20M /dev/VolData00/vol01
Common Attributes that you may want to use:
‐L size of the volume [kKmMgGtT]
‐l number of extents
‐C contiguous [y|n]
‐i stripes
‐I stripe size
7/6/2015 RedHat ­ LVM cheatsheet
http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm 4/5
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
adding a mirror to a non‐
mirrored volume
lvconvert ‐m1 ‐‐mirrorlog core /dev/VolData00/vol01 /dev/sdb2
Note: you can also use the above command to remove a unwanted log
removing a mirror from a
mirrored volume
lvconvert ‐m0 /dev/VolData00/vol01 /dev/sdb2
Note: the disk in the command is the one you want to remove
Mirror a volume that has
stripes
lvconvert ‐‐stripes 3 ‐m1 ‐‐mirrorlog core /dev/VolData00/data01 /dev/sdd1 /dev/sde1 /devsdf1
change volume attributes
lvchange ‐a n /dev/VolData00/vol01
Common Attributes that you may want to use:
‐a availability
‐C contiguous [y|n]
renaming lvrename /dev/VolData00/vol_old /dev/VolData00/vol_new
snapshotting lvcreate ‐‐size 100M ‐‐snapshot ‐name snap /dev/vg01/data01
Miscellaneous
Simulating a disk failure dd if=/dev/zero of=/dev/sdb2 count=10
reparing a failed mirror
no LVM corruption
## check volume, persume /dev/sdb2 has failed
lvs ‐a ‐o +devices
# remove the failed disk from the volume (if not already done so) , this will convert volume into a non‐mirrored volume
vgreduce ‐‐removemissing ‐‐force VolData00
## replace the disk physically, remember to partion it with type 8e
fdisk /dev/sdb
........
## add new disk to LVM
pvcreate /dev/sdb2
## add the disk back into volume group
vgextend VolData00 /dev/sdb2
## mirror up the volume
lvconvert ‐m1 ‐‐mirrorlog core /dev/VolData00/vol02 /dev/sdb2
corrupt LVM metadata
without replacing drive
# attempt to bring the volume group online
vgchange ‐a y VolData00
# Restore the LVM configation
vgcfgrestore VolData00
# attempt to bring the volume grou online
vgchange ‐a y VolData00
# file system check
e2fsck /dev/VolData00/data01
# attempt to bring the volume group online but you get UUID conflict errors make note of the UUID number
vgchange ‐a y VolData00
vgchange ‐a n VolData00
## sometimes it my only be a logical volume problem
lvchange ‐a y /dev/VolData00/web02
lvchange ‐a n /dev/Voldata00/web02
7/6/2015 RedHat ­ LVM cheatsheet
http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm 5/5
corrupt LVM metadata but
replacing the faulty disk
## replace the disk physically, remember to partion it with type 8e
fdisk /dev/sdb
........
# after replacing the faulty drive the disk must have the previuos UUID number or you can get it from /etc/lvm directory
pvcreate ‐‐uuid <previous UUID number taken from above command> /dev/sdb2
# Restore the LVM configation
vgcfgrestore VolData00
# attempt to bring the volume group online or logical volume
vgchange ‐a y VolData00
lvchange ‐a y /dev/VolData00/web02
# file system check
e2fsck /dev/VolData00/data01
Note: if you have backed the volume group configuration you can obtain the UUID number in the backup file by default located in
/etc/lvm/backup or running "pvs ‐v"
For other LVM's and Array utilities see my LVM central page

Mais conteúdo relacionado

Mais procurados

Les 05 Create Bu
Les 05 Create BuLes 05 Create Bu
Les 05 Create Buvivaankumar
 
Troubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationTroubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationAlexey Lesovsky
 
Recuperación de la base de datos en Oracle
Recuperación de la base de datos en OracleRecuperación de la base de datos en Oracle
Recuperación de la base de datos en OracleCarmen Soler
 
2. Introduction-to-MSSQL-Server.pptx
2. Introduction-to-MSSQL-Server.pptx2. Introduction-to-MSSQL-Server.pptx
2. Introduction-to-MSSQL-Server.pptxAyobamiAdelekeMDM
 
MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScaleMariaDB plc
 
The oracle database architecture
The oracle database architectureThe oracle database architecture
The oracle database architectureAkash Pramanik
 
Introduction to Distributed Computing & Distributed Databases
Introduction to Distributed Computing & Distributed DatabasesIntroduction to Distributed Computing & Distributed Databases
Introduction to Distributed Computing & Distributed DatabasesShankar Iyer
 
Arquitetura de Memoria do PostgreSQL
Arquitetura de Memoria do PostgreSQLArquitetura de Memoria do PostgreSQL
Arquitetura de Memoria do PostgreSQLRaul Oliveira
 
Oracle管理藝術第1章 在Linux作業體統安裝Oracle 11g
Oracle管理藝術第1章 在Linux作業體統安裝Oracle 11gOracle管理藝術第1章 在Linux作業體統安裝Oracle 11g
Oracle管理藝術第1章 在Linux作業體統安裝Oracle 11gChien Chung Shen
 
How to see the event and audit logs through ( gui and cli) in cluster ontap n...
How to see the event and audit logs through ( gui and cli) in cluster ontap n...How to see the event and audit logs through ( gui and cli) in cluster ontap n...
How to see the event and audit logs through ( gui and cli) in cluster ontap n...Saroj Sahu
 
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1Seok-joon Yun
 
jemalloc 세미나
jemalloc 세미나jemalloc 세미나
jemalloc 세미나Jang Hoon
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsTuyen Vuong
 
Microsoft SQL Server internals & architecture
Microsoft SQL Server internals & architectureMicrosoft SQL Server internals & architecture
Microsoft SQL Server internals & architectureKevin Kline
 
Undo internalspresentation
Undo internalspresentationUndo internalspresentation
Undo internalspresentationoracle documents
 
Oracle Architecture
Oracle ArchitectureOracle Architecture
Oracle ArchitectureNeeraj Singh
 
자바 웹 개발 시작하기 (10주차 : ㅌㅗㅇ ㅎㅏ ㄹㅏ)

자바 웹 개발 시작하기 (10주차 : ㅌㅗㅇ ㅎㅏ ㄹㅏ)
자바 웹 개발 시작하기 (10주차 : ㅌㅗㅇ ㅎㅏ ㄹㅏ)

자바 웹 개발 시작하기 (10주차 : ㅌㅗㅇ ㅎㅏ ㄹㅏ)
DK Lee
 
1.mysql disk io 모니터링 및 분석사례
1.mysql disk io 모니터링 및 분석사례1.mysql disk io 모니터링 및 분석사례
1.mysql disk io 모니터링 및 분석사례I Goo Lee
 

Mais procurados (20)

Les 05 Create Bu
Les 05 Create BuLes 05 Create Bu
Les 05 Create Bu
 
Troubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming ReplicationTroubleshooting PostgreSQL Streaming Replication
Troubleshooting PostgreSQL Streaming Replication
 
Recuperación de la base de datos en Oracle
Recuperación de la base de datos en OracleRecuperación de la base de datos en Oracle
Recuperación de la base de datos en Oracle
 
2. Introduction-to-MSSQL-Server.pptx
2. Introduction-to-MSSQL-Server.pptx2. Introduction-to-MSSQL-Server.pptx
2. Introduction-to-MSSQL-Server.pptx
 
MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScale
 
The oracle database architecture
The oracle database architectureThe oracle database architecture
The oracle database architecture
 
Introduction to Distributed Computing & Distributed Databases
Introduction to Distributed Computing & Distributed DatabasesIntroduction to Distributed Computing & Distributed Databases
Introduction to Distributed Computing & Distributed Databases
 
Arquitetura de Memoria do PostgreSQL
Arquitetura de Memoria do PostgreSQLArquitetura de Memoria do PostgreSQL
Arquitetura de Memoria do PostgreSQL
 
Oracle管理藝術第1章 在Linux作業體統安裝Oracle 11g
Oracle管理藝術第1章 在Linux作業體統安裝Oracle 11gOracle管理藝術第1章 在Linux作業體統安裝Oracle 11g
Oracle管理藝術第1章 在Linux作業體統安裝Oracle 11g
 
How to see the event and audit logs through ( gui and cli) in cluster ontap n...
How to see the event and audit logs through ( gui and cli) in cluster ontap n...How to see the event and audit logs through ( gui and cli) in cluster ontap n...
How to see the event and audit logs through ( gui and cli) in cluster ontap n...
 
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
 
153 Oracle dba interview questions
153 Oracle dba interview questions153 Oracle dba interview questions
153 Oracle dba interview questions
 
jemalloc 세미나
jemalloc 세미나jemalloc 세미나
jemalloc 세미나
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and Concepts
 
Microsoft SQL Server internals & architecture
Microsoft SQL Server internals & architectureMicrosoft SQL Server internals & architecture
Microsoft SQL Server internals & architecture
 
Undo internalspresentation
Undo internalspresentationUndo internalspresentation
Undo internalspresentation
 
Oracle Architecture
Oracle ArchitectureOracle Architecture
Oracle Architecture
 
자바 웹 개발 시작하기 (10주차 : ㅌㅗㅇ ㅎㅏ ㄹㅏ)

자바 웹 개발 시작하기 (10주차 : ㅌㅗㅇ ㅎㅏ ㄹㅏ)
자바 웹 개발 시작하기 (10주차 : ㅌㅗㅇ ㅎㅏ ㄹㅏ)

자바 웹 개발 시작하기 (10주차 : ㅌㅗㅇ ㅎㅏ ㄹㅏ)

 
1.mysql disk io 모니터링 및 분석사례
1.mysql disk io 모니터링 및 분석사례1.mysql disk io 모니터링 및 분석사례
1.mysql disk io 모니터링 및 분석사례
 
High Performance PL/SQL
High Performance PL/SQLHigh Performance PL/SQL
High Performance PL/SQL
 

Destaque

Red Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet SolutionRed Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet SolutionMazenetsolution
 
OpenStack Summit Vancouver: Lessons learned on upgrades
OpenStack Summit Vancouver:  Lessons learned on upgradesOpenStack Summit Vancouver:  Lessons learned on upgrades
OpenStack Summit Vancouver: Lessons learned on upgradesFrédéric Lepied
 
Sito Maas-Workshop: Marko Forsblom, LVM
Sito Maas-Workshop: Marko Forsblom, LVMSito Maas-Workshop: Marko Forsblom, LVM
Sito Maas-Workshop: Marko Forsblom, LVMSito_Group
 
Build a Basic Cloud Using RDO-manager
Build a Basic Cloud Using RDO-managerBuild a Basic Cloud Using RDO-manager
Build a Basic Cloud Using RDO-managerK Rain Leander
 
Using CloudStack With Clustered LVM
Using CloudStack With Clustered LVMUsing CloudStack With Clustered LVM
Using CloudStack With Clustered LVMMarcus L Sorensen
 
HP-UX 11i LVM Mirroring Features and Multi-threads by Dusan Baljevic
HP-UX 11i LVM Mirroring Features and Multi-threads by Dusan BaljevicHP-UX 11i LVM Mirroring Features and Multi-threads by Dusan Baljevic
HP-UX 11i LVM Mirroring Features and Multi-threads by Dusan BaljevicCircling Cycle
 
AWS Cost Cheat Sheet
AWS Cost Cheat SheetAWS Cost Cheat Sheet
AWS Cost Cheat SheetAkash Agrawal
 
Logical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionLogical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionJuan A. Suárez Romero
 
Ceph and OpenStack - Feb 2014
Ceph and OpenStack - Feb 2014Ceph and OpenStack - Feb 2014
Ceph and OpenStack - Feb 2014Ian Colle
 
Colour vision with lvm
Colour vision with lvmColour vision with lvm
Colour vision with lvmsurendra74
 
Transforming to OpenStack: a sample roadmap to DevOps
Transforming to OpenStack: a sample roadmap to DevOpsTransforming to OpenStack: a sample roadmap to DevOps
Transforming to OpenStack: a sample roadmap to DevOpsNicolas (Nick) Barcet
 
Storage Management using LVM
Storage Management using LVMStorage Management using LVM
Storage Management using LVMPriyank Kapadia
 
Nginx conference 2015
Nginx conference 2015Nginx conference 2015
Nginx conference 2015ING-IT
 
Introduction openstack-meetup-nov-28
Introduction openstack-meetup-nov-28Introduction openstack-meetup-nov-28
Introduction openstack-meetup-nov-28Sadique Puthen
 
REST HTTP Response Codes Cheat Sheet
REST HTTP Response Codes Cheat SheetREST HTTP Response Codes Cheat Sheet
REST HTTP Response Codes Cheat SheetMarkus Tacker
 
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...Animesh Singh
 

Destaque (20)

Linux: LVM
Linux: LVMLinux: LVM
Linux: LVM
 
Red Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet SolutionRed Hat - LVM - Mazenet Solution
Red Hat - LVM - Mazenet Solution
 
OpenStack Summit Vancouver: Lessons learned on upgrades
OpenStack Summit Vancouver:  Lessons learned on upgradesOpenStack Summit Vancouver:  Lessons learned on upgrades
OpenStack Summit Vancouver: Lessons learned on upgrades
 
Lvm advanced topics
Lvm advanced topicsLvm advanced topics
Lvm advanced topics
 
Sito Maas-Workshop: Marko Forsblom, LVM
Sito Maas-Workshop: Marko Forsblom, LVMSito Maas-Workshop: Marko Forsblom, LVM
Sito Maas-Workshop: Marko Forsblom, LVM
 
Build a Basic Cloud Using RDO-manager
Build a Basic Cloud Using RDO-managerBuild a Basic Cloud Using RDO-manager
Build a Basic Cloud Using RDO-manager
 
Using CloudStack With Clustered LVM
Using CloudStack With Clustered LVMUsing CloudStack With Clustered LVM
Using CloudStack With Clustered LVM
 
LVM
LVMLVM
LVM
 
RPM Factory for RDO
RPM Factory for RDORPM Factory for RDO
RPM Factory for RDO
 
HP-UX 11i LVM Mirroring Features and Multi-threads by Dusan Baljevic
HP-UX 11i LVM Mirroring Features and Multi-threads by Dusan BaljevicHP-UX 11i LVM Mirroring Features and Multi-threads by Dusan Baljevic
HP-UX 11i LVM Mirroring Features and Multi-threads by Dusan Baljevic
 
AWS Cost Cheat Sheet
AWS Cost Cheat SheetAWS Cost Cheat Sheet
AWS Cost Cheat Sheet
 
Logical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionLogical Volume Manager. An Introduction
Logical Volume Manager. An Introduction
 
Ceph and OpenStack - Feb 2014
Ceph and OpenStack - Feb 2014Ceph and OpenStack - Feb 2014
Ceph and OpenStack - Feb 2014
 
Colour vision with lvm
Colour vision with lvmColour vision with lvm
Colour vision with lvm
 
Transforming to OpenStack: a sample roadmap to DevOps
Transforming to OpenStack: a sample roadmap to DevOpsTransforming to OpenStack: a sample roadmap to DevOps
Transforming to OpenStack: a sample roadmap to DevOps
 
Storage Management using LVM
Storage Management using LVMStorage Management using LVM
Storage Management using LVM
 
Nginx conference 2015
Nginx conference 2015Nginx conference 2015
Nginx conference 2015
 
Introduction openstack-meetup-nov-28
Introduction openstack-meetup-nov-28Introduction openstack-meetup-nov-28
Introduction openstack-meetup-nov-28
 
REST HTTP Response Codes Cheat Sheet
REST HTTP Response Codes Cheat SheetREST HTTP Response Codes Cheat Sheet
REST HTTP Response Codes Cheat Sheet
 
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...
 

Semelhante a Red hat lvm cheatsheet

Inspection and maintenance tools (Linux / OpenStack)
Inspection and maintenance tools (Linux / OpenStack)Inspection and maintenance tools (Linux / OpenStack)
Inspection and maintenance tools (Linux / OpenStack)Gerard Braad
 
HP-UX 11iv3 How to Change Root Volume Group Name vg00 by Dusan Baljevic
HP-UX 11iv3 How to Change Root Volume Group Name vg00 by Dusan BaljevicHP-UX 11iv3 How to Change Root Volume Group Name vg00 by Dusan Baljevic
HP-UX 11iv3 How to Change Root Volume Group Name vg00 by Dusan BaljevicCircling Cycle
 
Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Praguetomasbart
 
Linux LVM Logical Volume Management
Linux LVM Logical Volume ManagementLinux LVM Logical Volume Management
Linux LVM Logical Volume ManagementManolis Kartsonakis
 
MINCS - containers in the shell script (Eng. ver.)
MINCS - containers in the shell script (Eng. ver.)MINCS - containers in the shell script (Eng. ver.)
MINCS - containers in the shell script (Eng. ver.)Masami Hiramatsu
 
4.1 create partitions and filesystems
4.1 create partitions and filesystems4.1 create partitions and filesystems
4.1 create partitions and filesystemsAcácio Oliveira
 
Mirroring the root_disk under solaris SVM
Mirroring the root_disk under solaris SVMMirroring the root_disk under solaris SVM
Mirroring the root_disk under solaris SVMKazimal Abed Mohammed
 
Slug 2009 06 SELinux For Sysadmins
Slug 2009 06 SELinux For SysadminsSlug 2009 06 SELinux For Sysadmins
Slug 2009 06 SELinux For SysadminsPaulWay
 
101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystemsAcácio Oliveira
 
Rh202 q&amp;a-demo-cert magic
Rh202 q&amp;a-demo-cert magicRh202 q&amp;a-demo-cert magic
Rh202 q&amp;a-demo-cert magicEllina Beckman
 
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-Baljevic
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-BaljevicHow to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-Baljevic
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-BaljevicCircling Cycle
 
Trying and evaluating the new features of GlusterFS 3.5
Trying and evaluating the new features of GlusterFS 3.5Trying and evaluating the new features of GlusterFS 3.5
Trying and evaluating the new features of GlusterFS 3.5Keisuke Takahashi
 
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...Codemotion
 
Opendj - A LDAP Server for dummies
Opendj - A LDAP Server for dummiesOpendj - A LDAP Server for dummies
Opendj - A LDAP Server for dummiesClaudio Borges
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPDana Luther
 

Semelhante a Red hat lvm cheatsheet (20)

Inspection and maintenance tools (Linux / OpenStack)
Inspection and maintenance tools (Linux / OpenStack)Inspection and maintenance tools (Linux / OpenStack)
Inspection and maintenance tools (Linux / OpenStack)
 
Vx vm
Vx vmVx vm
Vx vm
 
HP-UX 11iv3 How to Change Root Volume Group Name vg00 by Dusan Baljevic
HP-UX 11iv3 How to Change Root Volume Group Name vg00 by Dusan BaljevicHP-UX 11iv3 How to Change Root Volume Group Name vg00 by Dusan Baljevic
HP-UX 11iv3 How to Change Root Volume Group Name vg00 by Dusan Baljevic
 
Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Prague
 
Linux LVM Logical Volume Management
Linux LVM Logical Volume ManagementLinux LVM Logical Volume Management
Linux LVM Logical Volume Management
 
lvm.pptx
lvm.pptxlvm.pptx
lvm.pptx
 
Top ESXi command line v2.0
Top ESXi command line v2.0Top ESXi command line v2.0
Top ESXi command line v2.0
 
Ex200
Ex200Ex200
Ex200
 
MINCS - containers in the shell script (Eng. ver.)
MINCS - containers in the shell script (Eng. ver.)MINCS - containers in the shell script (Eng. ver.)
MINCS - containers in the shell script (Eng. ver.)
 
Putting some "logic" in LVM.
Putting some "logic" in LVM.Putting some "logic" in LVM.
Putting some "logic" in LVM.
 
4.1 create partitions and filesystems
4.1 create partitions and filesystems4.1 create partitions and filesystems
4.1 create partitions and filesystems
 
Mirroring the root_disk under solaris SVM
Mirroring the root_disk under solaris SVMMirroring the root_disk under solaris SVM
Mirroring the root_disk under solaris SVM
 
Slug 2009 06 SELinux For Sysadmins
Slug 2009 06 SELinux For SysadminsSlug 2009 06 SELinux For Sysadmins
Slug 2009 06 SELinux For Sysadmins
 
101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems
 
Rh202 q&amp;a-demo-cert magic
Rh202 q&amp;a-demo-cert magicRh202 q&amp;a-demo-cert magic
Rh202 q&amp;a-demo-cert magic
 
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-Baljevic
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-BaljevicHow to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-Baljevic
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-Baljevic
 
Trying and evaluating the new features of GlusterFS 3.5
Trying and evaluating the new features of GlusterFS 3.5Trying and evaluating the new features of GlusterFS 3.5
Trying and evaluating the new features of GlusterFS 3.5
 
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...
 
Opendj - A LDAP Server for dummies
Opendj - A LDAP Server for dummiesOpendj - A LDAP Server for dummies
Opendj - A LDAP Server for dummies
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
 

Último

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

Red hat lvm cheatsheet

  • 1. 7/6/2015 RedHat ­ LVM cheatsheet http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm 1/5 Logical Volume Manager (LVM) This is a quick and dirty cheat sheet on LVM using Linux, I have highlighted many of the common attributes for each command however this is not an extensive list, make sure you look up the command. With the pvs, vgs and lvs commands, the number of verboses added the more verbose information for example pvs ­vvvvv 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 Tools diagnostic lvmdump lvmdump ‐d <dir> dmsetup [info|ls|status] Note: by default the lvmdump command creates a tar ball Physical Volumes display pvdisplay ‐v pvs ‐v pvs ‐a pvs ‐‐segments (see the disk segments used) pvs attributes are: 1. (a)llocatable 2. e(x)ported scanning pvscan ‐v Note: scans for disks for non‐LVM and LVM disks adding pvcreate /dev/sdb1 ## Create physical volume with specific UUID, used to recover volume groups (see miscellaneous section) pvcreate ‐‐uuid <UUID> /dev/sdb1 Common Attributes that you may want to use: ‐M2 create a LVM2 physical volume removing pvremove /dev/sdb1 checking pvck ‐v /dev/sdb1 Note: check the consistency of the LVM metadata change physical attributes ## do not allow allocation of extents on this drive, however the partition must be in a vg otherwise you get an error pvchange ‐x n /dev/sdb1 Common Attributes that you may want to use: ‐‐addtag add a tag ‐x allowed to allocate extents ‐u change the uuid 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 display vgdisplay ‐v vgs ‐v vgs ‐a ‐o +devices vgs flags: #PV ‐ number of physical devices #LV ‐ number of configured volumes         vgs attributes are: 1. permissions (r)|(w) 2. resi(z)eable
  • 2. 7/6/2015 RedHat ­ LVM cheatsheet http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm 2/5 3. e(x)ported 4. (p)artial 5. allocation policy ‐ (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited 6. (c)luster scanning vgscan ‐v creating vgcreate VolData00 /dev/sdb1 /dev/sdb2 /dev/sdb3 vgcreate VolData00 /dev/sdb[123] ## Use 32MB extent size 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 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 checking vgck VolData00 Note: check the consistency of the LVM metadata change volume attributes vgchange ‐a n VolData00 Common Attributes that you may want to use: ‐a control availability of volumes within the group ‐l  maximum logical volumes ‐p maximum physical volumes ‐s physical extent size (default is 4MB) ‐x resizable yes or no (see VG status in vxdisplay) renaming vgrename VolData00 Data_Vol_01 note: the volume group must not have any active logical volumes converting metadata type vgconvert ‐M2 VolData00 Note: vgconvert allows you to convert from one type of metadata format to another for example from LVM1 to LVM2, LVM2 offers bigger capacity, clustering and mirroring 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] importing vgimport VolData00 Common Attributes that you may want to use: ‐a import all exported volume groups exporting ## to see if a volume has already been export use "vgs" and look at the third attribute should be a x vgexport VolData00 Common Attributes that you may want to use: ‐a export all inactive volume groups backing up ## Backup to default location (/etc/lvm/backup) vgcfgbackup VolData00 # Backup to specific location vgcfgbackup ‐f /var/backup/VolData00_bkup VolData00 # Backup to specific location all volume groups (notice the %s) vgcfgbackup ‐f /var/backup/vg_backups_%s Note: the backup is written in plain text and are by default located in /etc/lvm/backup vgcfgrestore ‐f /var/backup/VolData00_bkup VolData00 Common Attributes that you may want to use:
  • 3. 7/6/2015 RedHat ­ LVM cheatsheet http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm 3/5 restoring ‐l list backups of file ‐f backup file ‐M metadataype 1 or 2 cloning vgimportclone /dev/sdb1 Note: used to import and rename duplicated volume group special files vgmknodes VolData00 Note: recreates volume group directory and logical volume special files in /dev 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 ## use complex command lvs ‐a ‐o +devices,stripes,stripesize,seg_pe_ranges ‐‐segments lvs attributes are: 1. volume type: (m)irrored, (M)irrored without initail sync, (o)rigin, (p)vmove, (s)napshot, invalid (S)napshot, (v)irtual, mirror (i)mage                       mirror (I)mage out‐of‐sync, under (c)onversion 2. permissions: (w)rite, (r)ead‐only 3. allocation policy ‐ (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited 4. fixed (m)inor 5. state: (a)ctive, (s)uspended, (I)nvalid snapshot, invalid (S)uspended snapshot, mapped (d)evice present with‐out tables,              mapped device present with (i)nactive table 6. device (o)pen (mounted in other words) scanning lvscan ‐v lvmdiskscan creating ## plain old volume lvcreate ‐L 10M VolData00 ## plain old volume but use extents, use 10 4MB extents (if extent size is 4MB) lvcreate ‐l 10 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 ## Mirrored volume lvcreate ‐L 10M ‐m1 ‐n data01 vg01 ## Mirrored volume without a mirror log file lvcreate ‐L 10M ‐m1 ‐‐mirrorlog core ‐n data01 vg01 Common Attributes that you may want to use: ‐L size of the volume [kKmMgGtT] ‐l number of extents ‐C contiguous [y|n] ‐i stripes ‐I stripe size ‐m mirrors ‐‐mirrorlog ‐n volume name extending lvextend ‐L 20M /dev/VolData00/vol01 Common Attributes that you may want to use: ‐L size of the volume [kKmMgGtT] ‐l number of extents ‐C contiguous [y|n] ‐i stripes ‐I stripe size
  • 4. 7/6/2015 RedHat ­ LVM cheatsheet http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm 4/5 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 adding a mirror to a non‐ mirrored volume lvconvert ‐m1 ‐‐mirrorlog core /dev/VolData00/vol01 /dev/sdb2 Note: you can also use the above command to remove a unwanted log removing a mirror from a mirrored volume lvconvert ‐m0 /dev/VolData00/vol01 /dev/sdb2 Note: the disk in the command is the one you want to remove Mirror a volume that has stripes lvconvert ‐‐stripes 3 ‐m1 ‐‐mirrorlog core /dev/VolData00/data01 /dev/sdd1 /dev/sde1 /devsdf1 change volume attributes lvchange ‐a n /dev/VolData00/vol01 Common Attributes that you may want to use: ‐a availability ‐C contiguous [y|n] renaming lvrename /dev/VolData00/vol_old /dev/VolData00/vol_new snapshotting lvcreate ‐‐size 100M ‐‐snapshot ‐name snap /dev/vg01/data01 Miscellaneous Simulating a disk failure dd if=/dev/zero of=/dev/sdb2 count=10 reparing a failed mirror no LVM corruption ## check volume, persume /dev/sdb2 has failed lvs ‐a ‐o +devices # remove the failed disk from the volume (if not already done so) , this will convert volume into a non‐mirrored volume vgreduce ‐‐removemissing ‐‐force VolData00 ## replace the disk physically, remember to partion it with type 8e fdisk /dev/sdb ........ ## add new disk to LVM pvcreate /dev/sdb2 ## add the disk back into volume group vgextend VolData00 /dev/sdb2 ## mirror up the volume lvconvert ‐m1 ‐‐mirrorlog core /dev/VolData00/vol02 /dev/sdb2 corrupt LVM metadata without replacing drive # attempt to bring the volume group online vgchange ‐a y VolData00 # Restore the LVM configation vgcfgrestore VolData00 # attempt to bring the volume grou online vgchange ‐a y VolData00 # file system check e2fsck /dev/VolData00/data01 # attempt to bring the volume group online but you get UUID conflict errors make note of the UUID number vgchange ‐a y VolData00 vgchange ‐a n VolData00 ## sometimes it my only be a logical volume problem lvchange ‐a y /dev/VolData00/web02 lvchange ‐a n /dev/Voldata00/web02
  • 5. 7/6/2015 RedHat ­ LVM cheatsheet http://www.datadisk.co.uk/html_docs/redhat/rh_lvm.htm 5/5 corrupt LVM metadata but replacing the faulty disk ## replace the disk physically, remember to partion it with type 8e fdisk /dev/sdb ........ # after replacing the faulty drive the disk must have the previuos UUID number or you can get it from /etc/lvm directory pvcreate ‐‐uuid <previous UUID number taken from above command> /dev/sdb2 # Restore the LVM configation vgcfgrestore VolData00 # attempt to bring the volume group online or logical volume vgchange ‐a y VolData00 lvchange ‐a y /dev/VolData00/web02 # file system check e2fsck /dev/VolData00/data01 Note: if you have backed the volume group configuration you can obtain the UUID number in the backup file by default located in /etc/lvm/backup or running "pvs ‐v" For other LVM's and Array utilities see my LVM central page