Cari di RHE Linux 
    Red Hat Enterprise Linux Manual
Daftar Isi
(Sebelumnya) 9 : Chapter 3. Setting Up Load ...10 : Chapter 2. LVM Components (Berikutnya)

Logical Volume Manager Administration

LVM Administrator Guide

Edition 1

Legal Notice

Copyright © 2013 Red Hat, Inc. and others.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution-Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
All other trademarks are the property of their respective owners.


1801 Varsity Drive
RaleighNC 27606-2072 USA
Phone: +1 919 754 3700
Phone: 888 733 4281
Fax: +1 919 754 3701

Legal Notice

Copyright © 2013 Red Hat, Inc. and others.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution-Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
All other trademarks are the property of their respective owners.


1801 Varsity Drive
RaleighNC 27606-2072 USA
Phone: +1 919 754 3700
Phone: 888 733 4281
Fax: +1 919 754 3701

Daftar Isi

Abstract

This book describes the LVM logical volume manager, including information on running LVM in a clustered environment.
Introduction
1. About This Guide
2. Audience
3. Software Versions
4. Related Documentation
5. We Need Feedback!
6. Document Conventions
6.1. Typographic Conventions
6.2. Pull-quote Conventions
6.3. Notes and Warnings
1. The LVM Logical Volume Manager
1.1. New and Changed Features
1.1.1. New and Changed Features for Red Hat Enterprise Linux 6.0
1.1.2. New and Changed Features for Red Hat Enterprise Linux 6.1
1.1.3. New and Changed Features for Red Hat Enterprise Linux 6.2
1.1.4. New and Changed Features for Red Hat Enterprise Linux 6.3
1.1.5. New and Changed Features for Red Hat Enterprise Linux 6.4
1.2. Logical Volumes
1.3. LVM Architecture Overview
1.4. The Clustered Logical Volume Manager (CLVM)
1.5. Document Overview
2. LVM Components
2.1. Physical Volumes
2.1.1. LVM Physical Volume Layout
2.1.2. Multiple Partitions on a Disk
2.2. Volume Groups
2.3. LVM Logical Volumes
2.3.1. Linear Volumes
2.3.2. Striped Logical Volumes
2.3.3. Mirrored Logical Volumes
2.3.4. Thinly-Provisioned Logical Volumes (Thin Volumes)
2.3.5. Snapshot Volumes
2.3.6. Thinly-Provisioned Snapshot Volumes
3. LVM Administration Overview
3.1. Creating LVM Volumes in a Cluster
3.2. Logical Volume Creation Overview
3.3. Growing a File System on a Logical Volume
3.4. Logical Volume Backup
3.5. Logging
3.6. The Metadata Daemon (lvmetad)
4. LVM Administration with CLI Commands
4.1. Using CLI Commands
4.2. Physical Volume Administration
4.2.1. Creating Physical Volumes
4.2.2. Displaying Physical Volumes
4.2.3. Preventing Allocation on a Physical Volume
4.2.4. Resizing a Physical Volume
4.2.5. Removing Physical Volumes
4.3. Volume Group Administration
4.3.1. Creating Volume Groups
4.3.2. LVM Allocation
4.3.3. Creating Volume Groups in a Cluster
4.3.4. Adding Physical Volumes to a Volume Group
4.3.5. Displaying Volume Groups
4.3.6. Scanning Disks for Volume Groups to Build the Cache File
4.3.7. Removing Physical Volumes from a Volume Group
4.3.8. Changing the Parameters of a Volume Group
4.3.9. Activating and Deactivating Volume Groups
4.3.10. Removing Volume Groups
4.3.11. Splitting a Volume Group
4.3.12. Combining Volume Groups
4.3.13. Backing Up Volume Group Metadata
4.3.14. Renaming a Volume Group
4.3.15. Moving a Volume Group to Another System
4.3.16. Recreating a Volume Group Directory
4.4. Logical Volume Administration
4.4.1. Creating Linear Logical Volumes
4.4.2. Creating Striped Volumes
4.4.3. Creating Mirrored Volumes
4.4.4. Creating Thinly-Provisioned Logical Volumes
4.4.5. Creating Snapshot Volumes
4.4.6. Creating Thinly-Provisioned Snapshot Volumes
4.4.7. Merging Snapshot Volumes
4.4.8. Persistent Device Numbers
4.4.9. Resizing Logical Volumes
4.4.10. Changing the Parameters of a Logical Volume Group
4.4.11. Renaming Logical Volumes
4.4.12. Removing Logical Volumes
4.4.13. Displaying Logical Volumes
4.4.14. Growing Logical Volumes
4.4.15. RAID Logical Volumes
4.4.16. Shrinking Logical Volumes
4.5. Controlling LVM Device Scans with Filters
4.6. Online Data Relocation
4.7. Activating Logical Volumes on Individual Nodes in a Cluster
4.8. Customized Reporting for LVM
4.8.1. Format Control
4.8.2. Object Selection
4.8.3. Sorting LVM Reports
4.8.4. Specifying Units
5. LVM Configuration Examples
5.1. Creating an LVM Logical Volume on Three Disks
5.1.1. Creating the Physical Volumes
5.1.2. Creating the Volume Group
5.1.3. Creating the Logical Volume
5.1.4. Creating the File System
5.2. Creating a Striped Logical Volume
5.2.1. Creating the Physical Volumes
5.2.2. Creating the Volume Group
5.2.3. Creating the Logical Volume
5.2.4. Creating the File System
5.3. Splitting a Volume Group
5.3.1. Determining Free Space
5.3.2. Moving the Data
5.3.3. Splitting the Volume Group
5.3.4. Creating the New Logical Volume
5.3.5. Making a File System and Mounting the New Logical Volume
5.3.6. Activating and Mounting the Original Logical Volume
5.4. Removing a Disk from a Logical Volume
5.4.1. Moving Extents to Existing Physical Volumes
5.4.2. Moving Extents to a New Disk
5.5. Creating a Mirrored LVM Logical Volume in a Cluster
6. LVM Troubleshooting
6.1. Troubleshooting Diagnostics
6.2. Displaying Information on Failed Devices
6.3. Recovering from LVM Mirror Failure
6.4. Recovering Physical Volume Metadata
6.5. Replacing a Missing Physical Volume
6.6. Removing Lost Physical Volumes from a Volume Group
6.7. Insufficient Free Extents for a Logical Volume
7. LVM Administration with the LVM GUI
A. The Device Mapper
A.1. Device Table Mappings
A.1.1. The linear Mapping Target
A.1.2. The striped Mapping Target
A.1.3. The mirror Mapping Target
A.1.4. The snapshot and snapshot-origin Mapping Targets
A.1.5. The error Mapping Target
A.1.6. The zero Mapping Target
A.1.7. The multipath Mapping Target
A.1.8. The crypt Mapping Target
A.2. The dmsetup Command
A.2.1. The dmsetup info Command
A.2.2. The dmsetup ls Command
A.2.3. The dmsetup status Command
A.2.4. The dmsetup deps Command
A.3. Device Mapper Support for the udev Device Manager
A.3.1. udev Integration with the Device Mapper
A.3.2. Commands and Interfaces that Support udev
B. The LVM Configuration Files
B.1. The LVM Configuration Files
B.2. Sample lvm.conf File
C. LVM Object Tags
C.1. Adding and Removing Object Tags
C.2. Host Tags
C.3. Controlling Activation with Tags
D. LVM Volume Group Metadata
D.1. The Physical Volume Label
D.2. Metadata Contents
D.3. Sample Metadata
E. Revision History
Index

