Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basic concepts and operations of AIX storage management

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about the basic concepts and operations of AIX storage management. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.

The basic concepts of AIX storage management include (not limited to)

1. Disk or hard disk

How to view the existing disks and related properties of the system

two。 Physical Volume (Physical Volume,PV)

What is the relationship between the physical volume and the disk / hard disk, list the existing PV and related attributes of the system, and add / remove / maintain PV attributes

3. Volume Group (Volume Group,VG)

Create, delete, expand, maintain, import, export, migrate and view related attributes of VG

4. Physical partitioning (Physical Parttion,PP)

What is PP?

5. Logical partitioning (Logical Partition,LP)

What is LP?

6. Logical Volume (Logical Volume,LV)

Create, delete, expand, maintain and view related attributes of lv

7. Striping and mirroring of logical volumes

How to set up striping and mirroring of logical volumes

8. File system (File System,FS)

What FS is supported by AIX, and how to create, delete, mount and automatically mount FS

There are specific answers to the above questions in the article.

Storage management concept

The basic concepts used by LVM include physical volumes, volume groups, physical partitions, logical volumes, logical partitions, file systems, and raw devices. Here are some of their features:

Each individual disk drive is a named physical volume (PV) with a name such as hdisk0 or hdisk1.

One or more PV can form a volume group (VG). A physical volume can only belong to at most one VG.

You cannot assign a portion of a PV to a VG. A physical volume is assigned to a volume group as a whole.

"even if physical volumes are of different types, such as SCSI or SSA, they can be assigned to the same volume group."

The storage space in the physical volume is divided into physical partitions (PP). On all disks belonging to the same VG, the physical partitions are exactly the same size.

In each volume group, one or more logical volumes (LV) can be defined. From the user's point of view, the data stored on logical volumes appears to be contiguous, but can be scattered over different physical volumes in the same volume group.

A logical volume consists of one or more logical partitions (LP). Each logical partition has at least one corresponding physical partition. A logical partition and a physical partition always have the same size. Up to three copies of the data can be located on different physical partitions. Typically, for redundancy, physical partitions that store the same data are located on different physical disks.

Data in logical volumes can be stored in an organized manner and in the form of files located in a directory. This structured and hierarchical form of organization is called a file system.

You can also treat the data in a logical volume as a contiguous byte string. Such logical volumes are called raw logical volumes. It is the responsibility of the application to use this data to access and interpret it correctly.

The volume group descriptor area (VGDA) is an area on disk that contains information about the volume group in which the physical volume resides. It also includes information about the properties and status of all physical and logical volumes that belong to the volume group. The information in VGDA is used and updated by the LVM command. Each physical volume has at least one VGDA. The information in the VGDA of all disks belonging to the same volume group must be exactly the same. The internal architecture of VGDA and its location on disk depend on the type of volume group (raw, high-capacity, or scalable).

The volume group status area (VGSA) is used to describe the status of all physical partitions in all physical volumes in the volume group. VGSA indicates whether a physical partition contains accurate or outdated information. VGSA is used to monitor and maintain data replica synchronization. VGSA is essentially a bitmap, and its architecture and location on disk depend on the type of volume group.

Logical volume control blocks (LVCB) contain important information about logical volumes, such as the number of logical partitions or disk allocation policies. Its architecture and location on disk depend on the type of volume group it belongs to. For standard volume groups, LVCB resides on the first user data block in LV. For bulk volume groups, there is additional LVCB information in the VGDA on disk. For scalable volume groups, all relevant logical volume control information is retained in the VGDA as part of the LVCB information area and the LV entry area.

Note: the layout of the hard drive is defined by the / usr/include/sys/hd_psn.h header file. LVM recording starts from the seventh sector on the disk. All LVM record structures are defined in the / usr/include/lvmrec.h header file.

Restrictions on logical volume storage

The LVM tier of AIX 5L Version 5.3 provides a higher level of disk management flexibility. There are some limitations that must be noted, as shown in Table 1.

Table 1

Maximum number of VG types maximum number of PV maximum number of LV maximum number of PP per VG maximum PP size conventional VG3225632512 (1016-32) 1 GB large capacity VG128512130048 (1016-128) 1 GB Extensible VG102440962097152128 GB

LVM restrictions for AIX 5L Version 5.3

Go back to the top of the page

Physical volume

When you initially add a disk to the system, the system treats it as a simple device. The disk cannot be accessed to perform LVM operations at this time. To make it accessible, it must be assigned to a volume group, which means changing it from disk to physical volume. For each disk, two device drivers will be created under the / dev directory: a block device driver and a character device driver. The system assigns a 32-bit unique identifier to the disk drive, which is called the physical volume identifier (PVID).

The lspv command, which is used without any parameters, displays all physical volumes, the PVID of the physical volume, the volume group in which PV belongs, and the status of the volume group, as shown in example 1.

Example 1 uses the lspv command to display physical volumes

# lspvhdisk0 00c478de09a40b16 rootvg activehdisk1 00c478de09caf163 rootvg activehdisk2 00c478de09caf37f Nonehdisk3 00c478de49630c6a Nonehdisk4 00c478de00655246 Nonehdisk5 00c478de008a399b Nonehdisk6 00c478de008a3ba1 Nonehdisk7 00c478de6c9883b7 NonePVID

When generating a PVID, the system uses its own serial number and timestamp to ensure that the two disks never have the same PVID.

PVID is also stored in ODM. They are used by the LVM command and may be referenced by external applications such as HACMP.

The following command changes the available disk device to a physical volume by allocating PVID (if it does not already exist):

Chdev-l hdisk7-a pv=yes

This command does not work if the disk is already a physical volume.

