background image

Red Hat Cluster Suite 4.7

Cluster Logical

Volume Manager

LVM Administrator's Guide

Summary of Contents for CLUSTER SUITE 4.7 - CLUSTER LVM ADMINISTRATORS

Page 1: ...Red Hat Cluster Suite 4 7 Cluster Logical Volume Manager LVM Administrator s Guide ...

Page 2: ...the work in any standard paper book form for commercial purposes is prohibited unless prior permission is obtained from the copyright holder Red Hat and the Red Hat Shadow Man logo are registered trademarks of Red Hat Inc in the United States and other countries All other trademarks referenced herein are the property of their respective owners The GPG fingerprint of the security redhat com key is ...

Page 3: ...3 3 2 Logical Volume Creation Overview 13 3 3 Growing a File System on a Logical Volume 14 3 4 Logical Volume Backup 14 3 5 Logging 14 4 LVM Administration with CLI Commands 15 4 1 Using CLI Commands 15 4 2 Physical Volume Administration 16 4 2 1 Creating Physical Volumes 17 4 2 2 Displaying Physical Volumes 18 4 2 3 Preventing Allocation on a Physical Volume 19 4 2 4 Resizing a Physical Volume 19...

Page 4: ... Sorting LVM Reports 47 4 9 4 Specifying Units 48 5 LVM Configuration Examples 51 5 1 Creating an LVM Logical Volume on Three Disks 51 5 1 1 Creating the Physical Volumes 51 5 1 2 Creating the Volume Group 51 5 1 3 Creating the Logical Volume 51 5 1 4 Creating the File System 52 5 2 Creating a Striped Logical Volume 52 5 2 1 Creating the Physical Volumes 52 5 2 2 Creating the Volume Group 53 5 2 3...

Page 5: ...LVM GUI 71 A The Device Mapper 73 B The LVM Configuration Files 75 B 1 The LVM Configuration Files 75 B 2 Sample lvm conf File 75 C LVM Object Tags 85 C 1 Adding and Removing Object Tags 85 C 2 Host Tags 85 C 3 Controlling Activation with Tags 86 D LVM Volume Group Metadata 87 D 1 The Physical Volume Label 87 D 2 Metadata Contents 87 D 3 Sample Metadata 88 E Revision History 91 Index 93 ...

Page 6: ...vi ...

Page 7: ... Hat Enterprise Linux System Administration Guide Provides more detailed information about configuring Red Hat Enterprise Linux to suit your particular needs as a user Red Hat Enterprise Linux Reference Guide Provides detailed information suited for more experienced users to reference when needed as opposed to step by step instructions Red Hat Enterprise Linux Security Guide Details the planning a...

Page 8: ...phic 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 key caps and key combinations For example To see the contents of the file my_next_bestselling_novel in your current working directory enter ...

Page 9: ...in Proportional Bold and all distinguishable by context Note the shorthand used to indicate traversal through a menu and its sub menus This is to avoid the difficult to follow Select Mouse from the Preferences sub menu in the System menu of the main menu bar approach Mono spaced Bold Italic or Proportional Bold Italic Whether Mono spaced Bold or Proportional Bold the addition of Italics indicates ...

Page 10: ...es scripts svgs Source code listings are also set in Mono spaced Roman but are presented and highlighted 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 ...

Page 11: ...ack If you spot a typo 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 bugzilla against the component rh cs Be sure to mention the manual s identifier rh clvm EN 4 7 2008 07 31T15 15 By mentioning this manual s identifier we know exactly which version of the guide you have If you have a suggestion...

Page 12: ...xii ...

Page 13: ...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 t...

Page 14: ...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 log...

Page 15: ...iew Logical volumes created with CLVM on shared storage are visible to all computers that have access to the shared storage CLVM allows a user to configure logical volumes on shared storage by locking access to physical storage while a logical volume is being configured CLVM uses the locking services provided by the high availability symmetric infrastructure Note Shared storage for use in Red Hat ...

Page 16: ...3 LVM Administration Overview provides an overview of the basic steps you perform to configure LVM logical volumes whether you are using the LVM Command Line Interface CLI commands or the LVM Graphical User Interface GUI Chapter 4 LVM Administration with CLI Commands summarizes the individual administrative tasks you can perform with the LVM CLI commands to create and maintain logical volumes Chap...

