<AIX>《AIX RAID operation of LV logical volume mirroring, that is, lvcopy operation》

“AIX RAID operation of LV logical volume mirroring, that is, lvcopy operation”

  • 1 RAID technology
  • 2 AIX logical volume group mirroring
  • 3 environment
  • 3.1 Operating system version
  • 3.2 Check the lv of rootvg
  • 3.3 Check the disk information of rootvg
  • 4 Create the lv logical volume of test test
    • 4.1 Test 1: Create mirror lv directly
    • 4.2 Test 2: Create an LV without mirroring
  • 5 Compare the disk space to see if it can be copied
    • 5.1 Does the replication operation require stopping the business?
  • 6 Perform copy operation
  • 7 can be executed directly using the command line
  • 8. Immediately perform the mirror copy operation after the operation is completed.
  • 9 Check whether the copy is successful
    • 9.1 Check STALE PPs

1 RAID technology

RAID (Redundant Array of Disks) technology is a technology that combines multiple physical disks to provide higher performance, higher availability, and data redundancy. AIX is a UNIX operating system from IBM that supports RAID technology.

The principle of RAID technology is to combine multiple disk drives to form a logical drive. By spreading data across multiple disks, RAID can increase the speed and reliability of data access. The following are common RAID levels and how they work:

RAID level 0: Also known as striping, data is divided into blocks and distributed across multiple disks. This provides higher performance because data can be read from or written to multiple disks simultaneously. However, RAID 0 has no redundancy, and if one disk fails, all data will be lost.

RAID level 1: Also called mirroring, data is stored on two disks at the same time, providing redundancy. If one disk fails, the other disk can still provide data. The disadvantage of RAID 1 is that it requires twice the storage space.

RAID Level 5: Uses distributed parity for data redundancy and performance improvement. Data and parity are stored distributedly across multiple disks, allowing data to be recovered in the event of a disk failure. RAID 5 requires at least three disk drives.

RAID Level 6: Similar to RAID 5, but uses two parity codes to provide greater fault tolerance. RAID 6 requires at least four disk drives.

RAID Level 10: Also known as RAID 1 + 0 or mirrored striping, combines multiple RAID 1 arrays into a single RAID 0 array. Provides higher performance and redundancy and requires at least four disk drives.

2 AIX logical volume group mirroring

AIX’s logical volume group (lv) is generally used as the most basic operating unit for data storage. For example, file system or raw device are created in a logical volume group (lv). Mirror logical volume groups and store data on multiple disks to provide redundancy for data storage and ensure data security.
rule:
1. lv uses hdisk2 disk, so the copied disk cannot use hdisk2 and must use other disks.
2. If lv uses hdisk2 disk 100PPs, the copied disk will have at least 100PPs free space left.
3. Directly create a mirrored LV, then the Number of COPIES of each logical value is set to 2, and at least the PHYSICAL VOLUME names value is set to 2 disks; then the Number of When COPIES of each logical value is set to 3, at least PHYSICAL VOLUME names value is set to 3 disks, and the size of each disk is greater than the number of PPs set by Number of LOGICAL PARTITIONS .
Will,

3 Environment

Operating system: AIX 6.1
Volume group: rootvg
Logical volume group: logbaklv
Mounted on the file system: /db2logbak

3.1 operating system version

# oslevel -s
7100-03-04-1441

3.2 Check the lv of rootvg

# lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 2 2 closed/syncd N/A
hd6 paging 5 10 4 open/syncd N/A
hd8 jfs2log 1 2 2 open/syncd N/A
hd4 jfs2 140 280 3 open/syncd /
hd2 jfs2 20 40 2 open/syncd /usr
hd9var jfs2 20 40 2 open/syncd /var
hd3 jfs2 100 200 3 open/syncd /tmp
hd1 jfs2 220 440 6 open/syncd /home

3.3 Check rootvg’s disk information