The following command clears PVID from the physical volume:

Chdev-l hdisk7-a pv=clear

Note: you can use intermediate-level commands such as lquerypv to list the PVID of the disk, as follows:

# lquerypv-h / dev/hdisk2 80 10

00000080 00C478DE 09CAF37F 00000000 00000000 |.. x. |

List information about physical volumes

You can use the lspv command and pass the name of the physical volume as an argument to find more details about a physical volume, as shown in example 6-2.

Example 2 use lspv to display detailed information about a physical volume

# lspv hdisk2PHYSICAL VOLUME:hdisk2 VOLUME GROUP:testvgPV IDENTIFIER:00c478de09caf37f VG IDENTIFIER 00c478de00004c00000001078fc3497dPV STATE:activeSTALE PARTITIONS:0 ALLOCATABLE:yesPP SIZE:128 megabyte (s) LOGICAL VOLUMES: 1TOTAL PPs:546 (69888 megabytes) VG DESCRIPTORS: 2FREE PPs:542 (69376 megabytes) HOT SPARE:noUSED PPs:4 (512 megabytes) MAX REQUEST:256 kilobytesFREE DISTRIBUTION: 110. 105. 109. .. 109USED DISTRIBUTION: 00..04..00..00..00

The fields in example 2 have the following meanings:

The name of the PHYSICAL VOLUME physical volume.

Identifier of the PV IDENTIFIER physical volume.

Status of the PV STATE physical volume: activated, lost, or deleted. You can use the chpv command to change the state.

The number of STALE PARTITIONS obsolete partitions.

The size of the PP SIZE physical partition.

The total number of physical partitions (idle or used) on which TOTAL PPs resides on this disk.

The number of free partitions available on the FREE PPs physical volume.

The number of partitions used on the USED PPs physical volume.

FREE DISTRIBUTION

The number of free physical partitions available on each physical (intra-physical) volume area.

USED DISTRIBUTION

The number of physical partitions used on each physical volume area.

The name of the volume group in which the VOLUME GROUP physical volume belongs.

Identifier of the volume group in which the VG IDENTIFIER physical volume belongs.

Assign permissions for ALLOCATABLE physical volumes determine whether free PP can be assigned to logical volumes.

The number of logical volumes on which LOGICAL VOLUMES has at least one LP on this physical volume.

The number of VGDA that VG DESCRIPTORS resides on this physical volume.

Whether HOT SPARE defines the physical volume as a hot backup (hot spare).

MAX REQUEST the LTG size of this physical volume.

The lspv command can be used with the-l flag to show the names of all logical volumes with at least one partition on the physical volume, the total number of partitions on the physical volume, the total number of PP corresponding to LP, the PP distribution corresponding to each physical (intra-physical) disk area, and the mount point of the logical volume, if any. Example 6-3 shows an example of the output obtained when running this command.

Example 3 uses the lspv-l command

# lspv-l hdisk0hdisk0:LV NAME LPs PPs DISTRIBUTION MOUNT POINThd3 1 100.. 00... 00.. 00 / tmphd10opt 1 100.. 00... 00.. 00 / opthd5 1 1 01.. 00.. 00 N/Ahd8 11 00..00..01..00..00 N/Ahd6 11 11 00..00..11..00..00 N/Ahd2 8 8 00..00..08..00..00 / usrhd9var 11 00..00..01..00..00 / varhd1 1 1 00..00..01..00..00 / homehd4 1 1 00..00..01..00..00 /

If you want to display the number and location of partitions, and their corresponding logical volumes, you can use the lspv-p command, as shown in example 4.

Example 4 uses lspv to display the PP allocation for logical volumes

# lspv-p hdisk0hdisk0:PP RANGE STATE REGION LV NAME TYPE MOUNT POINT1-1 used outer edge hd5 boot N/A2-110free outer edge111-219free outer middle220-220used center hd8 jfs2log N/A221-221used center hd2 jfs2 / usr222-222used Center hd3 jfs2 / tmp223-223 used center hd10opt jfs2 / opt224-230 used center hd2 jfs2 / usr231-241 used center hd6 paging N/A242-328 free center329-437 free inner middle438-546 free inner edge

By using the lspv-M command, you can create a detailed disk layout diagram and show the relationship between each physical and logical partition, as shown in example 5.

Example 5 use the lspv-M command to display the layout of a physical volume

# lspv-M hdisk0 | morehdisk0:1 hd5:1hdisk0:2-110hdisk0:111 lv1:1:1hdisk0:112 lv1:2:1hdisk0:113 lv1:3:1hdisk0:114 lv1:4:1hdisk0:115 lv1:5:1hdisk0:116 lv1:6:1hdisk0:117 lv1:7:1hdisk0:118 lv1:8:1hdisk0:119 lv1:9:1hdisk0:120 lv1:10:1hdisk0:121 lv1:11:1hdisk0:122 Lv1:12:1hdisk0:123-219hdisk0:220 hd8:1hdisk0:221 hd2:1hdisk0:222 hd3:1hdisk0:223 hd10opt:1hdisk0:224 hd2:2hdisk0:225 hd2:3hdisk0:226 hd2:4hdisk0:227 hd2:5hdisk0:228 hd2:6hdisk0:229 hd2:7hdisk0:230 hd2:8hdisk0:231 hd6:1hdisk0:232 hd6:2hdisk0:233 hd6:3hdisk0:234 hd6:4hdisk0:235 hd6: 5hdisk0:236 hd6:6hdisk0:237 hd6:7hdisk0:238 hd6:8hdisk0:239 hd6:9hdisk0:240 hd6:10hdisk0:241 hd6:11hdisk0:242-546 change the allocation permissions for physical volumes