Page 17: ... the device The LVM metadata contains the configuration details of the LVM volume groups on your system By default an identical copy of the metadata is maintained in every metadata area in every physical volume within the volume group LVM metadata is small and stored as ASCII Currently LVM allows you to store 0 1 or 2 identical copies of its metadata on each physical volume The default is 1 copy O...

Page 18: ...formance rather than an increase Although it it is not recommended there may be specific circumstances when you will need to divide a disk into separate LVM physical volumes For example on a system with few disks it may be necessary to move data around partitions when you are migrating an existing system to LVM volumes Additionally if you have a very large disk and want to have more than one volum...

Page 19: ...physical volumes into one logical volume For example if you have two 60GB disks you can create a 120GB logical volume The physical storage is concatenated Creating a linear volume assigns a range of physical extents to an area of a logical volume in order For example as shown in Figure 2 2 Extent Mapping logical extents 1 to 99 could map to one physical volume and logical extents 100 to 198 could ...

Page 20: ...You can configure more than one linear logical volume of whatever size you desire from the pool of physical extents Figure 2 4 Multiple Logical Volumes shows the same volume group as in Figure 2 3 Linear Volume with Unequal Physical Volumes but in this case two logical volumes have been carved out of the volume group LV1 which is 250 extents in size 1000MB and LV2 which is 50 extents in size 200MB...

Page 21: ...Striping Data Across Three PVs Striped logical volumes can be extended by concatenating another set of devices onto the end of the first set In order extend a striped logical volume however there must be enough free 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 entire volume group adding a singl...

Page 22: ...figuration the log is maintained on disk Figure 2 6 Mirrored Logical Volume For information on creating and modifying mirrors see Section 4 4 1 3 Creating Mirrored Volumes 2 3 4 Snapshot Volumes The LVM snapshot feature provides the ability to create virtual images of a device at a particular instant without causing a service interruption When a change is made to the original device the origin aft...

Page 23: ...ed that chunk is marked and never gets copied from the original volume There are several uses for the snapshot feature Most typically a snapshot is taken when you need to perform a backup on a logical volume without halting the live system that is continuously updating the data You can execute the fsck command on a snapshot file system to check the file system integrity and determine whether the o...

Page 24: ...12 ...

Page 25: ...me manager daemon clvmd or the High Availability Logical Volume Management agents HA LVM If you are not able to use either the clvmd daemon or HA LVM for operational reasons or because you do not have the correct entitlements you must not use single instance LVM on the shared disk as this may result in data corruption If you have any concerns please contact your Red Hat service representative For ...

Page 26: ...ves are automatically created on every volume group and logical volume configuration change unless disabled in the lvm conf file By default the metadata backup is stored in the etc lvm backup file and the metadata archives are stored in the etc lvm archive file How long the the metadata archives stored in the etc lvm archive file are kept and how many archive files are kept is determined by parame...

Page 27: ...ndicates that units are in multiples of 1000 Where commands take volume group or logical volume names as arguments the full path name is optional A logical volume called lvol0 in a volume group called vg0 can be specified as vg0 lvol0 Where a list of volume groups is required but is left empty a list of all volume groups will be substituted Where a list of logical volumes is required but a volume ...

Page 28: ...69 dm version OF 16384 ioctl libdm iface c 1569 dm versions OF 16384 activate activate c 358 Getting target version for striped ioctl libdm iface c 1569 dm versions OF 16384 config config c 864 Setting activation mirror_region_size to 512 You can display help for any of the LVM CLI commands with the help argument of the command commandname help To display the man page for a command execute the man...

Page 29: ...mmand to initialize a block device to be used as a physical volume Initialization is analogous to formatting a file system The following command initializes dev sdd1 dev sde1 and dev sdf1 for use as LVM physical volumes pvcreate dev sdd1 dev sde1 dev sdf1 To initialize partitions rather than whole disks run the pvcreate command on the partition The following example initializes dev hdb1 as an LVM ...

Page 30: ...ovides physical volume information in a configurable form displaying one line per physical volume The pvs command provides a great deal of format control and is useful for scripting For information on using the pvs command to customize your output see Section 4 9 Customized Reporting for LVM The pvdisplay command provides a verbose multi line output for each physical volume It displays physical pr...

Page 31: ... extents on dev sdk1 pvchange x n dev sdk1 You can also use the xy arguments of the pvchange command to allow allocation where it had previously been disallowed 4 2 4 Resizing a Physical Volume If you need to change the size of an underlying block device for any reason use the pvresize command to update LVM with the new size You can execute this command while LVM is using the physical volume 4 2 5...