# lsvg -p rootvg
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 546 0 00..00..00..00..00
hdisk1 active 546 0 00..00..00..00..00
hdisk2 active 546 19 19..00..00..00..00
hdisk3 active 546 0 00..00..00..00..00
hdisk4 active 546 0 00..00..00..00..00
hdisk5 active 546 0 00..00..00..00..00
hdisk6 active 546 0 00..00..00..00..00
hdisk7 active 546 231 100..40..91..00..00

4 Create the lv logical volume of test test

# smit lv
List All Logical Volumes by Volume Group
Add a Logical Volume # Select this
Set Characteristic of a Logical Volume
Show Characteristics of a Logical Volume
 Remove a Logical Volume
Copy a Logical Volume
Then select VG as rootvg, and then set the disk information
\t 
                                                        [Entry Fields]
  Logical volume NAME [test]
* VOLUME GROUP name rootvg
* Number of LOGICAL PARTITIONS [5] #Enter the lv size you want to create #
  PHYSICAL VOLUME names [hdisk2] #Select the disk with remaining space +
  Logical volume TYPE [jfs2] +
  POSITION on physical volume middle +
  RANGE of physical volumes minimum +
  MAXIMUM NUMBER of PHYSICAL VOLUMES [100] #
    to use for allocation
  Number of COPIES of each logical 1 +
    partition
  Mirror Write Consistency? active +
  Allocate each logical partition copy yes +
    on a SEPARATE physical volume?
  RELOCATE the logical volume during yes +
    reorganization?
  Logical volume LABEL []
  MAXIMUM NUMBER of LOGICAL PARTITIONS [512] #
  Enable BAD BLOCK relocation? yes +
  SCHEDULING POLICY for writing/reading parallel +
    logical partition copies
  Enable WRITE VERIFY? no +
  File containing ALLOCATION MAP []
  Stripe Size? [Not Striped] +
  Serialize IO? no +
  Mirror Pool for First Copy +
  Mirror Pool for Second Copy +
  Mirror Pool for Third Copy +
  Infinite Retry Option no +
\t  
\t

4.1 Test 1: Create mirror lv directly

Set the PHYSICAL VOLUME names value to hdisk2, hdisk7;
Set the Number of COPIES of each logical value to 2,
You can directly create an LV with mirror replication enabled.

$ lslv test
LOGICAL VOLUME: test VOLUME GROUP: rootvg
LV IDENTIFIER: 00ce31e300004c00000001736a1ccdd8.24 PERMISSION: read/write
VG STATE: active/complete LV STATE: closed/stale
TYPE: jfs2 WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 256 megabyte(s)
COPIES: 2 SCHED POLICY: parallel
LPs: 5 PPs: 10
STALE PPs: 5 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: middle UPPER BOUND: 16
MOUNT POINT: N/A LABEL: None
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV?: yes
SerializeIO?: NO
INFINITE RETRY: no PREFERRED READ: 0

# lslv -l test
PV COPIES IN BAND DISTRIBUTION
hdisk7 005:000:000 100% 000:005:000:000:000
hdisk2 005:000:000 0% 000:000:000:000:000

4.2 Test 2: Create an LV without mirroring

Set the PHYSICAL VOLUME names value to hdisk2
Set the Number of COPIES of each logical value to 1,

$ lslv test
LOGICAL VOLUME: test VOLUME GROUP: rootvg
LV IDENTIFIER: 00ce31e300004c00000001736a1ccdd8.24 PERMISSION: read/write
VG STATE: active/complete LV STATE: closed/stale
TYPE: jfs2 WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 256 megabyte(s)
COPIES: 1 SCHED POLICY: parallel
LPs: 5 PPs: 5
STALE PPs: 5 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: middle UPPER BOUND: 16
MOUNT POINT: N/A LABEL: None
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV?: yes
SerializeIO?: NO
INFINITE RETRY: no PREFERRED READ: 0
# lslv -l test
test:N/A
PV COPIES IN BAND DISTRIBUTION
hdisk7 005:000:000 100% 000:005:000:000:000
# lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 2 2 closed/syncd N/A
hd6 paging 5 10 4 open/syncd N/A
hd8 jfs2log 1 2 2 open/syncd N/A
hd4 jfs2 140 280 3 open/syncd /
hd2 jfs2 20 40 2 open/syncd /usr
hd9var jfs2 20 40 2 open/syncd /var
hd3 jfs2 100 200 3 open/syncd /tmp
hd1 jfs2 220 440 6 open/syncd /home
test jfs2 5 5 1 closed/syncd N/A