Assign permissions for physical volumes determine whether physical partitions that are not assigned to logical volumes on that physical volume can be assigned to logical volumes. The operation of logical volumes that reside on this physical volume is not affected.

In example 6, we disabled the ability to assign new free physical partitions in hdisk2 to any logical volume. We tried to create a logical volume that would use PP in hdisk2 and received an error message indicating that the partitions in the physical volume were not assignable.

Example 6 disable partition allocation of physical volumes

# chpv-an hdisk2# lspv hdisk2PHYSICAL VOLUME:hdisk2 VOLUME GROUP:testvgPV IDENTIFIER:00c478de09caf37f VG IDENTIFIER 00c478de00004c00000001078fc3497dPV STATE:activeSTALE PARTITIONS:0 ALLOCATABLE:noPP SIZE:128 megabyte (s) LOGICAL VOLUMES: 1TOTAL PPs:546 (69888 megabytes) VG DESCRIPTORS: 2FREE PPs:542 (69376 megabytes) HOT SPARE:noUSED PPs:4 (512 megabytes) MAX REQUEST:256 kilobytesFREE DISTRIBUTION: 110. 105. .109.. 109.. 109 USED DISTRIBUTION: 00.. 04.. 00.. 0 mklv-y test-t jfs2 testvg 10 hdisk20516-823 lquerypv:Physical Volume hdisk2 is not allocatable.0516-848 lquerypv:Failure on physical volume hdisk2 It may be missingor removed.0516-822 mklv:Unable to create logical volume.

To enable assign permissions, you can use the following command:

Chpv-ay hdisk2 changes the availability of physical volumes

The availability of a physical volume defines whether any logical input / output operations can be performed on the specified physical volume. Any subsequent LVM operations will not take into account the VGDA and VGSA copies on the physical volume. "also, information about the physical volume is removed from the VGDA of other physical volumes in the volume group." The physical volume will be marked as deleted.

In example 7, we demonstrated the concept of "available" and its relationship to VGDA, as follows:

The lsvg testvg command shows that VG is active, containing two PV, both PV are active, and the VG has three VGDA.

The lsvg-p testvg command shows that testvg contains disks hdisk2 and hdisk3, and that both disks are active.

Lspv hdisk3 shows that hdisk3 is active and has two VGDA.

Lspv hdisk2 shows that hdisk2 is active and has a VGDA.

Chpv-vr hdisk3 makes hdisk3 unavailable.

Lspv hdisk3 confirms that hdisk3 has been deleted and that there is no VGDA on it.

Lspv hdisk2 confirms that hdisk2 is active and now contains two VGDA, because any volume group must contain at least one VGDA.

Lsvg-p testvg shows that hdisk3 has been deleted.

Lsvg testvg shows that the volume group is still active, one of the two PV is active, and the total number of VGDA has been changed to two.

Chpv-va hdisk3 makes hdisk3 available again.

Lspv hdisk3 shows that hdisk3 is active and contains only one VGDA.

Lsvg-p testvg confirms that both disks are now active.

Example 7 use the chpv command to change the availability of a physical volume