Page 32: ...lacing parallel stripes on the same physical volume This is the normal allocation policy You can use the alloc argument of the vgcreate command to specify an allocation policy of contiguous anywhere or cling The contiguous policy requires that new extents are adjacent to existing extents If there are sufficient free extents to satisfy an allocation request but a normal allocation policy would not ...

Page 33: ...che file For information on the vgscan command see Section 4 3 4 Scanning Disks for Volume Groups to Build the Cache File The vgs command provides volume group information in a configurable form displaying one line per volume group The vgs command provides a great deal of format control and is useful for scripting For information on using the vgs command to customize your output see Section 4 9 Cu...

Page 34: ... been labeled as a physical volume You can define a filter in the lvm conf file to restrict the scan to avoid specific devices For information on using filters to control which devices are scanned see Section 4 6 Controlling LVM Device Scans with Filters The following example shows the output of a vgscan command vgscan Reading all physical volumes This may take a while Found volume group new_vg us...

Page 35: ... dev vg00 For a description of the volume group parameters you can change with the vgchange command see the vgchange 8 man page 4 3 7 Activating and Deactivating Volume Groups When you create a volume group it is by default activated This means that the logical volumes in that group are accessible and subject to change There are various circumstances for which you you need to make a volume group i...

Page 36: ... bigvg 4 3 10 Combining Volume Groups Two combine two volume groups into a single volume group use the vgmerge command You can merge an inactive source volume with an active or an inactive destination volume if the physical extent sizes of the volume are equal and the physical and logical volume summaries of both volume groups fit into the destination volume groups limits The following command mer...

Page 37: ...following steps 1 Make sure that no users are accessing files on the active volumes in the volume group then unmount the logical volumes 2 Use the a n argument of the vgchange command to mark the volume group as inactive which prevents any further activity on the volume group 3 Use the vgexport command to export the volume group This prevents it from being accessed by the system from which you are...

Page 38: ...do not specify a name for the logical volume the default name lvol is used where is the internal number of the logical volume The following sections provide examples of logical volume creation for the three types of logical volumes you can create with LVM 4 4 1 1 Creating Linear Volumes When you create a logical volume the logical volume is carved from a volume group using the free extents on the ...

Page 39: ...eate command The following commands create a logical volume called mylv that fills the volume group named testvg vgdisplay testvg grep Total PE Total PE 10230 lvcreate l 10230 testvg n mylv The underlying physical volumes used to create a logical volume can be important if the physical volume needs to be removed so you may need to consider this possibility when you create the logical volume For in...

Page 40: ...pplication s I O that is using the striped volume The I argument of the lvcreate command specifies the stripe size in kilobytes If the underlying physical devices that make up a striped logical volume are different sizes the maximum size of the striped volume is determined by the smallest underlying device For example in a two legged stripe the maximum size is twice the size of the smaller device ...

Page 41: ...me 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 You can specify which devices to use for the mirror logs and log and which extents of the devices to use To force the log onto a particular disk specify exactly one extent on the disk on which it will be placed ...

Page 42: ...The following command converts the linear logical volume vg00 lvol1 to a mirrored logical volume lvconvert m1 vg00 lvol1 The following command converts the mirrored logical volume vg00 lvol1 to a linear logical volume removing the mirror leg lvconvert m0 vg00 lvol1 4 4 2 Persistent Device Numbers Major and minor device numbers are allocated dynamically at module load Some applications work best if...

Page 43: ...ename an existing logical volume use the lvrename command Either of the following commands renames logical volume lvold in volume group vg02 to lvnew lvrename dev vg02 lvold dev vg02 lvnew lvrename vg02 lvold lvnew For more information on activating logical volumes on individual nodes in a cluster see Section 4 8 Activating Logical Volumes on Individual Nodes in a Cluster 4 4 6 Removing Logical Vo...

Page 44: ...The following command shows the attributes of lvol2 in vg00 If snapshot logical volumes have been created for this original logical volume this command shows a list of all snapshot logical volumes and their status active or inactive as well lvdisplay v dev vg00 lvol2 The lvscan command scans for all logical volumes in the system and lists them as in the following example lvscan ACTIVE dev vg0 gfsl...