Introduction

1. About This Guide

This book describes the Logical Volume Manager (LVM), including information on running LVM in a clustered environment.

2. Audience

This book is intended to be used by system administrators managing systems running the Linux operating system. It requires familiarity with Red Hat Enterprise Linux 6 and GFS2 file system administration.

3. Software Versions

Table 1. Software Versions

SoftwareDescription
Red Hat Enterprise Linux 6
refers to Red Hat Enterprise Linux 6 and higher
GFS2
refers to GFS2 for Red Hat Enterprise Linux 6 and higher

4. Related Documentation

For more information about using Red Hat Enterprise Linux, refer to the following resources:
  • Installation Guide - Documents relevant information regarding the installation of Red Hat Enterprise Linux 6.
  • Deployment Guide - Documents relevant information regarding the deployment, configuration and administration of Red Hat Enterprise Linux 6.
  • Storage Administration Guide - Provides instructions on how to effectively manage storage devices and file systems on Red Hat Enterprise Linux 6.
For more information about the High Availability Add-On and the Resilient Storage Add-On for Red Hat Enterprise Linux 6, refer to the following resources:
  • High Availability Add-On Overview - Provides a high-level overview of the Red Hat High Availability Add-On.
  • Cluster Administration - Provides information about installing, configuring and managing the Red Hat High Availability Add-On,
  • Global File System 2: Configuration and Administration - Provides information about installing, configuring, and maintaining Red Hat GFS2 (Red Hat Global File System 2), which is included in the Resilient Storage Add-On.
  • DM Multipath - Provides information about using the Device-Mapper Multipath feature of Red Hat Enterprise Linux 6.
  • Load Balancer Administration - Provides information on configuring high-performance systems and services with the Load Balancer Add-On, a set of integrated software components that provide Linux Virtual Servers (LVS) for balancing IP load across a set of real servers.
  • Release Notes - Provides information about the current release of Red Hat products.