# lsvg testvgVOLUME GROUP:testvg VG IDENTIFIER:00c478de00004c00000001078fc3497dVG STATE:active PP SIZE:128 megabyte (s) VG PERMISSION:read/write TOTAL PPs:1092 (139776 megabytes) MAX LVs:256 FREE PPs:1092 (139776 megabytes) LVs:0 USED PPs:0 (0 megabytes) OPEN LVs:0 QUORUM : 2TOTAL PVs:2 VG DESCRIPTORS: 3STALE PVs:0 STALE PPs: 0ACTIVE PVs:2 AUTO ON:yesMAX PPs per VG: 32512MAX PPs per PV:1016 MAX PVs: 32LTG size (Dynamic): 256 kilobyte (s) AUTO SYNC:noHOT SPARE:no BB POLICY:relocatable# lsvg-p testvgtestvg:PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTIONhdisk2 active 546 546 110..109..109..109..109hdisk3 active 546 546 110. 109. 109. 109. 10 years lspv hdisk3PHYSICAL VOLUME:hdisk3 VOLUME GROUP:testvgPV IDENTIFIER:00c478de49630c6a VG IDENTIFIER 00c478de00004c00000001078fc3497dPV STATE:activeSTALE PARTITIONS:0 ALLOCATABLE:yesPP SIZE:128 megabyte (s) LOGICAL VOLUMES: 0TOTAL PPs:546 (69888 megabytes) VG DESCRIPTORS: 2FREE PPs:546 (69888 megabytes) HOT SPARE:noUSED PPs:0 (0 megabytes) MAX REQUEST:256 kilobytesFREE DISTRIBUTION: 110..109..109..109..109USED DISTRIBUTION: 00.00. .. 00.. 0 lspv hdisk2PHYSICAL VOLUME:hdisk2 VOLUME GROUP:testvgPV IDENTIFIER:00c478de09caf37f VG IDENTIFIER 00c478de00004c00000001078fc3497dPV STATE:activeSTALE PARTITIONS:0 ALLOCATABLE:yesPP SIZE:128 megabyte (s) LOGICAL VOLUMES: 0TOTAL PPs:546 (69888 megabytes) VG DESCRIPTORS: 1FREE PPs:546 (69888 megabytes) HOT SPARE:noUSED PPs:0 (0 megabytes) MAX REQUEST:256 kilobytesFREE DISTRIBUTION: 110.0. 109..109..109..109USED DISTRIBUTION: 00.. 00.. 00.. 0 chpv-vr hdisk3# lspv hdisk3PHYSICAL VOLUME:hdisk3 VOLUME GROUP:testvgPV IDENTIFIER:00c478de49630c6a VG IDENTIFIER 00c478de00004c00000001078fc3497dPV STATE:removedSTALE PARTITIONS:0 ALLOCATABLE:yesPP SIZE:128 megabyte (s) LOGICAL VOLUMES: 0TOTAL PPs:546 (69888 megabytes) VG DESCRIPTORS: 0FREE PPs:546 (69888 megabytes) HOT SPARE : noUSED PPs:0 (0 megabytes) MAX REQUEST:256 kilobytesFREE DISTRIBUTION: 110..109..109..109..109USED DISTRIBUTION: 00.00.. 00.0mm lspv hdisk2PHYSICAL VOLUME:hdisk2 VOLUME GROUP:testvgPV IDENTIFIER:00c478de09caf37f VG IDENTIFIER 00c478de00004c00000001078fc3497dPV STATE:activeSTALE PARTITIONS:0 ALLOCATABLE:yesPP SIZE:128 megabyte (s) LOGICAL VOLUMES: 0TOTAL PPs:546 (69888 Megabytes) VG DESCRIPTORS: 2FREE PPs:546 (69888 megabytes) HOT SPARE:noUSED PPs:0 (0 megabytes) MAX REQUEST:256 kilobytesFREE DISTRIBUTION: 110..109..109..109..109USED DISTRIBUTION: 00.00.. 00.0mm lsvg-p testvgtestvg:PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTIONhdisk2 active 546 546 110..109..109..109..109hdisk3 removed 546 546 110. 109. 109. 10 years lsvg testvgVOLUME GROUP:testvg VG IDENTIFIER:00c478de00004c00000001078fc3497dVG STATE:active PP SIZE:128 megabyte (s) VG PERMISSION:read/write TOTAL PPs:1092 (139776 megabytes) MAX LVs:256 FREE PPs:1092 (139776 megabytes) LVs:0 USED PPs:0 (0 megabytes) OPEN LVs:0 QUORUM: 2TOTAL PVs:2 VG DESCRIPTORS: 2STALE PVs:0 STALE PPs: 0ACTIVE PVs:1 AUTO ON:yesMAX PPs per VG: 32512MAX PPs per PV : 1016 MAX PVs: 32LTG size (Dynamic): 256kilobyte (s) AUTO SYNC:noHOT SPARE:no BB POLICY:relocatable# chpv-va hdisk3# lspv hdisk3PHYSICAL VOLUME:hdisk3 VOLUME GROUP:testvgPV IDENTIFIER:00c478de49630c6a VG IDENTIFIER 00c478de00004c00000001078fc3497dPV STATE:activeSTALE PARTITIONS:0 ALLOCATABLE:yesPP SIZE:128 megabyte (s) LOGICAL VOLUMES: 0TOTAL PPs:546 (69888 megabytes) VG DESCRIPTORS: 1FREE PPs:546 (69888 megabytes) HOT SPARE:noUSED PPs:0 (0 megabytes) MAX REQUEST:256 kilobytesFREE DISTRIBUTION: 110..109..109..109..109USED DISTRIBUTION: 00.00.. 00.0mm lsvg-p testvgtestvg:PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTIONhdisk2 active 546 546 110..109..109..109..109hdisk3 active 546 546 110..109..109..109..109

Before you can change the availability of any physical volumes, you must shut down any logical volumes that reside on the disk and ensure that the volume group meets the quota (quorum) requirements after deleting the disk.

Clear the boot record in the physical volume

To clear the boot record located on the physical volume hdisk1, you can use the following command:

Chpv-c hdisk1 declares physical volume hot backup

You can use the chpv command to define a physical volume as a hot backup. This command also disables the assign permissions for the physical volume. The disk must be at least equal to the size of the smallest disk that already exists in the volume group.

To define hdisk3 as a hot backup, use the following command:

Chpv-hy hdisk3

To remove hdisk3 from the hot backup pool of the volume group where hdisk3 belongs, you can use the following command:

Chpv-hn hdisk3 migrates data from physical volumes

You can move a physical partition located on a physical volume to one or more physical volumes contained in the same volume group.

In example 8, we provide an example of migrating data from a physical volume, as follows:

Lsvg-p rootvg displays all the PV contained in the rootvg.

Lsvg-M hdisk1 displays the layout diagram of all physical partitions located on hdisk1.

Lspv-M hdisk5 shows that all partitions of hdisk5 are unassigned.

Migratepv hdisk1 hdisk5 migrates data from hdisk1 to hdisk5.

Lspv-M hdisk1 confirms that all partitions of hdisk1 are idle.

Chpv-c hdisk1 clears the boot record in hdisk1.

Lspv-M hdisk5 confirms that all physical partitions have been migrated to hdisk5.

Example 8 migrate physical partitions from one disk to another

# lsvg-p rootvgrootvg:PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTIONhdisk0 active 546 523 109..109..87..109..109hdisk1 active 546 538 109..105..106..109..109hdisk5 active 546 546 110.1. 109. 109. 109. 10 lspv-M hdisk1hdisk1:1 hd5:1:2hdisk1:2-122hdisk1:123 fslv00:1hdisk1:124 fslv00:2hdisk1:125 fslv00:3hdisk1:126 fslv00:4hdisk1:127-219hdisk1:220 hd4:1hdisk1:221 hd9var:1hdisk1:222 hd1:1hdisk1:223-54 lspv-M hdisk5hdisk5:1-54 migratepv hdisk1 hdisk50516-1011 migratepv:Logical volume hd5 is labeled as a boot logical volume.0516-1246 migratepv:If hd5 is the boot logical volume Please run 'chpv-c hdisk1'as root user to clear the boot record and avoid a potential bootoff an old boot image that may reside on the disk from which thislogical volume is moved/removed.# lspv-M hdisk1hdisk1:1-544th chpv-c hdisk1# lspv-M hdisk5hdisk5:1 hd5:1:2hdisk5:2-110hdisk5:111 fslv00:1hdisk5:112 fslv00:2hdisk5:113 fslv00:3hdisk5:114 fslv00:4hdisk5:115-219hdisk5:220 hd4:1hdisk5:221 hd9var:1hdisk5:222 hd1:1hdisk5:223-546