Page 45: ... to match By default most file system resizing tools will increase the size of the file system to be the size of the underlying logical volume so you do not need to worry about specifying the same size for each of the two commands 4 4 9 Extending a Striped Volume In order to increase the size of a striped logical volume there must be enough free space on the underlying physical volumes that make u...

Page 46: ...406 00 GB Insufficient suitable allocatable extents for logical volume stripe1 34480 more required To extend the striped logical volume add another physical volume and then extend the logical volume In this example having added two physical volumes to the volume group we can extend the logical volume 5A to the full size of the volume group vgextend vg dev sdd1 Volume group vg successfully extended...

Page 47: ...sing data Shrinking a logical volume frees some of the volume group to be allocated to other logical volumes in the volume group The following example reduces the size of logical volume lvol1 in volume group vg00 by 3 logical extents lvreduce l 3 vg00 lvol1 4 5 Creating Snapshot Volumes Use the s argument of the lvcreate command to create a snapshot volume A snapshot volume is writeable LVM snapsh...

Page 48: ... The following example shows the default output for the lvs command for a system that includes the logical volume dev new_vg lvol0 for which a snapshot volume dev new_vg newvgsnap has been created lvs LV VG Attr LSize Origin Snap Move Log Copy lvol0 new_vg owi a 52 00M newvgsnap1 new_vg swi a 8 00M lvol0 0 20 Note Because the snapshot increases in size as the origin volume changes it is important ...

Page 49: ...g filter adds all loop and removes all other block devices filter a loop r The following filter adds all loop and IDE and removes all other block devices filter a loop a dev hd r The following filter adds just partition 8 on the first IDE drive and removes all other block devices filter a dev hda8 r For more information on the lvm conf file see Appendix B The LVM Configuration Files and the lvm co...

Page 50: ...one node use the lvchange aey command Alternatively you can use lvchange aly command to activate logical volumes only on the local node but not exclusively You can later activate them on additional nodes concurrently You can also activate logical volumes on individual nodes by using LVM tags which are described in Appendix C LVM Object Tags You can also specify activation of nodes in the configura...

Page 51: ...name and size pvs o pv_name pv_size PV PSize dev sdb1 17 14G dev sdc1 17 14G dev sdd1 17 14G You can append a field to the output with the plus sign which is used in combination with the o argument The following example displays the UUID of the physical volume in addition to the default fields pvs o pv_uuid PV VG Fmt Attr PSize PFree PV UUID dev sdb1 new_vg lvm2 a 17 14G 17 14G onFF2w 1fLC ughJ D9...

Page 52: ... 17 14G 17 14G dev sdc1 new_vg lvm2 a 17 14G 17 09G dev sdd1 new_vg lvm2 a 17 14G 17 14G To keep the fields aligned when using the separator argument use the separator argument in conjunction with the aligned argument pvs separator aligned PV VG Fmt Attr PSize PFree dev sdb1 new_vg lvm2 a 17 14G 17 14G dev sdc1 new_vg lvm2 a 17 14G 17 09G dev sdd1 new_vg lvm2 a 17 14G 17 14G You can use the P argu...

Page 53: ...t appears in the header display and a description of the field Argument Header Description dev_size DevSize The size of the underlying device on which the physical volume was created pe_start 1st PE Offset to the start of the first physical extent in the underlying device pv_attr Attr Status of the physical volume a llocatable or e x ported pv_fmt Fmt The metadata format of the physical volume lvm...

Page 54: ...al volume segment A segment is a group of extents A segment view can be useful if you want to see whether your logical volume is fragmented The pvs segments command displays the following fields by default pv_name vg_name pv_fmt pv_attr pv_size pv_free pvseg_start pvseg_size The display is sorted by pv_name and pvseg_size within the physical volume pvs segments PV VG Fmt Attr PSize PFree Start SSi...

Page 55: ...Argument Header Description lv_count LV The number of logical volumes the volume group contains max_lv MaxLV The maximum number of logical volumes allowed in the volume group 0 if unlimited max_pv MaxPV The maximum number of physical volumes allowed in the volume group 0 if unlimited pv_count PV The number of physical volumes that define the volume group snap_count SN The number of snapshots the v...

Page 56: ... 1 1 51 42G 51 36G jxQJ0a ZKk0 OpMO 0118 nlwO wwqd fD5D32 The lvs Command Table 4 3 lvs Display Fields lists the display arguments of the lvs command along with the field name as it appears in the header display and a description of the field Argument Header Description chunksize chunk_size Chunk Unit size in a snapshot volume copy_percentCopy The synchronization percentage of a mirrored logical v...