High Availability Add-On documentation and other Red Hat documents are available in HTML, PDF, and RPM versions on the Red Hat Enterprise Linux Documentation CD and online at http://docs.redhat.com/docs/en-US/index.html.

5. We Need Feedback!

If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in Bugzilla: http://bugzilla.redhat.com/ against the product Red Hat Enterprise Linux 6 and the component doc-Logical_Volume_Manager. When submitting a bug report, be sure to mention the manual's identifier:
Logical_Volume_Manager_Administration(EN)-6 (2013-2-15-15:20)
If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, please include the section number and some of the surrounding text so we can find it easily.

6. Document Conventions

This manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information.
In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. The Liberation Fonts set is also used in HTML editions if the set is installed on your system. If not, alternative but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later includes the Liberation Fonts set by default.

6.1. Typographic Conventions

Four typographic conventions are used to call attention to specific words and phrases. These conventions, and the circumstances they apply to, are as follows.
Mono-spaced Bold
Used to highlight system input, including shell commands, file names and paths. Also used to highlight keys and key combinations. For example:
To see the contents of the file my_next_bestselling_novel in your current working directory, enter the cat my_next_bestselling_novel command at the shell prompt and press Enter to execute the command.
The above includes a file name, a shell command and a key, all presented in mono-spaced bold and all distinguishable thanks to context.
Key combinations can be distinguished from an individual key by the plus sign that connects each part of a key combination. For example:
Press Enter to execute the command.
Press Ctrl+Alt+F2 to switch to a virtual terminal.
The first example highlights a particular key to press. The second example highlights a key combination: a set of three keys pressed simultaneously.
If source code is discussed, class names, methods, functions, variable names and returned values mentioned within a paragraph will be presented as above, in mono-spaced bold. For example:
File-related classes include filesystem for file systems, file for files, and dir for directories. Each class has its own associated set of permissions.
Proportional Bold
This denotes words or phrases encountered on a system, including application names; dialog box text; labeled buttons; check-box and radio button labels; menu titles and sub-menu titles. For example:
Choose SystemPreferencesMouse from the main menu bar to launch Mouse Preferences. In the Buttons tab, click the Left-handed mouse check box and click Close to switch the primary mouse button from the left to the right (making the mouse suitable for use in the left hand).
To insert a special character into a gedit file, choose ApplicationsAccessoriesCharacter Map from the main menu bar. Next, choose SearchFind . . . . . . from the Character Map menu bar, type the name of the character in the Search field and click Next. The character you sought will be highlighted in the Character Table. Double-click this highlighted character to place it in the Text to copy field and then click the Copy button. Now switch back to your document and choose EditPaste from the gedit menu bar.
The above text includes application names; system-wide menu names and items; application-specific menu names; and buttons and text found within a GUI interface, all presented in proportional bold and all distinguishable by context.
Mono-spaced Bold Italic or Proportional Bold Italic
Whether mono-spaced bold or proportional bold, the addition of italics indicates replaceable or variable text. Italics denotes text you do not input literally or displayed text that changes depending on circumstance. For example:
To connect to a remote machine using ssh, type ssh username@domain.name at a shell prompt. If the remote machine is example.com and your username on that machine is john, type ssh [email protected].
The mount -o remount file-system command remounts the named file system. For example, to remount the /home file system, the command is mount -o remount /home.
To see the version of a currently installed package, use the rpm -q package command. It will return a result as follows: package-version-release.
Note the words in bold italics above - username, domain.name, file-system, package, version and release. Each word is a placeholder, either for text you enter when issuing a command or for text displayed by the system.
Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and important term. For example:
Publican is a DocBook publishing system.