If you migrate data from a physical volume that contains a boot image, you should also update the boot list.

You can migrate only data in partitions that belong to a particular logical volume. To migrate only physical partitions that belong to logical volume testlv from hdisk1 to hdisk5, you can use the following command:

Migratepv-l testlv hdisk1 hdisk5 Migration Partition

You can migrate data from one partition on one physical disk to another physical partition on a different disk.

In example 9, we provide an example of migrating data from one physical partition to another, as follows:

Lspv-M hdisk1 displays the layout diagram of all physical partitions located on hdisk1. Notice that the second copy of logical partition number 1 of logical volume testlv resides on physical partition 115.

Lspv-M hdisk5 shows that all partitions of hdisk5 are unassigned.

Migratelp testlv/1/2 hdisk5/123 migrates the data from the second copy of logical volume logical partition number 1 to hdisk5 on physical partition 123.

Lsvg-M hdisk1 displays the layout diagram of all physical partitions located on hdisk1. Note that physical partition 115 is free.

Lspv-M hdisk5 confirms that the second copy of logical partition number 1 of logical volume testlv now resides on physical partition 123 of hdisk5.

Example 9 migrate one partition to another partition on a different physical volume

# lspv-M hdisk1hdisk1:1 hd5:1:2hdisk1:2-110hdisk1:111 fslv00:1hdisk1:112 fslv00:2hdisk1:113 fslv00:3hdisk1:114 fslv00:4hdisk1:115 testlv:1:2hdisk1:116-219hdisk1:220 hd4:1hdisk1:221 hd9var:1hdisk1:222 hd1:1hdisk1:223-544th lspv-M hdisk5hdisk5:1-544th migratelp testlv/1/2 hdisk5/123migratelp:Mirror copy 2 of logical partition 1 of logical volumetestlv migrated to physical partition 123 Of hdisk5.# lspv-M hdisk1hdisk1:1 hd5:1:2hdisk1:2-110hdisk1:111 fslv00:1hdisk1:112 fslv00:2hdisk1:113 fslv00:3hdisk1:114 fslv00:4hdisk1:115-219hdisk1:220 hd4:1hdisk1:221 hd9var:1hdisk1:222 hd1:1hdisk1:223-544th lspv-M hdisk5hdisk5:1-122hdisk5:123 testlv:1:2hdisk5:124-546 determine the LTG size

The logical track group (LTG) size is the maximum transfer size allowed for disk operations.

You can use the lquerypv command to determine the LTG size of a physical disk, as shown in examples 6-10. A disk can support multiple LTG sizes, which can be determined using ioctl calls.

Example 10 use the lquerypv command to determine the LTG size

# lquerypv-M hdisk0256 go back to the top of the page

Manage logical volumes

Logical volumes enable applications to access data as if it were stored continuously. A logical volume consists of a sequence of one or more numbered logical partitions. Each logical partition has at least one and at most three corresponding physical partitions, which can be located on different physical volumes. The location of physical partitions on disk is determined by intra-physical and inter-physical allocation policies.

For each logical volume, there are two corresponding device files in the / dev directory. The first is a character device and the second is a block device.

Create a logical volume

You can use the mklv command to create logical volumes. This command allows you to specify the name of the logical volume and its characteristics, such as the number and location of logical partitions.

In example 11, we use the mklv command to create a logical volume named lv3 in the volume group test1vg, of type jfs2, with 10 logical partitions on hdisk5.

Example 11 uses the mklv command

# mklv-y lv3-t jfs2-an im test1vg 10 hdisk5lv3# lslv lv3LOGICAL VOLUME:lv3 VOLUME GROUP:test1vgLV IDENTIFIER:00c5e9de00004c0000000107a5b596ab.4 PERMISSION:read/writeVG STATE:active/complete LV STATE:closed/syncdTYPE:jfs2 WRITE VERIFY:offMAX LPs:512 PP SIZE:512 megabyte (s) COPIES:1 SCHED POLICY:parallelLPs:10 PPs: 10STALE PPs:0 BB POLICY:relocatableINTER-POLICY:minimum RELOCATABLE:yesINTRA-POLICY:inner middle UPPER BOUND: 32MOUNT POINT:N/A LABEL: no MIRROR WRITE CONSISTENCY:on/ACTIVEEACH LP COPY ON A SEPARATE PV?: yesSerialize IO?: NO

In example 12, we use the mklv command to create a logical volume named lv4 in the volume group test1vg, which is of type sysdump and has two logical partitions, each with three replicas located in the center of three different disks (hdisk5, hdisk6, and hdisk7); this logical volume is labeled demo-label and can have up to five logical partitions.

Example 12 uses the mklv command