Page 57: ... Modules Corresponding kernel device mapper target necessary to use this logical volume move_pv Move Source physical volume of a temporary logical volume created with the pvmove command origin Origin The origin device of a snapshot volume regionsize region_size Region The unit size of a mirrored logical volume seg_count Seg The number of segments in the logical volume seg_size SSize The size of th...

Page 58: ...ys the following fields by default lv_name vg_name lv_attr stripes segtype seg_size The default display is sorted by vg_name lv_name within the volume group and seg_start within the logical volume If the logical volumes were fragmented the output from this command would show that lvs segments LV VG Attr Str Type SSize LogVol00 VolGroup00 wi ao 1 linear 36 62G LogVol01 VolGroup00 wi ao 1 linear 512...

Page 59: ...tself The following example shows the output of the pvs command that displays the physical volume name size and free space pvs o pv_name pv_size pv_free PV PSize PFree dev sdb1 17 14G 17 14G dev sdc1 17 14G 17 09G dev sdd1 17 14G 17 14G The following example shows the same output sorted by the free space field pvs o pv_name pv_size pv_free O pv_free PV PSize PFree dev sdc1 17 14G 17 09G dev sdd1 1...

Page 60: ...g lvm2 a 17552 00M 17552 00M By default units are displayed in powers of 2 multiples of 1024 You can specify that units be displayed in multiples of 1000 by capitalizing the unit specification B K M G T H The following command displays the output as a multiple of 1024 the default behavior pvs PV VG Fmt Attr PSize PFree dev sdb1 new_vg lvm2 a 17 14G 17 14G dev sdc1 new_vg lvm2 a 17 14G 17 09G dev s...

Page 61: ...5946496S The following example displays the output of the pvs command in units of 4 megabytes pvs units 4m PV VG Fmt Attr PSize PFree dev sdb1 new_vg lvm2 a 4388 00U 4388 00U dev sdc1 new_vg lvm2 a 4388 00U 4375 00U dev sdd1 new_vg lvm2 a 4388 00U 4388 00U ...

Page 62: ...50 ...

Page 63: ...l volume dev sdb1 successfully created Physical volume dev sdc1 successfully created 5 1 2 Creating the Volume Group The following command creates the volume group new_vol_group root tng3 1 vgcreate new_vol_group dev sda1 dev sdb1 dev sdc1 Volume group new_vol_group successfully created You can use the vgs command to display the attributes of the new volume group root tng3 1 vgs VG PV LV SN Attr V...

Page 64: ...nd report the file system disk space usage root tng3 1 mount dev new_vol_group new_logical_volume mnt root tng3 1 df Filesystem 1K blocks Used Available Use Mounted on dev new_vol_group new_logical_volume 1965840 20 1965820 1 mnt 5 2 Creating a Striped Logical Volume This example creates an LVM striped logical volume called striped_logical_volume that stripes data across the disks at dev sda1 dev ...

Page 65: ...me group striped_vol_group This example creates a logical volume that is 2 gigabytes in size with three stripes and a stripe size of 4 kilobytes root tng3 1 lvcreate i3 I4 L2G nstriped_logical_volume striped_vol_group Rounding size 512 extents up to stripe boundary size 513 extents Logical volume striped_logical_volume created 5 2 4 Creating the File System The following command creates a GFS file...

Page 66: ...et up the logical volume mylv is carved from the volume group myvol which in turn consists of the three physical volumes dev sda1 dev sdb1 and dev sdc1 After completing this procedure the volume group myvg will consist of dev sda1 and dev sdb1 A second volume group yourvg will consist of dev sdc1 5 3 1 Determining Free Space You can use the pvscan command to determine how much free space is curren...

Page 67: ...the logical volumes with the lvchange command or the vgchange command The following command deactivates the logical volume mylv and then splits the volume group yourvg from the volume group myvg moving the physical volume dev sdc1 into the new volume group yourvg root tng3 1 lvchange a n dev myvg mylv root tng3 1 vgsplit myvg yourvg dev sdc1 Volume group yourvg successfully split from myvg You can...