6.2. Pull-quote Conventions

Terminal output and source code listings are set off visually from the surrounding text.
Output sent to a terminal is set in mono-spaced roman and presented thus:
books Desktop   documentation  drafts  mss photos   stuff  svnbooks_tests  Desktop1  downloads  images  notes  scripts  svgs
Source-code listings are also set in mono-spaced roman but add syntax highlighting as follows:
package org.jboss.book.jca.ex1;import javax.naming.InitialContext;public class ExClient{   public static void main(String args[]) throws Exception   {  InitialContext iniCtx = new InitialContext();  Object ref = iniCtx.lookup("EchoBean");  EchoHome   home   = (EchoHome) ref;  Echo   echo   = home.create();  System.out.println("Created Echo");  System.out.println("Echo.echo('Hello') = " + echo.echo("Hello"));   }}

6.3. Notes and Warnings

Finally, we use three visual styles to draw attention to information that might otherwise be overlooked.

Note

Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note should have no negative consequences, but you might miss out on a trick that makes your life easier.

Important

Important boxes detail things that are easily missed: configuration changes that only apply to the current session, or services that need restarting before an update will apply. Ignoring a box labeled 'Important' will not cause data loss but may cause irritation and frustration.

Warning

Warnings should not be ignored. Ignoring warnings will most likely cause data loss.

Chapter 1. The LVM Logical Volume Manager

This chapter provides a summary of the features of the LVM logical volume manager that are new for the initial and subsequent releases of Red Hat Enterprise Linux 6. Following that, this chapter provides a high-level overview of the components of the Logical Volume Manager (LVM).

1.1. New and Changed Features

This section lists new and changed features of the LVM logical volume manager that are included with the initial and subsequent releases of Red Hat Enterprise Linux 6.

1.1.1. New and Changed Features for Red Hat Enterprise Linux 6.0

Red Hat Enterprise Linux 6.0 includes the following documentation and feature updates and changes.
  • You can define how a mirrored logical volume behaves in the event of a device failure with the mirror_image_fault_policy and mirror_log_fault_policy parameters in the activation section of the lvm.conf file. When this parameter is set to remove, the system attempts to remove the faulty device and run without it. When this parameter is set to allocate, the system attempts to remove the faulty device and tries to allocate space on a new device to be a replacement for the failed device; this policy acts like the remove policy if no suitable device and space can be allocated for the replacement. For information on the LVM mirror failure policies, see Section 4.4.3.1, "Mirrored Logical Volume Failure Policy".
  • For the Red Hat Enterprise Linux 6 release, the Linux I/O stack has been enhanced to process vendor-provided I/O limit information. This allows storage management tools, including LVM, to optimize data placement and access. This support can be disabled by changing the default values of data_alignment_detection and data_alignment_offset_detection in the lvm.conf file, although disabling this support is not recommended.
    For information on data alignment in LVM as well as information on changing the default values of data_alignment_detection and data_alignment_offset_detection, see the inline documentation for the /etc/lvm/lvm.conf file, which is also documented in Appendix B, The LVM Configuration Files. For general information on support for the I/O Stack and I/O limits in Red Hat Enterprise Linux 6, see the Storage Administration Guide.
  • In Red Hat Enterprise Linux 6, the Device Mapper provides direct support for udev integration. This synchronizes the Device Mapper with all udev processing related to Device Mapper devices, including LVM devices. For information on Device Mapper support for the udev device manager, see Section A.3, "Device Mapper Support for the udev Device Manager".
  • For the Red Hat Enterprise Linux 6 release, you can use the lvconvert --repair command to repair a mirror after disk failure. This brings the mirror back into a consistent state. For information on the lvconvert --repair command, see Section 4.4.3.3, "Repairing a Mirrored Logical Device".
  • As of the Red Hat Enterprise Linux 6 release, you can use the --merge option of the lvconvert command to merge a snapshot into its origin volume. For information on merging snapshots, see Section 4.4.7, "Merging Snapshot Volumes".
  • As of the Red Hat Enterprise Linux 6 release, you can use the --splitmirrors argument of the lvconvert command to split off a redundant image of a mirrored logical volume to form a new logical volume. For information on using this option, see Section 4.4.3.2, "Splitting Off a Redundant Image of a Mirrored Logical Volume".
  • You can now create a mirror log for a mirrored logical device that is itself mirrored by using the --mirrorlog mirrored argument of the lvcreate command when creating a mirrored logical device. For information on using this option, see Section 4.4.3, "Creating Mirrored Volumes".