# mklv-y lv4-t sysdump-ac-e x-c3-L demo-label-x5 test1vg 2 hdisk5 hdisk6 hdisk7lv4# lslv lv4LOGICAL VOLUME:lv4 VOLUME GROUP:test1vgLV IDENTIFIER:00c5e9de00004c0000000107a5b596ab.5 PERMISSION:read/writeVG STATE:active/complete LV STATE:closed/syncdTYPE:sysdump WRITE VERIFY:offMAX LPs:5 PP SIZE:512 megabyte (s) COPIES:3 SCHED POLICY: ParallelLPs:2 PPs: 6STALE PPs:0 BB POLICY:relocatableINTER-POLICY:maximum RELOCATABLE:yesINTRA-POLICY:center UPPER BOUND: 32MOUNT POINT:N/A LABEL:demo-labelMIRROR WRITE CONSISTENCY:on/ACTIVEEACH LP COPY ON A SEPARATE PV?: yesSerialize IO?: NO

In example 13, we use the mklv command to create a logical volume called lv5 in the volume group test1vg, which is of type jfs2 and has three logical partitions, each with two fixed (pinned) replicas on different disks, where read / write operations are performed sequentially, write checking is enabled, and the Ipedo O operation is serialized.

Example 13 uses the mklv command

# mklv-y lv5-t jfs2-c2-rn-bn-ds-vy-oy test1vg 2 hdisk5 hdisk6lv5# lslv lv5LOGICAL VOLUME:lv5 VOLUME GROUP:test1vgLV IDENTIFIER:00c5e9de00004c0000000107a5b596ab.6 PERMISSION:read/writeVG STATE:active/complete LV STATE:closed/syncdTYPE:jfs2 WRITE VERIFY:onMAX LPs:512 PP SIZE:512 megabyte (s) COPIES:2 SCHED POLICY:sequentialLPs: 3 PPs: 6STALE PPs:0 BB POLICY:non-relocatableINTER-POLICY:minimum RELOCATABLE:noINTRA-POLICY:middle UPPER BOUND: 32MOUNT POINT:N/A LABEL: no MIRROR WRITE CONSISTENCY:on/ACTIVEEACH LP COPY ON A SEPARATE PV?: yesSerialize IO?: YES delete logical volume

The rmlv command is used to delete logical volumes. ? Delete only the logical volume, but not other entities, such as the file system or paging space that uses the logical volume.

In example 14, we provide an example of deleting a logical volume using rmlv, as follows:

Lsvg-l test1vg displays all the LV contained in the test1vg.

Rmlv lv7 prompts the user for confirmation and then deletes the lv7.

Lslv-l lv1 displays the physical partitions of lv1 on hdisk5, hdisk6, and hdisk7.

Rmlv-p hdisk7 lv1 attempts to delete the partition of lv1 on hdisk7 and prompts the user for confirmation. The operation cannot be performed because lv1 is open.

Umount / fs1 turns off lv1.

Rmlv-p hdisk7 lv1 attempts to delete the partition of lv1 on hdisk7, prompts the user for confirmation, and completes successfully.

Lslv-l lv1 confirms that the physical partition of lv1 on hdisk7 has been deleted.

Example 14 Delete a logical volume

# lsvg-l test1vgtest1vg:LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINTlv1 jfs2 3 9 3 open/syncd / fs1lv2 jfs2 2 4 2 closed/syncd / fs2logggg jfs2log 2 2 1 open/syncd N/Alv3 jfs2 10 10 1 closed/syncd N/Alv4 sysdump 2 6 3 closed/syncd N/Alv5 jfs2 3 6 2 closed/syncd N/Alv6 jfs2 2 4 2 closed/syncd N/Alv7 jfs2 2 4 2 closed/syncd N/A# rmlv lv7Warning All data contained on logical volume lv7 will be destroyed.rmlv:Do you wish to continue? Y (es) n (o)? Yrmlv:Logical volume lv7 is removed.# lslv-l lv1lv1:/fs1PV COPIES IN BAND DISTRIBUTIONhdisk5 003 rmlv 000000 100% 000:003:000:000:000hdisk6 003 000:003:000:000:000hdisk6 003 000:003:000:000:000hdisk6 003 000:003:000:000:000hdisk6 003 000:003:000:000:000hdisk6 003 000:003:000:000:000hdisk6 003 rmlv-p hdisk7 lv10516-914 rmlv:Warning All data belonging to logical volumelv1 on physical volume hdisk7 will be destroyed.rmlv:Do you wish to continue? Y (es) n (o)? Y0516-1008 rmlv:Logical volumelv1 must be closed.If the logicalvolume contains a filesystem, the umount command will closethe LV device.# umount / fs1# rmlv-p hdisk7 lv10516-914 rmlv:Warning, all data belonging to logical volumelv1 on physical volume hdisk7 will be destroyed.rmlv:Do you wish to continue? Y (es) n (o)? Y # lslv-l lv1lv1:/fs1PV COPIES IN BAND DISTRIBUTIONhdisk5 003 000:003:000:000:000hdisk6 000000 000:003:000:000:000hdisk6 003 000:003:000:000:000hdisk6 003 000:003:000:000:000hdisk6 000000 increase the size of the logical volume

Additional logical partitions can be added to existing logical volumes by using the extendlv command. By default, logical volumes retain their characteristics when they are extended. You can use flags to change only these features of the partition you want to add. The initial characteristics of the entire volume group will remain unchanged. You can specify one or more disks that will hold the newly defined partitions. Cannot exceed the maximum number of partitions defined for this volume group. You can also specify a block whose size is in KB, MB, or GB. The system automatically determines the minimum number of partitions required to meet the request.

In example 15, we use the extendlv command to extend the logical volume lv1 through three logical partitions located at the inner edges of hdisk5 and hdisk6.

Example 15 uses the extendlv command