5 Compare the disk space to see if it can be copied

According to Chapter 2.2.2, we know that the test logical volume occupies 5 PPs and uses the hdisk7 disk. If you want to copy the test logical volume, you need to find another disk larger than 5PPs in the rootvg where it is located. Currently hdisk2 can be used.

5.1 Does the replication operation require stopping the business?

Replication does not affect business, there is no need to stop business, and there is no need to uninstall the directory

6 Perform copy operation

# smit lv
 List All Logical Volumes by Volume Group
  Add a Logical Volume
  Set Characteristic of a Logical Volume # Select this
  Show Characteristics of a Logical Volume
  Remove a Logical Volume
  Copy a Logical Volume

Change a Logical Volume
  Rename a Logical Volume
  Increase the Size of a Logical Volume
  Add a Copy to a Logical Volume # Select this
  Remove a Copy from a Logical Volume

Setting parameters
                                                      [Entry Fields]
*LOGICAL VOLUME name test
* NEW TOTAL number of logical partition 2 #The default values are 1, 2, and 3. Setting the parameter to 2 means copying one image, and setting it to 3 means copying 2 images. +
    copies
  PHYSICAL VOLUME names [hdisk2] #Select a disk that is not used by LV, and the size is larger than the size of LV. +
  POSITION on physical volume middle +
  RANGE of physical volumes minimum +
  MAXIMUM NUMBER of PHYSICAL VOLUMES [16] #
    to use for allocation
  Allocate each logical partition copy yes +
    on a SEPARATE physical volume?
  File containing ALLOCATION MAP []
  SYNCHRONIZE the data in the new no +
    logical partition copies?
  Mirror Pool for First Copy [] +
  Mirror Pool for Second Copy [] +
  Mirror Pool for Third Copy []

7 can be executed directly using the command line

/usr/sbin/mklvcopy test 2 hdisk2

illustrate:
Parameter 2 means copying an image;
The parameter hdisk2 is the target disk.

8 Perform the mirror copy operation immediately after the operation is completed

# syncvg -P 8 -l test

illustrate:
The parameter 8 indicates that 8 threads perform replication
The parameter test is the lv name
If this step is not executed, the image will be copied in the background. Executing the command will turn the background into the foreground to speed up the process.
The execution time of this step: speed estimation, 5 PPS is executed in 30 seconds, and 1.25Gb is copied.

9 Check whether the copy is successful

1. Before copying

$ lslv test
LOGICAL VOLUME: test VOLUME GROUP: rootvg
LV IDENTIFIER: 00ce31e300004c00000001736a1ccdd8.24 PERMISSION: read/write
VG STATE: active/complete LV STATE: closed/stale
TYPE: jfs2 WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 256 megabyte(s)
COPIES: 2 SCHED POLICY: parallel
LPs: 5 PPs: 10
STALE PPs: 5 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: middle UPPER BOUND: 16
MOUNT POINT: N/A LABEL: None
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV?: yes
SerializeIO?: NO

2. After copying

LOGICAL VOLUME: test VOLUME GROUP: rootvg
LV IDENTIFIER: 00ce31e300004c00000001736a1ccdd8.24 PERMISSION: read/write
VG STATE: active/complete LV STATE: closed/syncd
TYPE: jfs2 WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 256 megabyte(s)
COPIES: 2 SCHED POLICY: parallel
LPs: 5 PPs: 10
STALE PPs: 0 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: middle UPPER BOUND: 16
MOUNT POINT: N/A LABEL: None
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV?: yes
SerializeIO?:NO
INFINITE RETRY: no PREFERRED READ: 0

9.1 Check STALE PPs

The STALE PPs value should be 0; indicating that the copy process is completed.
PPs should be twice the LPs.