LVM Administrator's GuideConfiguration and Administration
Chapter 1. The LVM Logical VolumeManagerThis chapter provides a high-level overview of the components of the Logical Volume Manager(LVM).1. Logical Vo
Using logical volumes, you can take device snapshots for consistent backups or to test theeffect of changes without affecting the real data.The implem
Figure 1.1. LVM Logical Volume ComponentsFor detailed information on the components of an LVM logical volume, see Chapter 2, LVMComponents.3. Running
Figure 1.2. CLVM OverviewLogical volumes created with CLVM on shared storage are visible to all computers that have ac-cess to the shared storage.CLVM
This remainder of this document includes the following chapters:• Chapter 2, LVM Components describes the components that make up an LVM logicalvolume
Chapter 2. LVM ComponentsThis chapter describes the components of an LVM Logical volume.1. Physical VolumesThe underlying physical storage unit of an
512 bytes in size.Figure 2.1. Physical Volume layout1.2. Multiple Partitions on a DiskLVM allows you to create physical volumes out of disk partitions
striped volumes.2. Volume GroupsPhysical volumes are combined into volume groups (VGs). This creates a pool of disk space outof which logical volumes
Figure 2.2. Extent MappingThe physical volumes that make up a logical volume do not have to be the same size. Fig-ure 2.3, “Linear Volume with Unequal
Figure 2.3. Linear Volume with Unequal Physical VolumesYou can configure more than one linear logical volume of whatever size you desire from thepool
LVM Administrator's Guide: Configuration and AdministrationCopyright © 2007 Red Hat, Inc.This book describes the LVM logical volume manager, incl
3.2. Striped Logical VolumesWhen you write data to an LVM logical volume, the file system lays the data out across the un-derlying physical volumes. Y
space on the underlying physical volumes that make up the volume group to support the stripe.For example, if you have a two-way stripe that uses up an
NoteMirrored logical volumes are not currently supported in a cluster.For information on creating and modifying mirrors, see Section 4.1.3, “Creating
• You can execute the fsck command on a snapshot file system to check the file system integ-rity and determine whether the original file system requir
Chapter 3. LVM AdministrationOverviewThis chapter provides an overview of the administrative procedures you use to configure LVMlogical volumes. This
that use the storage have local copies, but can recreate that from what is on the physicalvolumes. You can attach physical volumes to a different serv
• external log functionThe logging levels are set in the /etc/lvm/lvm.conf file, which is described in Appendix B, TheLVM Configuration Files.5. Loggi
Chapter 4. LVM Administration withCLI CommandsThis chapter summarizes the individual administrative tasks you can perform with the LVMCommand Line Int
tails about the command execution. The -vvvv argument provides the maximum amount of in-formation at this time. The following example shows only the f
dd if=/dev/zero of=PhysicalVolume bs=512 count=12.1.2. Initializing Physical VolumesUse the pvcreate command to initialize a block device to be used a
2.2. Displaying Physical VolumesThere are three commands you can use to display properties of LVM physical volumes: pvs,pvdisplay, and pvscan.The pvs
previously been disallowed.2.4. Resizing a Physical VolumeIf you need to change the size of an underlying block device for any reason, use the pvresiz
The contiguous policy requires that new extents are adjacent to existing extents. If there are suf-ficient free extents to satisfy an allocation reque
The vgdisplay command displays volume group properties (such as size, extents, number ofphysical volumes, etc.) in a fixed form. The following example
vgreduce command shrinks a volume group's capacity by removing one or more empty physicalvolumes. This frees those physical volumes to be used in
The following example deactivates the volume group my_volume_group.vgchange -a n my_volume_groupIf clustered locking is enabled, add ’e’ to activate o
Metadata backups and archives are automatically created on every volume group and logicalvolume configuration change unless disabled in the lvm.conf f
When the system is next shut down, you can unplug the disks that constitute the volumegroup and connect them to the new system.4. When the disks are p
The following command creates a 50 gigabyte logical volume named gfslv from the free extentsin volume group vg0.lvcreate -L 50G -n gfslv vg0You can us
lvcreate -l 100 -n testlv testvg /dev/sda1:0-25 /dev/sdb1:50-125The following example creates a linear logical volume out of extents 0 through 25 of p
Table of ContentsIntroduction ... vii1. Abo
copies of the file system: a linear logical volume plus one copy. Similarly, specifying -m2 createstwo mirrors, yielding three copies of the file syst
4.1.4. Changing Mirrored Volume ConfigurationYou can convert a logical volume from a mirrored volume to a linear volume or from a linearvolume to a mi
lvreduce -l -3 vg00/lvol14.4. Changing the Parameters of a Logical Volume GroupTo change the parameters of a logical volume, use the lvchange command.
There are three commands you can use to display properties of LVM logical volumes: lvs,lvdisplay, and lvscan.The lvs command provides logical volume i
testlv to fill all of the unallocated space in the volume group myvg.[root@tng3-1 ~]# lvextend -l +100%FREE /dev/myvg/testlvExtending logical volume t
At this point you cannot extend the striped logical volume to the full size of the volume group,because two underlying devices are needed in order to
al extents.lvreduce -l -3 vg00/lvol15. Creating Snapshot VolumesUse the -s argument of the lvcreate command to create a snapshot volume. A snapshotvol
NoteBecause the snapshot increases in size as the origin volume changes, it is import-ant to monitor the percentage of the snapshot volume regularly w
filter = [ "a|^/dev/hda8$|", "r/.*/" ]For more information on the lvm.conf file, see Appendix B, The LVM Configuration Files and t
To activate logical volumes exclusively on one node, use the lvchange -aey command. Alternat-ively, you can use lvchange -aly command to activate logi
3.10. Combining Volume Groups ...263.11. Backing Up Volume Group Metadata ...
the -o argument.The following example displays the UUID of the physical volume in addition to the defaultfields.# pvs -o +pv_uuidPV VG Fmt Attr PSize
volume that would otherwise not appear in the output. For information on the output this argu-ment yields, see Section 2, “Displaying Information on F
Argument Header Descriptionpv_pe_count PE Number of physical extentspvseg_size SSize The segment size of the physical volumepvseg_start Start The star
/dev/sda1 vg lvm2 a- 17.14G 16.75G 126 24/dev/sda1 vg lvm2 a- 17.14G 16.75G 150 22/dev/sda1 vg lvm2 a- 17.14G 16.75G 172 4217/dev/sdb1 vg lvm2 a- 17.1
Argument Header Descriptionvg_fmt Fmt The metadata format of the volume group (lvm2 or lvm1)vg_free VFree Size of the free space remaining in the volu
Argument Header Descriptionphysical volumes, logical volumes, and start physical extentsand logical extentslv_attr Attr The status of the logical volu
Argument Header Descriptionseg_size SSize The size of the segments in the logical volumeseg_start Start Offset of the segment in the logical volumeseg
Using the -v argument with the lvs --segments command adds the following fields to the defaultdisplay: seg_start, stripesize, chunksize.# lvs -v --seg
To display a reverse sort, precede a field you specify after the -O argument with the - character.# pvs -o pv_name,pv_size,pv_free -O -pv_freePV PSize
The following example displays the output of the pvs command in units of 4 megabytes.# pvs --units 4mPV VG Fmt Attr PSize PFree/dev/sdb1 new_vg lvm2 a
4. Recovering Physical Volume Metadata ...635. Replacing a Missing Physical Volume ...
Chapter 5. LVM ConfigurationExamplesThis chapter provides some basic LVM configuration examples.1. Creating an LVM Logical Volume on ThreeDisksThis ex
Logical volume "new_logical_volume" created1.4. Creating the File SystemThe following command creates a GFS file system on the logical volum
[root@tng3-1 ~]# vgcreate striped_vol_group /dev/sda1 /dev/sdb1 /dev/sdc1Volume group "striped_vol_group" successfully createdYou can use th
unused space on the physical volumes, a new volume group can be created without adding newdisks.In the initial set up, the logical volume mylv is carv
group yourvg.[root@tng3-1 ~]# lvchange -a n /dev/myvg/mylv[root@tng3-1 ~]# vgsplit myvg yourvg /dev/sdc1Volume group "yourvg" successfully s
4. Removing a Disk from a Logical VolumeThis example shows how you can remove a disk from an existing logical volume, either to re-place the disk or t
4.2. Moving Extents to a New DiskIn this example, the logical volume is distributed across three physical volumes in the volumegroup myvg as follows:[
[root@tng3-1 ~]# vgreduce myvg /dev/sdb1Removed "/dev/sdb1" from volume group "myvg"You can now reallocate the disk to another vol
Chapter 6. LVM TroubleshootingThis chapter provide instructions for troubleshooting a variety of LVM issues.1. Troubleshooting DiagnosticsIf a command
In this example, the failed device caused both a linear and a striped logical volume in thevolume group to fail. The lvs command without the -P argume
Introduction1. About This GuideThis book describes the Logical Volume Manager (LVM), including information on running LVMin a clustered environment. T
Physical volume "/dev/sdf2" successfully createdPhysical volume "/dev/sdg1" successfully createdPhysical volume "/dev/sdg2&qu
[root@link-08 ~]# pvcreate /dev/sda[12]Physical volume "/dev/sda1" successfully createdPhysical volume "/dev/sda2" successfully cr
4. Recovering Physical Volume MetadataIf the volume group metadata area of a physical volume is accidentally overwritten or otherwisedestroyed, you wi
Physical volume "/dev/sdh1" successfully createdYou can then use the vgcfgrestore command to restore the volume group's metadata.[root@
Like most LVM operations, the vgreduce command is reversible in a sense if you immediatelyuse the vgcfgrestore command to restore the volume group met
Chapter 7. LVM Administration withthe LVM GUIIn addition to the Command Line Interface (CLI), LVM provides a Graphical User Interface (GUI)which you c
Appendix A. The Device MapperThe Device Mapper is a kernel driver that provides a generic framework for volume manage-ment. It provides a generic way
Appendix B. The LVMConfiguration FilesLVM supports multiple configuration files. At system startup, the lvm.conf configuration file isloaded from the
# This is an example configuration file for the LVM2 system.# It contains the default settings that would be used if there was no# /etc/lvm/lvm.conf f
# Advanced settings.# List of pairs of additional acceptable block device types found# in /proc/devices with maximum (non-zero) number of partitions.#
• Using GNBD with Global File System — Provides an overview on using Global NetworkBlock Device (GNBD) with Red Hat GFS.• Linux Virtual Server Adminis
# Backups are stored in a human readable text format.backup {# Should we maintain a backup of the current metadata configuration ?# Use 1 for Yes; 0 f
# The default metadata format that commands should use - "lvm1" or "lvm2".# The command line override is -M1 or -M2.# Defaults to
# Size (in KB) of each copy operation when mirroringmirror_region_size = 512# 'mirror_image_fault_policy' and 'mirror_log_fault_policy&
# pvmetadatasize = 255# List of directories holding live copies of text format metadata.# These directories must not be on logical volumes!# It's
Appendix C. LVM Object TagsAn LVM tag is a word that can be used to group LVM2 objects of the same type together. Tagscan be attached to objects such
3. Controlling Activation with TagsYou can specify in the configuration file that only certain logical volumes should be activated onthat host. For ex
Appendix D. LVM Volume GroupMetadataThe configuration details of a volume group are referred to as the metadata. By default, anidentical copy of the m
The volume group metadata contains:• Information about how and when it was created• Information about the volume group:The volume group information co
extent_size = 8192 # 4 Megabytesmax_lv = 0max_pv = 0physical_volumes {pv0 {id = "ZBW5qW-dXF2-0bGw-ZCad-2RlV-phwu-1c1RFt"device = "/dev/
type = "striped"stripe_count = 1 # linearstripes = ["pv1", 0]}}}}3. Sample Metadata80
TipA tip is typically an alternative way of performing a task.ImportantImportant information is necessary, but possibly unexpected, such as a configur
IndexAactivating logical volumesindividual nodes, 39activating volume groups, 25individual nodes, 26local node only, 26administrative procedures, 15al
creation example, 51definition, 1, 8displaying, 33, 40, 45exclusive access, 39extending, 34growing, 34linear, 28local access, 39lvs display arguments,
renaminglogical volume, 33volume group, 27report format, LVM devices, 40resizinglogical volume, 32physical volume, 22Sscanningblock devices, 20scannin
Commentaires sur ces manuels