# lslv-l lv1lv1:/fs1PV COPIES IN BAND DISTRIBUTIONhdisk5 003 ex lv1 000000 extendlv-an ie-ex lv1 3 hdisk5 hdisk6# lslv-l lv1lv1:/fs1PV COPIES IN BAND DISTRIBUTIONhdisk5 006 000:003:000:000:003hdisk6 000000 50% 006Rd 00000 000 50% 000R 003 replication logic volume

You can copy the contents of a logical volume to a new or existing logical volume. To preserve data integrity, you should ensure that the size of the destination logical volume is at least equal to that of the source logical volume.

The following example shows how to use the cplv command to copy the logical volume lv1 to a logical volume named lv8 in the dumpvg volume group:

Cplv-v dumpvg-y lv8 lv1 creates a copy of a logical volume

You can use the mklvcopy command to increase the number of copies of a logical partition. Logical volumes retain their characteristics. New copies can be synchronized manually or automatically.

In example 16, we use the mklvcopy command to create and synchronize an additional copy of each logical partition of the logical volume lv1. The newly created copy will be on hdisk7.

Example 16 create and synchronize additional copies of logical partitions using mklvcopy

# lslv-m lv1lv1:/fs1LP PP1 PV1 PP2 PV2 PP3 PV30001 0029 hdisk5 0029 hdisk60002 0030 hdisk5 0030 hdisk60003 0031 hdisk5 0031 hdisk60004 0110 hdisk5 0111 hdisk60005 0110 hdisk6 0112 hdisk50006 0112 hdisk5 0112 hdisk60007 0113 hdisk5 0113 hdisk60008 0114 hdisk5 0114 hdisk60009 0115 hdisk6# mklvcopy-k lv1 3 hdisk7 & # lslv -m lv1lv1:/fs1LP PP1 PV1 PP2 PV2 PP3 PV30001 0029 hdisk5 0029 hdisk6 0110 hdisk70002 0030 hdisk5 0030 hdisk6 0111 hdisk70003 0031 hdisk5 0031 hdisk6 0112 hdisk70004 0110 hdisk5 0111 hdisk6 0113 hdisk70005 0110 hdisk6 0112 hdisk5 0114 hdisk70006 0111 hdisk5 0112 hdisk6 0115 hdisk70007 0113 hdisk5 0113 hdisk6 0116 hdisk70008 0114 hdisk5 0114 hdisk6 0117 hdisk70009 0115 hdisk5 0115 hdisk6 0118 hdisk7 change the characteristics of logical volumes

You can use the chlv command to change the characteristics of an existing logical volume. If you change properties that affect the location of physical partitions, they do not affect existing partitions, but only those that will be added or deleted later. If you make changes that affect the file system that resides on the logical volume, you must also update the file system characteristics.

In example 17, we use the chlv command to change the maximum number of logical partitions for the logical volume lv1 to 1000 and the scheduling policy for the I O operation to "parallel / round-robin".

Example 17 change logical volume characteristics

# lslv lv1LOGICAL VOLUME:lv1 VOLUME GROUP:test1vgLV IDENTIFIER:00c5e9de00004c0000000107a5b596ab.1 PERMISSION:read/writeVG STATE: activate / complete LV STATE:opened/syncdTYPE:jfs2 WRITE VERIFY:offMAX LPs:512 PP SIZE:512 megabyte (s) COPIES:3 SCHED POLICY:parallelLPs:9 PPs: 27STALE PPs:0 BB POLICY:relocatableINTER-POLICY:minimum RELOCATABLE:yesINTRA-POLICY:inner edge UPPER BOUND: 32MOUNT POINT:/fs1 LABEL:NoneMIRROR WRITE CONSISTENCY:on/ACTIVEEACH LP COPY ON A SEPARATE PV?: yesSerialize IO?: NO# chlv-x 1000-d pr lv1# lslv lv1LOGICAL VOLUME:lv1 VOLUME GROUP:test1vgLV IDENTIFIER:00c5e9de00004c0000000107a5b596ab.1 PERMISSION:read/writeVG STATE: Active/complete LV STATE:closed/syncdTYPE:jfs2 WRITE VERIFY:offMAX LPs:1000 PP SIZE:512 megabyte (s) COPIES:3 SCHED POLICY:parallel/round robinLPs:9 PPs: 27STALE PPs:0 BB POLICY:relocatableINTER-POLICY:minimum RELOCATABLE:yesINTRA- POLICY:inner edge UPPER BOUND: 32MOUNT POINT:/fs1 LABEL:NoneMIRROR WRITE CONSISTENCY:on/ACTIVEEACH LP COPY ON A SEPARATE PV?: yesSerialize IO?: NO split logical Volume

You can use the splitlvcopy command to split a logical volume with at least two copies of each logical partition into two different logical volumes. The newly created logical volume will have the same characteristics as the original logical volume. It is recommended that you close the logical volume to be split. If the original logical volume contains a file system, the data in the newly created logical volume must be accessed as a different file system.

In example 18, we use the splitlvcopy command to split a logical volume into two copies, as follows (no file system data is retained):

Lsvg-l testvg shows that testvg contains the logical volume testlv, which is of type jfs2 and has / test as the mount point.

Lslv-m testlv shows that testlv has three mirrored copies located on hdisk5, hdisk6, and hdisk7, respectively.

Splitlvcopy-y copylv testlv 2 attempts to split the logical volume and prompts the user for confirmation because testlv is open and the data may be corrupted.

Umount / test closes the logical volume testlv.

Splitlvcopy-y copylv testlv 2 splits the logical volume.

Lsvg-l testvg shows that the new logical volume copylv has been created.

Lslv-m testlv shows that testlv now has only two mirrored copies, one on hdisk5 and one on hdisk6.