Page 68: ...unt dev myvg mylv mnt root tng3 1 df Filesystem 1K blocks Used Available Use Mounted on dev yourvg yourlv 24507776 32 24507744 1 mnt dev myvg mylv 24507776 32 24507744 1 mnt 5 4 Removing a Disk from a Logical Volume This example shows how you can remove a disk from an existing logical volume either to replace the disk or to use the disk as part of a different volume In order to remove a disk you m...

Page 69: ...V VG Fmt Attr PSize PFree Used dev sda1 myvg lvm2 a 17 15G 7 15G 10 00G dev sdb1 myvg lvm2 a 17 15G 17 15G 0 dev sdc1 myvg lvm2 a 17 15G 12 15G 5 00G dev sdd1 myvg lvm2 a 17 15G 2 15G 15 00G Use the vgreduce command to remove the physical volume dev sdb1 from the volume group root tng3 1 vgreduce myvg dev sdb1 Removed dev sdb1 from volume group myvg root tng3 1 pvs PV VG Fmt Attr PSize PFree dev s...

Page 70: ..._used PV VG Fmt Attr PSize PFree Used dev sda1 myvg lvm2 a 17 15G 7 15G 10 00G dev sdb1 myvg lvm2 a 17 15G 15 15G 2 00G dev sdc1 myvg lvm2 a 17 15G 15 15G 2 00G dev sdd1 myvg lvm2 a 17 15G 17 15G 0 5 4 2 3 Moving the Data Use the pvmove command to move the data from dev sdb1 to dev sdd1 root tng3 1 pvmove dev sdb1 dev sdd1 dev sdb1 Moved 10 0 dev sdb1 Moved 79 7 dev sdb1 Moved 100 0 root tng3 1 pv...

Page 71: ...Moving Extents to a New Disk 59 root tng3 1 vgreduce myvg dev sdb1 Removed dev sdb1 from volume group myvg You can now reallocate the disk to another volume group or remove the disk from the system ...

Page 72: ...60 ...

Page 73: ...configuration information by running the lvm dumpconfig command Check the cache file in the etc lvm directory for a record of which devices have physical volumes on them 6 2 Displaying Information on Failed Devices You can use the P argument of the lvs or vgs command to display information about a failed volume that would otherwise not appear in the output This argument permits some operations eve...

Page 74: ...1 34T dev sdd1 0 corey 4 4 0 rz pnc 1 58T 1 34T unknown device 0 corey 4 4 0 rz pnc 1 58T 1 34T dev sdb1 0 root link 08 lvs a o devices P Partial mode Incomplete volume groups will be activated read only LV VG Attr LSize Origin Snap Move Log Copy Devices my_mirror corey mwi a 120 00G my_mirror_mlog 1 95 my_mirror_mimage_0 0 my_mirror_mimage_1 0 my_mirror_mimage_0 corey iwi ao 120 00G unknown devic...

Page 75: ...ccessfully created Physical volume dev sdh2 successfully created The following commands creates the volume group vg and the mirrored volume groupfs root link 08 vgcreate vg dev sd abcdefgh 12 Volume group vg successfully created root link 08 lvcreate L 750M n groupfs m 1 vg dev sda1 dev sdb1 dev sdc1 Rounding up size to full physical extent 752 00 MB Logical volume groupfs created You can use the ...

Page 76: ...of 2048 at 0 Input output error LV VG Attr LSize Origin Snap Move Log Copy Devices groupfs vg wi a 752 00M dev sdb1 0 At this point you should still be able to use the logical volume but there will be no mirror redundancy To rebuild the mirrored volume you replace the broken drive and recreate the physical volume If you use the same disk rather than replacing it with a new one you will see inconsi...

Page 77: ...7 83 GB free PV dev sde1 VG vg lvm2 67 83 GB 67 83 GB free PV dev sde2 VG vg lvm2 67 83 GB 67 83 GB free PV dev sdf1 VG vg lvm2 67 83 GB 67 83 GB free PV dev sdf2 VG vg lvm2 67 83 GB 67 83 GB free PV dev sdg1 VG vg lvm2 67 83 GB 67 83 GB free PV dev sdg2 VG vg lvm2 67 83 GB 67 83 GB free PV dev sdh1 VG vg lvm2 67 83 GB 67 83 GB free PV dev sdh2 VG vg lvm2 67 83 GB 67 83 GB free PV dev sda1 VG vg l...