1.1.2. New and Changed Features for Red Hat Enterprise Linux 6.1

Red Hat Enterprise Linux 6.1 includes the following documentation and feature updates and changes.
  • The Red Hat Enterprise Linux 6.1 release supports the creation of snapshot logical volumes of mirrored logical volumes. You create a snapshot of a mirrored volume just as you would create a snapshot of a linear or striped logical volume. For information on creating snapshot volumes, see Section 4.4.5, "Creating Snapshot Volumes".
  • When extending an LVM volume, you can now use the --alloc cling option of the lvextend command to specify the cling allocation policy. This policy will choose space on the same physical volumes as the last segment of the existing logical volume. If there is insufficient space on the physical volumes and a list of tags is defined in the lvm.conf file, LVM will check whether any of the tags are attached to the physical volumes and seek to match those physical volume tags between existing extents and new extents.
    For information on extending LVM mirrored volumes with the --alloc cling option of the lvextend command, see Section 4.4.14.3, "Extending a Logical Volume with the cling Allocation Policy".
  • You can now specify multiple --addtag and --deltag arguments within a single pvchange, vgchange, or lvchange command. For information on adding and removing object tags, see Section C.1, "Adding and Removing Object Tags".
  • The list of allowed characters in LVM object tags has been extended, and tags can contain the "/", "=", "!", ":", "#", and "&" characters. For information on LVM object tags, see Appendix C, LVM Object Tags.
  • You can now combine RAID0 (striping) and RAID1 (mirroring) in a single logical volume. Creating a logical volume while simultaneously specifying the number of mirrors (--mirrors X) and the number of stripes (--stripes Y) results in a mirror device whose constituent devices are striped. For information on creating mirrored logical volumes, see Section 4.4.3, "Creating Mirrored Volumes".
  • As of the Red Hat Enterprise Linux 6.1 release, if you need to create a consistent backup of data on a clustered logical volume you can activate the volume exclusively and then create the snapshot. For information on activating logical volumes exclusively on one node, see Section 4.7, "Activating Logical Volumes on Individual Nodes in a Cluster".

1.1.3. New and Changed Features for Red Hat Enterprise Linux 6.2

Red Hat Enterprise Linux 6.2 includes the following documentation and feature updates and changes.
  • The Red Hat Enterprise Linux 6.2 release supports the issue_discards parameter in the lvm.conf configuration file. When this parameter is set, LVM will issue discards to a logical volume's underlying physical volumes when the logical volume is no longer using the space on the physical volumes. For information on this parameter, refer to the inline documentation for the /etc/lvm/lvm.conf file, which is also documented in Appendix B, The LVM Configuration Files.

1.1.4. New and Changed Features for Red Hat Enterprise Linux 6.3

Red Hat Enterprise Linux 6.3 includes the following documentation and feature updates and changes.
  • As of the Red Hat Enterprise Linux 6.3 release, LVM supports RAID4/5/6 and a new implementation of mirroring. For information on RAID logical volumes, refer to Section 4.4.15, "RAID Logical Volumes".
  • When you are creating a new mirror that does not need to be revived, you can specify the --nosync argument to indicate that an initial synchronization from the first device is not required. For information on creating mirrored volumes, refer to Section 4.4.3, "Creating Mirrored Volumes".
  • This manual now documents the snapshot autoextend feature. For information on creating snapshot volumes, refer to Section 4.4.5, "Creating Snapshot Volumes".

1.1.5. New and Changed Features for Red Hat Enterprise Linux 6.4

Red Hat Enterprise Linux 6.4 includes the following documentation and feature updates and changes.
  • Logical volumes can now be thinly provisioned. This allows you to create logical volumes that are larger than the available extents. Using thin provisioning, you can manage a storage pool of free space, known as a thin pool, to be allocated to an arbitrary number of devices when needed by applications. You can then create devices that can be bound to the thin pool for later allocation when an application actually writes to the logical volume. The thin pool can be expanded dynamically when needed for cost-effective allocation of storage space.
    For general information on thinly-provisioned logical volumes, refer to Section 2.3.4, "Thinly-Provisioned Logical Volumes (Thin Volumes)". For information on creating thin volumes, refer to Section 4.4.4, "Creating Thinly-Provisioned Logical Volumes".
  • The Red Hat Enterprise Linux release 6.4 version of LVM provides support for thinly-provisioned snapshot volumes. Thin snapshot volumes allow many virtual devices to be stored on the same data volume. This simplifies administration and allows for the sharing of data between snapshot volumes.
    For general information on thinly-provisioned snapshot volumes, refer to Section 2.3.6, "Thinly-Provisioned Snapshot Volumes". For information on creating thin snapshot volumes, refer to Section 4.4.6, "Creating Thinly-Provisioned Snapshot Volumes".
  • This document includes a new section detailing LVM allocation policy, Section 4.3.2, "LVM Allocation".
  • LVM now provides support for raid10 logical volumes. For information on RAID logical volumes, refer to Section 4.4.15, "RAID Logical Volumes".
  • The LVM metadata daemon, lvmetad, is supported in Red Hat Enterprise Linux release 6.4. Enabling this daemon reduces the amount of scanning on systems with many block devices. The lvmetad daemon is not currently supported across the nodes of a cluster, and requires that the locking type be local file-based locking.
    For information on the metadata daemon, refer to Section 3.6, "The Metadata Daemon (lvmetad)".
In addition, small technical corrections and clarifications have been made throughout the document.

1.2. Logical Volumes

Volume management creates a layer of abstraction over physical storage, allowing you to create logical storage volumes. This provides much greater flexibility in a number of ways than using physical storage directly. With a logical volume, you are not restricted to physical disk sizes. In addition, the hardware storage configuration is hidden from the software so it can be resized and moved without stopping applications or unmounting file systems. This can reduce operational costs.
Logical volumes provide the following advantages over using physical storage directly:
  • Flexible capacity
    When using logical volumes, file systems can extend across multiple disks, since you can aggregate disks and partitions into a single logical volume.
  • Resizeable storage pools
    You can extend logical volumes or reduce logical volumes in size with simple software commands, without reformatting and repartitioning the underlying disk devices.
  • Online data relocation
    To deploy newer, faster, or more resilient storage subsystems, you can move data while your system is active. Data can be rearranged on disks while the disks are in use. For example, you can empty a hot-swappable disk before removing it.
  • Convenient device naming
    Logical storage volumes can be managed in user-defined groups, which you can name according to your convenience.
  • Disk striping
    You can create a logical volume that stripes data across two or more disks. This can dramatically increase throughput.
  • Mirroring volumes
    Logical volumes provide a convenient way to configure a mirror for your data.
  • Volume Snapshots
    Using logical volumes, you can take device snapshots for consistent backups or to test the effect of changes without affecting the real data.
The implementation of these features in LVM is described in the remainder of this document.

1.3. LVM Architecture Overview

For the Red Hat Enterprise Linux 4 release of the Linux operating system, the original LVM1 logical volume manager was replaced by LVM2, which has a more generic kernel framework than LVM1. LVM2 provides the following improvements over LVM1:
  • flexible capacity
  • more efficient metadata storage
  • better recovery format
  • new ASCII metadata format
  • atomic changes to metadata
  • redundant copies of metadata