Lslv-m copylv shows that copylv contains partitions in hdisk7.

Lslv copylv shows the characteristics of the newly created logical volume copylv. Note that the logical volume has no mount point.

Crfs-v jfs2-d / dev/copylv-m / copy creates a file system structure for copylv. Note that this command does not destroy any file system data.

"if you want to preserve the file system data on the original logical volume, you should not run the crfs command in the previous step, but execute the following command:"

Mkdir / copy creates a replica directory.

Mount / dev/copylv / copy installs the replicated file system.

Manually edit the / etc/filesystems file and add an entry for the / copy mount point.

Example 18 using splitlvcopy

# lsvg-l testvgtestvg:LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINTtestlv jfs2 3 9 3 open/syncd / testloglv00 jfs2log 1 1 1 open/syncd N/A# lslv-m testlvtestlv:/testLP PP1 PV1 PP2 PV2 PP3 PV30001 0056 hdisk5 0056 hdisk6 0056 hdisk70002 0057 hdisk5 0057 hdisk6 0057 hdisk70003 0058 hdisk5 0058 hdisk6 0058 hdisk7# splitlvcopy-y copylv testlv 2splitlvcopyvision the logical volume being split Testlv, is open.Splitting an open logical volume may cause data loss or corruptionand is not supported by IBM.IBM will not be held responsible fordata loss or corruption caused by splitting an open logical volume.Do you wish to continue? Y (es) n (o)? N # umount / test# splitlvcopy-y copylv testlv 2copylv# lsvg-l testvgtestvg:LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINTtestlv jfs2 3 6 2 closed/syncd / testloglv00 jfs2log 1 1 closed/syncd N/Acopylv jfs2 3 3 1 closed/syncd N/A# lslv-m testlvtestlv:/testLP PP1 PV1 PP2 PV2 PP3 PV30001 0056 hdisk5 0056 hdisk60002 0057 hdisk5 0057 hdisk60003 0058 hdisk5 0058 hdisk6# lslv-m copylvcopylv:N/ALP PP1 PV1 PP2 PV2 PP3 PV30001 0056 hdisk70002 0057 hdisk70003 0058 hdisk7# lslv copylvLOGICAL VOLUME:copylv VOLUME GROUP:testvgLV IDENTIFIER:00c478de00004c0000000107c4419ccf.3 PERMISSION:read/writeVG STATE:active/complete LV STATE:closed/syncdTYPE:jfs2 WRITE VERIFY:offMAX LPs:512 PP SIZE:256 megabyte (s) COPIES:1 SCHED POLICY:parallelLPs:3 PPs: 3STALE PPs:0 BB POLICY:relocatableINTER-POLICY:minimum RELOCATABLE:yesINTRA-POLICY:middle UPPER BOUND: 32MOUNT POINT:N/A LABEL:/testMIRROR WRITE CONSISTENCY:on/ACTIVEEACH LP COPY ON A SEPARATE PV?: yesSerialize IO?: NO# crfs-v jfs2-d / dev/copylv-m / copyFile system created successfully.786204 kilobytes total disk space.New File System size is 1572864 Delete a copy of a logical volume

You can use the rmlvcopy command to delete a logical partitioned copy of a logical volume.

In example 19, we use the rmlvcopy command to delete a set of copies of the logical partition testlv, as follows:

Lslv-m testlv shows that testlv has three mirrored copies located on hdisk5, hdisk6, and hdisk7, respectively.

Rmlvcopy testlv 2 hdisk6 deletes the copy located on the hdisk6 and retains two mirrored copies.

Lslv-m testlv shows that testlv now has two mirrored copies on hdisk5 and hdisk7.

Example 19 using rmlvcopy

# lslv-m testlvtestlv:/testLP PP1 PV1 PP2 PV2 PP3 PV30001 0056 hdisk5 0056 hdisk6 0059 hdisk70002 0057 hdisk5 0057 hdisk6 0060 hdisk70003 0058 hdisk5 0058 hdisk6 0061 hdisk7# rmlvcopy testlv 2 hdisk6# lslv-m testlvtestlv:/testLP PP1 PV1 PP2 PV2 PP3 PV30001 0056 hdisk5 0059 hdisk70002 0057 hdisk5 0060 hdisk70003 0058 hdisk5 0061 hdisk7 go back to the page header

Summary of LVM commands

All LVM commands have corresponding menus in SMIT.

Table 2 provides a summary of the LVM commands, their corresponding SMIT fast routes, and a brief description of each command.

Table 2 Summary of LVM commands

The command SMIT Express > briefly describes how chpvsmit chpv changes the characteristics of a physical volume. Lspvsmit lspv lists information about physical volumes. Migratepvsmit migratepv migrates physical partitions from one physical volume to another. Mkvgsmit mkvg creates a volume group. Lsvgsmit lsvg lists information about volume groups. Reducevgsmit reducevg removes a physical volume from the volume group. Chvgsmit chvg changes the characteristics of the volume group. Importvgsmit importvg imports the definition of the volume group into the system. Exportvgsmit exportvg removes the definition of a volume group from the system. Varyonvgsmit varyonvg activates a volume group. Varyoffvgsmit varyoffvg disables a volume group. Mklvsmit mklv creates logical volumes. Lslvsmit lslv lists information about a logical volume. Chlvsmit chlv changes the characteristics of logical volumes. Rmlvsmit rmlv deletes the logical volume. Extendlvsmit extendlv extends logical volumes. Mklvcopysmit mklvcopy creates a copy of the logical volume. Rmlvcopysmit rmlvcopy deletes a copy of the logical volume. These are the basic concepts and operations of AIX storage management shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report