Page 78: ...8 7qTD S5BI MAEN NYM5Sk Couldn t find all physical volumes for volume group VG Couldn t find device with uuid FmGRh3 zhok iVI8 7qTD S5BI MAEN NYM5Sk Couldn t find all physical volumes for volume group VG You may be able to find the UUID for the physical volume that was overwritten by looking in the etc lvm archive directory Look in the file VolumeGroupName_xxxx vg for the last known valid archived...

Page 79: ...estore command to restore the volume group s metadata root link 07 backup vgcfgrestore VG Restored volume group VG You can now display the logical volumes root link 07 backup lvs a o devices LV VG Attr LSize Origin Snap Move Log Copy Devices stripe VG wi 300 00G dev sdh1 0 dev sda1 0 stripe VG wi 300 00G dev sdh1 34728 dev sdb1 0 The following commands activate the volumes and display the active v...

Page 80: ...mand to restore the volume group metadata to its previous state For example if you used the removemissing argument of the vgreduce command without the test argument and find you have removed logical volumes you wanted to keep you can still replace the physical volume and use another vgcfgrestore command to return the volume group to its previous state 6 7 Insufficient Free Extents for a Logical Vo...

Page 81: ...p vgs o vg_free_count vg_extent_count VG PV LV SN Attr VSize VFree Free Ext testvg 2 1 0 wz n 34 30G 0 0 8780 Alternately you can extend the logical volume to use a percentage of the remaining free space in the volume group by using the l argument of the lvcreate command For information see Section 4 4 1 1 Creating Linear Volumes ...

Page 82: ...70 ...

Page 83: ...l volumes You can bring up this utility by typing system config lvm The LVM chapter of the Red Hat Enterprise Linux Deployment Guide provides step by step instructions for configuring an LVM logical volume using this utility In addition the LVM GUI is availalbe as part of the Conga management interface For information on using the LVM GUI with Conga see the online help for Conga ...

Page 84: ...72 ...

Page 85: ...s are activated using the Device Mapper Each logical volume is translated into a mapped device Each segment translates into a line in the mapping table that describes the device The Device Mapper provides linear mapping striped mapping and error mapping amongst others Two disks can be concatenated into one logical volume with a pair of linear mappings one for each disk The dmsetup command is a com...

Page 86: ...74 ...

Page 87: ...it exists lvm_hosttag conf If that file defines new tags then further configuration files will be appended to the list of tiles to read in For information on host tags see Section C 2 Host Tags In addition to the LVM configuration files a system running LVM includes the following files that affect LVM system setup etc lvm cache Device name filter cache file configurable etc lvm backup Directory fo...

Page 88: ...ct The first expression found to match a device name determines if the device will be accepted or rejected ignored Devices that don t match any patterns are accepted Be careful if there there are symbolic links or multiple filesystem entries for the same device as each name is checked separately against the list of patterns The effect is that if any name matches any a pattern the device is accepte...

Page 89: ...file by setting this to 0 write_cache_state 1 Advanced settings List of pairs of additional acceptable block device types found in proc devices with maximum non zero number of partitions types fd 16 If sysfs is mounted 2 6 kernels restrict device scanning to the block devices it believes are valid 1 enables 0 disables sysfs_scan 1 By default LVM2 will ignore devices used as components of software ...

Page 90: ...ne output command_names 0 A prefix to use before the message text but after the command name if selected Default is two spaces so you can see grep the severity of each message prefix To make the messages look similar to the original LVM tools use indent 0 command_names 1 prefix Set this if you want log messages during activation Don t use this in low memory situations can deadlock activation 0 Con...

Page 91: ... readline mode shell Number of lines of history to store in lvm_history history_size 100 Miscellaneous global LVM2 settings global library_dir usr lib The file creation mask for any files and directories created Interpreted as octal if the first digit is zero umask 077 Allow other users to read the files umask 022 Enabling test mode means that no changes to the on disk metadata will be made Equiva...

Page 92: ...ing to 0 dangerous risks metadata corruption if LVM2 commands get run concurrently Type 2 uses the external shared library locking_library Type 3 uses built in clustered locking locking_type 1 If using external locking type 2 and initialisation fails with this set to 1 an attempt will be made to use the built in clustered locking If you are using a customised locking_library you should set this to...

Page 93: ...for use while devices suspended reserved_stack 256 How much memory in KB to reserve for use while devices suspended reserved_memory 8192 Nice value used while devices suspended process_priority 18 If volume_list is defined each LV is only activated if there is a match against the list vgname and vgname lvname are matched exactly tag matches any tag set in the LV or VG matches if any tag defined on...