LVM2 is backwards compatible with LVM1, with the exception of snapshot and cluster support. You can convert a volume group from LVM1 format to LVM2 format with the vgconvert command. For information on converting LVM metadata format, see the vgconvert(8) man page.
The underlying physical storage unit of an LVM logical volume is a block device such as a partition or whole disk. This device is initialized as an LVM physical volume (PV).
To create an LVM logical volume, the physical volumes are combined into a volume group (VG). This creates a pool of disk space out of which LVM logical volumes (LVs) can be allocated. This process is analogous to the way in which disks are divided into partitions. A logical volume is used by file systems and applications (such as databases).
Figure 1.1, "LVM Logical Volume Components" shows the components of a simple LVM logical volume:
LVM Logical Volume Components
LVM Logical Volume Components

Figure 1.1. LVM Logical Volume Components


For detailed information on the components of an LVM logical volume, see Chapter 2, LVM Components.

1.4. The Clustered Logical Volume Manager (CLVM)

The Clustered Logical Volume Manager (CLVM) is a set of clustering extensions to LVM. These extensions allow a cluster of computers to manage shared storage (for example, on a SAN) using LVM. CLVM is part of the Resilient Storage Add-On.
Whether you should use CLVM depends on your system requirements:
  • If only one node of your system requires access to the storage you are configuring as logical volumes, then you can use LVM without the CLVM extensions and the logical volumes created with that node are all local to the node.
  • If you are using a clustered system for failover where only a single node that accesses the storage is active at any one time, you should use High Availability Logical Volume Management agents (HA-LVM).
  • If more than one node of your cluster will require access to your storage which is then shared among the active nodes, then you must use CLVM. CLVM allows a user to configure logical volumes on shared storage by locking access to physical storage while a logical volume is being configured, and uses clustered locking services to manage the shared storage.
In order to use CLVM, the High Availability Add-On and Resilient Storage Add-On software, including the clvmd daemon, must be running. The clvmd daemon is the key clustering extension to LVM. The clvmd daemon runs in each cluster computer and distributes LVM metadata updates in a cluster, presenting each cluster computer with the same view of the logical volumes. For information on installing and administering the High Availability Add-On see Cluster Administration.
To ensure that clvmd is started at boot time, you can execute a chkconfig ... on command on the clvmd service, as follows:
# chkconfig clvmd on
If the clvmd daemon has not been started, you can execute a service ... start command on the clvmd service, as follows:
# service clvmd start
Creating LVM logical volumes in a cluster environment is identical to creating LVM logical volumes on a single node. There is no difference in the LVM commands themselves, or in the LVM graphical user interface, as described in Chapter 4, LVM Administration with CLI Commands and Chapter 7, LVM Administration with the LVM GUI. In order to enable the LVM volumes you are creating in a cluster, the cluster infrastructure must be running and the cluster must be quorate.
By default, logical volumes created with CLVM on shared storage are visible to all systems that have access to the shared storage. It is possible to create volume groups in which all of the storage devices are visible to only one node in the cluster. It is also possible to change the status of a volume group from a local volume group to a clustered volume group. For information, see Section 4.3.3, "Creating Volume Groups in a Cluster" and Section 4.3.8, "Changing the Parameters of a Volume Group".

Warning

When you create volume groups with CLVM on shared storage, you must ensure that all nodes in the cluster have access to the physical volumes that constitute the volume group. Asymmetric cluster configurations in which some nodes have access to the storage and others do not are not supported.
Figure 1.2, "CLVM Overview" shows a CLVM overview in a cluster.
CLVM Overview
CLVM Overview

Figure 1.2. CLVM Overview


Note

CLVM requires changes to the lvm.conf file for cluster-wide locking. Information on configuring the lvm.conf file to support clustered locking is provided within the lvm.conf file itself. For information about the lvm.conf file, see Appendix B, The LVM Configuration Files.

1.5. Document Overview

This remainder of this document includes the following chapters:
(Sebelumnya) 9 : Chapter 3. Setting Up Load ...10 : Chapter 2. LVM Components (Berikutnya)