Page 94: ...haracteristic of the device This policy acts like remove if no suitable device and space can be allocated for the replacement Currently this is not implemented properly and behaves similarly to allocate_anywhere Operates like allocate but it does not require that the new space being allocated be on a device is not part of the mirror For a log device failure this could mean that the log is allocate...

Page 95: ...nd with no other on disk metadata pvmetadatacopies 0 Or this can be in addition to on disk metadata areas The feature was originally added to simplify testing and is not supported under low memory situations the machine could lock up Never edit any files in these directories by hand unless you you are absolutely sure you know what you are doing Use the supplied toolset to make changes e g vgcfgres...

Page 96: ...84 ...

Page 97: ...e C 1 Adding and Removing Object Tags To add or delete tags from physical volumes use the addtag or deltag option of the pvchange command To add or delete tags from volume groups use the addtag or deltag option of the vgchange or vgcreate commands To add or delete tags from logical volumes use the addtag or deltag option of the lvchange or lvcreate commands C 2 Host Tags In a cluster configuration...

Page 98: ... tag in the metadata on that host activation volume_list vg1 lvol0 database There is a special match that causes a match only if any metadata tag matches any host tag on that machine As another example consider a situation where every machine in the cluster has the following entry in the configuration file tags hosttags 1 If you want to activate vg1 lvol2 only on host db2 do the following 1 Run lv...

Page 99: ...east one metadata copy The core metadata is stored in ASCII A metadata area is a circular buffer New metadata is appended to the old metadata and then the pointer to the start of it is updated You can specify the size of metadata area with the metadatasize option of the pvcreate command The default size is too small for volume groups with many logical volumes or physical volumes D 1 The Physical V...

Page 100: ...s An unordered list of logical volumes each consisting of An ordered list of logical volume segments For each segment the metadata includes a mapping applied to an ordered list of physical volume segments or logical volume segments D 3 Sample Metadata The following shows an example of LVM volume group metadata for a volume group called myvg Generated by LVM2 Tue Jan 30 16 28 15 2007 contents Text ...

Page 101: ...oG4p 55Ui 9tbp VTEA jO6s RAVx UREW0G device dev sdc Hint only status ALLOCATABLE dev_size 35964301 17 1491 Gigabytes pe_start 384 pe_count 4390 17 1484 Gigabytes pv3 id hGlUwi zsBg 39FF do88 pHxY 8XA2 9WKIiA device dev sdd Hint only status ALLOCATABLE dev_size 35964301 17 1491 Gigabytes pe_start 384 pe_count 4390 17 1484 Gigabytes logical_volumes mylv id GhUYSF qVM3 rzQo a6D2 o0aV LQet Ur9OF9 stat...

Page 102: ...Appendix D LVM Volume Group Metadata 90 stripes pv0 0 segment2 start_extent 1280 extent_count 1280 5 Gigabytes type striped stripe_count 1 linear stripes pv1 0 ...

Page 103: ...91 Appendix E Revision History Revision History Revision 1 0 ...

Page 104: ...92 ...

Page 105: ...7 deactivating volume groups 23 exclusive on one node 23 local node only 23 device numbers major 30 minor 30 persistent 30 device path names 15 device scan filters 36 device size maximum 21 device special file directory 20 display sorting output 47 displaying logical volumes 32 44 physical volumes 18 41 volume groups 21 43 E extent allocation 20 definition 6 20 F failed devices displaying 61 feedb...

Page 106: ...ge display 16 metadata backup 14 24 recovery 66 mirrored logical volume converting to linear 30 creation 28 definition 9 failure recovery 62 reconfiguration 30 O online data relocation 37 P partition type setting 17 partitions multiple 6 path names 15 persistent device numbers 30 physical extent preventing allocation 19 physical volume adding to a volume group 21 administration general 16 creating...

Page 107: ...mand 20 vgdisplay command 21 vgexport command 25 vgextend command 21 vgimport command 25 vgmerge command 24 vgmknodes command 26 vgreduce command 22 vgrename command 25 vgs command 38 display arguments 43 vgscan command 22 vgsplit command 24 volume group activating 23 administration general 19 changing parameters 23 combining 24 creating 20 deactivating 23 definition 6 displaying 21 38 43 extendin...

Page 108: ...96 ...

Reviews: