[AIX 운영 체제와 장치 관리 33] LVM 구성 (2) — 디스크 구성 세 방법, 물리 볼륨 만들기, rootvg PVID·VGID 바꾸기, 고장 난 PV 교체, PV 누락 알림, 미러 디스크 분리(splitvg)

핵심 정리

  • 새 디스크는 시스템을 끌 수 있으면 부팅 때 cfgmgr에 맡기고(방법 1), 끌 수 없으면 정보를 알 때 mkdev(방법 2), 위치만 알 때 cfgmgr(방법 3)로 구성합니다. LVM이 쓰려면 PVID가 있어야 하며 chdev -l hdiskN -a pv=yes로 만듭니다.
  • chdev -l sys0 -a ghostdev=2 뒤 재부팅하면 ipl_varyon이 rootvg 디스크의 PVID와 VGID를 바꾸고 값을 다시 지웁니다.
  • 미러 VG의 고장 난 PV는 rootvg가 아니고 조건이 맞으면 replacepv old new 한 번으로 바꿉니다. 아니면 unmirrorvg → bootlist·덤프 장치 정리 → reducevg → ipldevice 링크 복구 → 교체 → extendvg → mirrorvg → bosboot·bootlist 순서로 합니다.
  • /etc/objrepos/errnotify에 LVM_SA_PVMISS 스탠자를 odmadd로 더하면 미러 때문에 눈에 띄지 않는 PV 누락을 콘솔과 root 메일로 알립니다.
  • splitvg로 미러 디스크를 시점 백업으로 떼어 내고 joinvg로 다시 합칩니다. 누락 디스크·stale 파티션이 있거나 동시 모드이면 쓸 수 없습니다.
항목 내용
버전 AIX 6.1 (5.3판과 거의 같음, ghostdev 절 추가)
원문 Operating system and device management — 5.3판 5879쪽 일부, 6.1판 354362쪽
관련 명령어 lspv, cfgmgr, mkdev, chdev -a pv=yes, chdev -l sys0 -a ghostdev=2, replacepv, unmirrorvg, bootlist, mirrorvg, bosboot, odmadd, splitvg, joinvg
관련 파일 /etc/objrepos/errnotify, /dev/ipldevice

새 디스크는 여러 방법으로 구성할 수 있습니다.

다음 가운데 하나로 새 디스크를 구성할 수 있습니다.

  • 시스템을 종료하고 전원을 끌 수 있으면 방법 1을 씁니다. 가능하면 물리 디스크를 붙일 때는 늘 시스템을 종료하고 전원을 끄는 것이 좋습니다.
  • 시스템을 종료할 수 없고 새 디스크의 하위 클래스, 형, 부모 이름, 연결 위치 같은 세부 사항을 알면 방법 2를 씁니다.
  • 시스템을 종료할 수 없고 디스크 위치만 알면 방법 3을 씁니다.

디스크를 구성하면 대체로 쓸 수 있지만, 논리 볼륨 관리자는 디스크를 물리 볼륨으로 더 식별해야 합니다.

방법 1

디스크를 붙이기 전에 시스템을 종료하고 전원을 끌 수 있을 때 다음 방법을 씁니다.

  1. 새 디스크를 시스템에 물리적으로 연결한 뒤 시스템과 함께 온 문서에 따라 디스크와 시스템 전원을 켭니다.
  2. 시스템이 부팅하는 동안 구성 관리자(cfgmgr)가 디스크를 자동으로 구성하게 둡니다.
  3. 부팅 뒤 root 권한으로 명령행에서 lspv 명령을 입력해 새 디스크 이름을 찾습니다. 시스템은 다음 가운데 하나와 비슷한 항목을 돌려줍니다.
text
hdisk1  none                     none

또는

text
hdisk1  00005264d21adb2e         none

첫 필드는 시스템이 할당한 디스크 이름입니다. 둘째 필드는 물리 볼륨 ID(PVID)가 있으면 보여 줍니다. lspv 출력에 새 디스크가 나오지 않으면 Installation and migration을 봅니다.

이제 시스템은 디스크를 쓸 수 있지만 LVM이 쓰려면 PVID가 필요합니다. 새 디스크에 PVID가 없으면 "쓸 수 있는 디스크를 물리 볼륨으로 만들기"를 봅니다.

방법 2

시스템을 종료할 수 없고 새 디스크에 관해 다음 정보를 알 때 이 방법을 씁니다.

  • 디스크가 붙는 방식(하위 클래스)
  • 디스크 형(형)
  • 디스크가 연결된 시스템 부착점(부모 이름)
  • 디스크의 논리 주소(연결 위치)

다음을 합니다.

  1. 새 디스크를 시스템에 물리적으로 연결한 뒤 문서에 따라 디스크와 시스템 전원을 켭니다.
  2. 디스크를 구성하고 물리 볼륨으로 쓸 수 있게 하려면 다음 예처럼 플래그와 함께 mkdev 명령을 씁니다.
text
mkdev -c disk -s scsi -t 2200mb -p scsi3 \
-w 6,0 -a pv=yes

이 예는 SCSI ID 6, 논리 장치 번호 0인 2.2GB 디스크를 scsi3 SCSI 버스에 더합니다. -c 플래그는 장치 클래스, -s는 하위 클래스, -t는 장치 형, -p는 할당할 부모 장치 이름, -w는 SCSI ID와 논리 장치 번호로 디스크 위치를 지정합니다. -a 플래그는 장치 속성-값 쌍 pv=yes를 지정하며, 디스크를 물리 볼륨으로 만들고 (아직 없으면) 고유한 물리 볼륨 식별자가 든 부트 레코드를 디스크에 씁니다.

이제 디스크는 쓸 수 있는 장치이자 물리 볼륨으로 정의됐습니다. 명령행에서 lspv 명령을 입력해 새 디스크 항목을 나열할 수 있습니다. lspv 출력에 새 디스크가 나오지 않으면 Installation and migration을 봅니다.

방법 3

시스템을 종료할 수 없고 디스크 위치만 알 때 이 방법을 씁니다.

  1. 새 디스크를 시스템에 물리적으로 연결한 뒤 문서에 따라 디스크와 시스템 전원을 켭니다.
  2. 시스템에 이미 구성된 물리 디스크를 확인하려면 명령행에서 lspv 명령을 입력합니다. 출력은 다음과 비슷합니다.
text
hdisk0       000005265ac63976    rootvg
  1. 명령행에서 cfgmgr를 입력해 구성 관리자를 실행합니다. 구성 관리자는 새 디스크를 포함해 시스템에 새로 연결한 모든 장치를 자동으로 감지하고 구성합니다.
  2. 새 디스크가 구성됐는지 확인하려면 lspv 명령을 다시 입력합니다. 출력은 다음 가운데 하나와 비슷합니다.
text
hdisk1    none                none

또는

text
hdisk1   00005264d21adb2e     none

첫 필드는 시스템이 할당한 디스크 이름, 둘째 필드는 PVID(있으면)입니다. lspv 출력에 새 디스크가 나오지 않으면 Installation and migration을 봅니다.

이제 시스템은 디스크를 쓸 수 있지만 LVM이 쓰려면 PVID가 필요합니다. 새 디스크에 PVID가 없으면 "쓸 수 있는 디스크를 물리 볼륨으로 만들기"를 봅니다.

관련 작업

  • 물리 볼륨 내용 옮기기

쓸 수 있는 디스크를 물리 볼륨으로 만들기

디스크를 볼륨 그룹에 할당하고 LVM이 쓰려면 먼저 물리 볼륨으로 구성해야 합니다.

물리 볼륨을 구성하려면 다음 지침을 따릅니다.

  1. 운영 체제가 디스크를 알고, 쓸 수 있으며, 운영 체제나 응용 프로그램이 쓰고 있지 않은지 확인합니다. 명령행에서 lspv 명령을 입력합니다. 출력은 다음과 비슷합니다.
text
hdisk1  none                     none

출력에서 다음을 확인합니다.

  • 새 디스크 이름이 출력에 없으면 "디스크 구성"을 봅니다.
  • 출력의 둘째 필드에 시스템이 만든 PVID(예: 00005264d21adb2e)가 있으면 디스크는 이미 물리 볼륨으로 구성돼 있으므로 이 절차를 마칠 필요가 없습니다.
  • 셋째 필드에 볼륨 그룹 이름(예: rootvg)이 있으면 디스크를 지금 쓰고 있으므로 이 절차에 알맞지 않습니다. 새 디스크에 PVID가 없고 쓰이지 않으면 다음 단계로 갑니다.
  1. 쓸 수 있는 디스크를 물리 볼륨으로 바꾸려면 명령행에서 chdev 명령을 입력합니다. 예:
text
chdev -l hdisk3 -a pv=yes

-l 플래그는 디스크의 장치 이름을 지정합니다. -a 플래그는 장치 속성-값 쌍 pv=yes를 지정하며, 디스크를 물리 볼륨으로 만들고 (아직 없으면) 고유한 물리 볼륨 식별자가 든 부트 레코드를 씁니다.

이제 디스크는 물리 볼륨으로 정의됐습니다. 명령행에서 lspv 명령으로 새 디스크 항목을 나열할 수 있습니다.

rootvg의 PVID와 VGID 바꾸기

시스템 부팅 단계에서 rootvg 볼륨 그룹의 물리 볼륨 식별자(PVID)와 볼륨 그룹 식별자(VGID)를 바꿀 수 있습니다.

rootvg의 PVID와 VGID를 바꾸려면 sys0 장치의 ghostdev 속성을 2로 설정하고 시스템을 재부팅합니다. sys0 장치의 ghostdev 속성은 비트 플래그입니다.

  • rootvg 볼륨 그룹의 PVID와 VGID를 바꾸도록 sys0 장치의 ghostdev 속성을 설정하려면 다음 명령을 입력합니다.
text
chdev -l sys0 -a ghostdev=2

참고: ipl_varyon 명령이 rootvg의 모든 디스크의 PVID와 VGID를 바꾸면 sys0 장치 ghostdev 속성의 값 2는 해제됩니다. rootvg 디스크의 PVID를 바꾸는 chdev 명령이 실패하면 ipl_varyon 명령은 경고 메시지를 보내고 rootvg vary-on을 계속합니다. 그런 경우 다음 재부팅 때 PVID와 VGID를 바꾸려면 sys0 장치 ghostdev 속성을 다시 2로 설정합니다.

  • ghostdev 속성 값을 나열하려면 다음 명령을 입력합니다.
text
lsattr -E -l sys0 -a ghostdev

미러 볼륨 그룹에서 고장 난 물리 볼륨 바꾸기

다음 절차는 미러 볼륨 그룹 안의 고장 난 물리 볼륨(PV)을 바꿉니다. 대부분의 구성에서는 replacepv 명령으로 고장 난 PV를 바꿀 수 있습니다. replacepv 명령을 쓸 수 없는 구성을 위한 다른 절차도 있습니다.

이 시나리오의 정보는 특정 AIX 버전으로 시험했습니다. AIX 버전과 수준에 따라 결과가 크게 다를 수 있습니다.

전제 조건

  • 고장 난 PV를 쓰는 모든 논리 볼륨에 다른 쓸 수 있는 PV에 유효한 사본이 있어야 합니다(전용 덤프 논리 볼륨은 예외일 수 있음).

replacepv 명령으로 고장 난 PV 바꾸기

전제 조건

아래 전제 조건 가운데 하나라도 만족할 수 없으면 다른 절차를 봅니다.

  • 고장 난 PV가 든 볼륨 그룹이 rootvg가 아닙니다.
  • 교체 PV를 고장 난 PV가 든 볼륨 그룹에 더할 수 있습니다(PV 크기와 MAX PPs per PV 같은 볼륨 그룹 특성에 따라 불가능할 수 있음).
  • 교체 PV를 고장 난 PV와 동시에 시스템에 구성할 수 있어야 합니다.
  • 교체 PV의 이름은 고장 난 PV와 달라도 됩니다.
  • 교체 PV의 크기는 고장 난 PV 이상이어야 합니다.
  • 고장 난 PV가 든 볼륨 그룹은 스냅숏 볼륨 그룹이거나 스냅숏 볼륨 그룹을 가지면 안 됩니다.

고장 난 PV가 hdisk2, 교체 PV가 hdisk10이라고 하고 다음 단계를 마칩니다.

  1. 교체 PV가 아직 시스템에 설치되지 않았으면 설치에 필요한 단계를 합니다. 구성 관리자로 새 PV를 정의하려면 다음 명령을 실행합니다.
text
cfgmgr

lspv 명령으로 PV에 할당된 이름을 알아냅니다. 이 예에서는 새 PV 이름을 hdisk10이라고 합니다. 2. 고장 난 PV를 1단계에서 정의한 PV로 바꾸려면 다음 명령을 실행합니다.

text
replacepv hdisk2 hdisk10

명령이 실행되면 hdisk2가 hdisk10으로 바뀌고 hdisk2는 더 이상 볼륨 그룹에 할당되지 않습니다. 3. 고장 난 PV의 정의를 지우려면 다음 명령을 실행합니다.

text
rmdev -dl hdisk2
  1. 고장 난 디스크를 시스템에서 물리적으로 뺍니다.
  2. 다음 단계로 절차가 성공했는지 확인합니다.
    • 모든 논리 볼륨이 원하는 대로 새 PV에 미러링됐는지 확인하려면 다음 명령을 실행합니다.
text
lslv lvname

고장 난 PV의 영향을 받은 각 논리 볼륨의 COPIES 속성을 확인해 원하는 사본 수가 있는지 봅니다. 사본 수가 모자라면 mklvcopy 명령으로 사본을 더 만듭니다.

  • 모든 논리 볼륨 파티션이 동기화돼 stale 파티션이 없는지 확인하려면 다음 명령을 실행합니다.
text
lspv hdisk10

교체한 PV의 STALE PARTITIONS 속성이 0인지 확인합니다. stale 파티션이 있으면 syncvg 명령으로 파티션을 동기화합니다.

5단계로 고장 난 PV 교체 절차가 끝납니다.

구성 때문에 replacepv 명령을 쓸 수 없을 때 고장 난 PV 바꾸기

고장 난 물리 볼륨 hdisk0과 그 미러 hdisk1이 yourvg 볼륨 그룹에 속한다고 합시다.

  1. 고장 난 PV에서 미러 사본을 지우려면 다음 명령을 실행합니다.
text
unmirrorvg yourvg hdisk0
  1. PV 고장이 rootvg에서 났으면 다음 명령으로 부트 목록에서 hdisk0을 뺍니다.

    참고: 구성에서 hdisk0과 hdisk1 말고 다른 부트 장치를 쓰면 명령 구문에 더합니다.

text
bootlist -om normal hdisk1

이 단계는 hdisk1이 rootvg에서 부팅 가능한 장치로 남아 있어야 합니다. 이 단계를 마친 뒤 출력에 hdisk0이 나오지 않는지 확인합니다. 3. PV 고장이 rootvg에서 났으면 고장 난 PV에 있던 전용 덤프 장치를 다시 만듭니다. 고장 난 PV에 전용 덤프 장치가 있었다면 mklv 명령으로 기존 PV에 새 논리 볼륨을 만들 수 있습니다. sysdumpdev 명령으로 새 논리 볼륨을 1차 덤프 장치로 설정합니다. 4. 고장 난 PV의 정의를 지우려면 다음 명령을 실행합니다.

참고: 고장 난 PV가 시스템을 부팅하는 데 쓴 PV이면 디스크 장치 항목을 지울 때 /dev/ipldevice 하드 링크도 지워집니다.

text
reducevg yourvg hdisk0
rmdev -dl hdisk0
  1. 고장 난 PV가 가장 최근에 쓴 부트 장치이면 다음 명령으로 4단계에서 지워진 /dev/ipldevice 하드 링크를 다시 만듭니다.
text
ln /dev/rhdisk1 /dev/ipldevice

PV 이름 앞에 r이 붙는 점에 주의합니다. /dev/ipldevice 하드 링크가 다시 만들어졌는지 확인하려면 다음 명령을 실행합니다.

text
ls /dev/ipldevice
  1. 고장 난 디스크를 바꿉니다.
  2. 새 PV를 정의하려면 다음 명령을 실행합니다.
text
cfgmgr

cfgmgr 명령이 교체 PV에 PV 이름을 할당합니다. 할당된 이름은 고장 난 PV에 할당됐던 이름과 같을 가능성이 큽니다. 이 예에서는 장치 hdisk0이 교체 PV에 할당됐다고 합니다. 8. 새 PV를 볼륨 그룹에 더하려면 다음 명령을 실행합니다.

text
extendvg yourvg hdisk0

다음 오류 메시지가 나올 수 있습니다.

text
0516-050 Not enough descriptor space left in this volume group.
Either try adding a smaller PV or use another volume group.

이 오류가 나서 PV를 볼륨 그룹에 더할 수 없으면 볼륨 그룹에 이미 있는 다른 PV로 논리 볼륨을 미러링하거나 더 작은 PV를 더해 볼 수 있습니다. 둘 다 불가능하면 chvg 명령으로 볼륨 그룹을 Big 형이나 Scalable 형으로 올려 이 제한을 우회해 볼 수 있습니다. 9. 볼륨 그룹을 미러링합니다.

참고: 다음 조건이 모두 해당하면 mirrorvg 명령을 쓸 수 없습니다.

  • 대상 시스템이 논리 파티션(LPAR)입니다.
  • 부트 논리 볼륨(기본 hd5)의 사본이 고장 난 PV에 있습니다.
  • 교체 PV의 어댑터를 마지막 콜드 부트 이후 LPAR에 동적으로 구성했습니다.

위 조건이 모두 해당하면 mklvcopy 명령으로 다음과 같이 각 논리 볼륨의 미러 사본을 다시 만듭니다. a. 부트 논리 볼륨이 연속된 물리 파티션에 할당되도록 사본을 만듭니다. b. 나머지 논리 볼륨의 사본을 만들고 syncvg 명령으로 동기화합니다. c. shutdown이나 reboot 명령으로 재부팅하지 말고 LPAR를 종료한 뒤 활성화해 디스크를 부팅 가능하게 합니다. 이 종료를 바로 할 필요는 없지만 시스템이 새 PV에서 부팅하려면 필요합니다. 그렇지 않으면 다음 명령으로 새 PV를 써서 볼륨 그룹의 논리 볼륨 사본을 새로 만듭니다.

참고: mirrorvg 명령은 기본으로 쿼럼을 끕니다. rootvg에서는 새 논리 볼륨 사본이 정상 디스크와 같은 방식으로 hdisk0에 대응되도록 -m 옵션을 쓰는 것이 좋습니다.

text
mirrorvg yourvg hdisk0
  1. 구성에 일부 논리 볼륨의 사본이 있으면 다음 명령으로 그 사본을 다시 만들어야 할 수 있습니다.
text
mklvcopy -k
  1. PV 고장이 rootvg에서 났으면 다음 명령으로 부트 레코드를 초기화합니다.
text
bosboot -a
  1. PV 고장이 rootvg에서 났으면 다음 명령으로 부트 목록을 갱신합니다.

    참고: 구성에서 hdisk0과 hdisk1 말고 다른 부트 장치를 쓰면 명령에 더합니다.

text
bootlist -om normal hdisk0 hdisk1
  1. 절차가 성공했는지 확인합니다.
    • 모든 논리 볼륨이 새 PV에 미러링됐는지 확인하려면 다음 명령을 실행합니다.
text
lslv lvname

영향을 받은 각 논리 볼륨의 COPIES 속성을 확인합니다. 사본 수가 모자라면 mklvcopy 명령으로 더 만듭니다. - 모든 논리 볼륨 파티션이 동기화됐는지 확인하려면 다음 명령으로 stale 파티션이 없는지 봅니다.

text
lspv hdisk0

교체한 PV의 STALE PARTITIONS 속성이 0인지 확인합니다. stale 파티션이 있으면 syncvg 명령으로 동기화합니다.

PV 고장이 rootvg에서 났으면 다음 단계로 이 절차의 다른 측면을 확인합니다.
- 부트 목록을 확인하려면 다음 명령을 실행합니다.
text
bootlist -om normal
  • 덤프 장치를 확인하려면 다음 명령을 실행합니다.
text
sysdumpdev -l
  • 부팅 가능한 PV 목록을 확인하려면 다음 명령을 실행합니다.
text
ipl_varyon -i
  • /dev/ipldevice(원문은 /dev/ipl_device)를 확인하려면 다음 명령을 실행합니다.
text
ls -i /dev/rhdisk1 /dev/ipldevice

ls 명령 출력의 두 항목이 같은 i-node 번호를 가지는지 확인합니다.

이 단계로 절차가 끝납니다.

관련 정보

  • AIX Logical Volume Manager from A to Z: Introduction and Concepts, AIX Storage Management

물리 볼륨이 빠졌을 때 관리자에게 알리기

AIX는 물리 볼륨에 접근할 수 없게 되면 오류를 기록하지만, 오류가 감지되지 않고 지나가는 경우가 있습니다.

예를 들어 물리 볼륨이 미러 볼륨 그룹에 속하면 좋은 데이터 사본에 계속 접근할 수 있으므로 사용자는 문제를 알아채지 못합니다. 이런 경우 자동 알림으로 사용자가 작업 중단을 느끼기 전에 관리자에게 문제를 알릴 수 있습니다.

다음 절차는 물리 볼륨이 빠졌다고 선언될 때 자동 알림을 설정하는 방법입니다. 이 절차를 고쳐 중요한 다른 오류도 추적할 수 있습니다.

이 시나리오의 정보는 특정 AIX 버전으로 시험했습니다. AIX 버전과 수준에 따라 결과가 크게 다를 수 있습니다.

  1. root 권한으로 /etc/objrepos/errnotify ODM 파일의 백업 사본을 만듭니다. 백업 사본 이름은 마음대로 정할 수 있습니다. 다음 예에서는 errnotify 파일 이름 뒤에 현재 날짜를 붙입니다.
text
cd /etc/objrepos
cp errnotify errnotify current_date
  1. 편집기로 다음 스탠자가 든 /tmp/pvmiss.add 파일을 만듭니다.
text
errnotify:
 en_pid = 0
 en_name = "LVM_SA_PVMISS"
 en_persistenceflg = 1
 en_label = "LVM_SA_PVMISS"
 en_crcid = 0
 en_type = "UNKN"
 en_alertflg = ""
 en_resource = "LVDD"
 en_rtype = "NONE"
 en_rclass = "NONE"
 en_method = "/usr/lib/ras/pvmiss.notify $1 $2 $3 $4 $5 $6 $7 $8 $9"

이 항목의 모든 단계를 마치면 오류 알림 데몬이 이 스크립트의 $1부터 $9까지를 알림 메시지 안에서 오류 로그 항목의 자세한 정보로 자동으로 펼칩니다. 3. 편집기로 다음 내용의 /usr/lib/ras/pvmiss.notify 파일을 만듭니다.

text
#!/bin/ksh
exec 3>/dev/console
print -u3 "?"
print -u3 - "----------------------------------------------"
print -u3 "ALERT!  ALERT!  ALERT!  ALERT!  ALERT!  ALERT!"
print -u3 ""
print -u3 "Desc: PHYSICAL VOLUME IS MISSING. SEE ERRPT."
print -u3 ""
print -u3 "Error label: $9"
print -u3 "Sequence number: $1"
print -u3 "Error ID: $2"
print -u3 "Error class: $3"
print -u3 "Error type: $4"
print -u3 "Resource name: $6"
print -u3 "Resource type: $7"
print -u3 "Resource class: $8"
print -u3 - "----------------------------------------------"
print -u3 "?"
mail - "PHSYICAL VOLUME DECLARED MISSING" root <<-EOF
----------------------------------------------
ALERT!  ALERT!  ALERT!  ALERT!  ALERT!  ALERT!
Desc: PHYSICAL VOLUME IS MISSING. SEE ERRPT.
Error label: $9
Sequence number: $1
Error ID: $2
Error class: $3
Error type: $4
Resource name: $6
Resource type: $7
Resource class: $8
----------------------------------------------
EOF
  1. 파일을 저장하고 편집기를 끝냅니다.
  2. 만든 파일에 알맞은 권한을 설정합니다. 예:
text
chmod 755 /usr/lib/ras/pvmiss.notify
  1. 다음 명령을 입력해 2단계에서 만든 LVM_SA_PVMISS 정의를 ODM에 더합니다.
text
odmadd /tmp/pvmiss.add

이제 LVM_SA_PVMISS 오류가 날 때마다 시스템이 /usr/lib/ras/pvmiss.notify 스크립트를 실행합니다. 이 스크립트는 콘솔에 메시지를 보내고 root 사용자에게 메일도 보냅니다.

관련 개념

  • 논리 볼륨 저장소

관련 정보

  • odmadd 명령

볼륨 그룹에서 미러 디스크 떼어 내기

스냅숏 지원은 디스크 고장 가능성에서 미러 볼륨 그룹의 일관성을 지키는 데 도움이 됩니다.

스냅숏 기능으로 미러 디스크 하나 이상을 떼어 내 (LVM 메타데이터 관점에서) 믿을 만한 볼륨 그룹 시점 백업으로 쓰고, 필요하면 떼어 낸 디스크를 볼륨 그룹에 다시 믿을 만하게 합칠 수 있습니다. 다음 절차에서는 먼저 볼륨 그룹에서 미러 디스크를 떼어 낸 뒤 원래 볼륨 그룹에 다시 합칩니다. 스냅숏의 신뢰성을 더 보장하려면 파일 시스템을 마운트 해제하고, 원시 논리 볼륨을 쓰는 응용 프로그램은 알려진 상태(백업을 써야 할 때 응용 프로그램이 복구할 수 있는 상태)에 있어야 합니다.

다음 가운데 하나라도 해당하면 볼륨 그룹을 나눌 수 없습니다.

  • 이미 빠진 디스크가 있습니다.
  • 마지막 stale 아닌 파티션이 떼어 낼 볼륨 그룹에 있게 됩니다.
  • 볼륨 그룹에 stale 파티션이 있습니다. 단, splitvg 명령에 강제 플래그(-f)를 쓰면 예외입니다.

또 스냅숏 기능(특히 splitvg 명령)은 향상된 동시 모드나 전통적 동시 모드에서 쓸 수 없습니다. 떼어 낸 볼륨 그룹은 동시나 향상된 동시로 만들 수 없으며, 떼어 낸 볼륨 그룹과 원래 볼륨 그룹 모두 허용되는 변경에 제한이 있습니다. 자세한 내용은 chvg 명령 설명을 봅니다.

이 시나리오의 정보는 특정 AIX 버전으로 시험했습니다. AIX 버전과 수준에 따라 결과가 크게 다를 수 있습니다.

  1. 볼륨 그룹이 완전히 미러링돼 있고, 미러가 이 미러 묶음만 든 디스크나 디스크 묶음에 있는지 확인합니다.
  2. 스냅숏 지원을 켜려면 다음 명령으로 원래 볼륨 그룹(origVG)을 다른 디스크나 디스크 묶음으로 떼어 냅니다.
text
splitvg origVG

이제 원래 볼륨 그룹의 믿을 만한 시점 백업이 생겼습니다. 그러나 떼어 낸 볼륨 그룹의 할당은 바꿀 수 없습니다. 3. 다음 명령으로 떼어 낸 디스크를 다시 활성화해 원래 볼륨 그룹에 합칩니다.

text
joinvg origVG

이제 떼어 낸 볼륨 그룹이 원래 볼륨 그룹에 다시 합쳐졌습니다.

관련 개념

  • 논리 볼륨 저장소

관련 정보

  • chvg, joinvg, recreatevg, splitvg 명령, AIX Logical Volume Manager, from A to Z, AIX Storage Management
영어 원문

Configuring a disk

You can configure a new disk by various methods.

You can configure a new disk in any of the following ways.

  • If you can shut down and power off the system, use Method 1. Whenever possible, it is always preferable to shut down and power off any system when you are attaching a physical disk to it.

  • If you cannot shut down your system and you know details about the new disk, such as the subclass, type, parent name, and where it is connected, use Method 2.

  • If you cannot shut down your system and you only know the location of the disk, use Method 3.

After a disk is configured, although it is generally available for use, the Logical Volume Manager requires that it is further identified as a physical volume.

Method 1

Use the following method when you can shut down and power off the system before attaching the disk:

  1. Physically connect the new disk to the system and then power on the disk and system according to the documentation that came with your system.

  2. During system boot, let the Configuration Manager (cfgmgr) automatically configure the disk.

  3. After system boot, with root authority, type the lspv command at the command line to look for the new disk's name. The system returns an entry similar to one of the following:

text
hdisk1  none                     none

or:

text
hdisk1  00005264d21adb2e         none

The first field identifies the system-assigned name of the disk. The second field displays the physical volume ID (PVID), if any. If the new disk does not appear in the lspv output, refer to the Installation and migration.

At this point, the disk is usable by the system but it needs a PVID for use by the LVM. If the new disk does not have a PVID, then see Making an available disk a physical volume.

Method 2

Use the following method when you cannot shut down your system and you know the following information about the new disk:

  • How the disk is attached (subclass)

  • The type of the disk (type)

  • Which system attachment the disk is connected to (parent name)

  • The logical address of the disk (where connected).

Do the following:

  1. Physically connect the new disk to the system and then power on the disk and system according to the documentation that came with your system.

  2. To configure the disk and ensure that it is available as a physical volume, use the mkdev command with the flags shown, as in the following example:

text
mkdev -c disk -s scsi -t 2200mb -p scsi3 \
-w 6,0 -a pv=yes

This example adds a 2.2 GB disk with a SCSI ID of 6 and logical unit number of 0 to the scsi3 SCSI bus. The -c flag defines the class of the device. The -s flag defines the subclass. The -t flag defines the type of device. The -p flag defines the parent device name that you want to assign. The -w flag designates the disk's location by SCSI ID and logical unit number. The -a flag specifies the device attribute-value pair, pv=yes, which makes the disk a physical volume and writes a boot record with a unique physical volume identifier onto the disk (if it does not already have one).

At this point, the disk is defined both as an available device and as a physical volume. You can type the lspv command on the command line to list the new disk entry. If the new disk does not appear in the lspv output, refer to the Installation and migration.

Method 3

Use the following method when you cannot shut down your system and you know only the location of the disk:

  1. Physically connect the new disk to the system and then power on the disk and system according to the documentation that came with your system.

  2. To check which physical disks are already configured on the system, type the lspv command on the command line. For more information about the lspv command, see the lspv command topic. The output looks similar to the following:

text
hdisk0       000005265ac63976    rootvg
  1. Type cfgmgr on the command line to enter the Configuration Manager. The Configuration Manager automatically detects and configures all newly connected devices on the system, including the new disk. For more information about the cfgmgr command, see cfgmgr.

  2. To confirm that the new disk was configured, type the lspv command again. The output looks similar to one of the following:

text
hdisk1    none                none

or

text
hdisk1   00005264d21adb2e     none

The first field identifies the system-assigned name of the disk. The second field displays the physical volume ID (PVID), if any. If the new disk does not appear in the lspv output, refer to the Installation and migration.

At this point, the disk is usable by the system but it needs a PVID for use by the LVM. If the new disk does not have a PVID, then see “Making an available disk a physical volume.”

Related tasks

Migrating the contents of a physical volume

Making an available disk a physical volume

A disk must be configured as a physical volume before it can be assigned to volume groups and used by the LVM.

Use the following instructions to configure a physical volume:

  1. Ensure the disk is known to the operating system, is available, and is not being used by the operating system or any applications. Type the lspv command on the command line. The output looks similar to the following:
text
hdisk1  none                     none

Check the output for the following:

  • If the new disk's name does not appear in command output, refer to Configuring a disk.

  • If the second field of the output shows a system-generated physical volume identifier (PVID) (for example, 00005264d21adb2e), the disk is already configured as a physical volume and you do not have to complete this procedure.

  • If the third field of the output shows a volume group name (for example, rootvg), the disk is currently being used and is not an appropriate choice for this procedure. If the new disk has no PVID and is not in use, continue with the next step.

  1. To change an available disk to a physical volume, type the chdev command on the command line. For example:
text
chdev -l hdisk3 -a pv=yes

The -l flag specifies the device name of the disk. The -a flag specifies the device attribute-value pair, pv=yes, which makes the disk a physical volume and writes a boot record with a unique physical volume identifier onto the disk (if it does not already have one).

At this point, the disk is defined as a physical volume. You can type the lspv command on the command line to list the new disk entry.

Changing the PVID and VGID of rootvg

You can change the physical volume identifier (PVID) and the volume group identifier (VGID) of the rootvg volume group during the system boot phase.

To change the PVID and VGID of the rootvg, set the sys0 dev ghostdev attribute with a value of 2 and reboot the system. The sys0 device ghostdev attribute is a bitwise flag.

  • To set the sys0 device ghostdev attribute to change PVID and VGID of rootvg volume group, enter the following command:
text
chdev -l sys0 -a ghostdev=2

Note: The value of 2 for the sys0 device ghostdev attribute is unset, after the ipl_varyon command changes the PVID and VGID of all disks in the rootvg. If the chdev command for changing the PVID of any rootvg disks fails, the ipl_varyon command sends a warning message and continues to vary on the rootvg. If the chdev command for changing the PVID of any disk in rootvg fails, and you want to change the PVID and VGID during the next reboot, set sys0 device ghostdev attribute to 2 again.

  • To list the value of the ghostdev attribute, enter the following command:
text
lsattr -E -l sys0 -a ghostdev

Replacing a failed physical volume in a mirrored volume group:

The following procedures replace a failed physical volume (PV) within a mirrored volume group. The replacepv command provides a method for replacing a failed PV in most configurations. An alternative procedure is also provided for configurations where the replacepv command cannot be used.

The information in this how-to scenario was tested using specific versions of AIX. The results you obtain might vary significantly depending on your version and level of AIX.

Prerequisites

  • All logical volumes using the failed PV have valid copies on other available PVs (with the possible exception of a dedicated dump logical volume).

Replacing a failed PV using the replacepv command

Prerequisites

If any of the prerequisites listed below cannot be met, see the alternate procedure.

  • The volume group containing the failed PV is not rootvg.

  • The replacement PV can be added to the volume group containing the failed PV (this might not be possible depending on the PV size and volume group characteristics, such as MAX PPs per PV).

  • The replacement PV must be able to be configured into the system at the same time as the failing PV.

  • The replacement PV's name can differ from the failed PV's name.

  • The size of the replacement PV must be at least the size of the failed PV.

  • The volume group containing the failed PV must not be a snapshot volume group or have a snapshot volume group.

Complete the following steps, assuming that the failed PV is hdisk2 and the replacement PV is hdisk10:

  1. If the replacement PV is not yet installed on the system, perform the steps necessary to install it. To use the configuration manager to define a new PV, run the following command:
text
cfgmgr

Use the lspv command to determine the name assigned to the PV. For this example, assume that the new PV is named hdisk10.

  1. To replace the failed PV with the one defined in Step 1, run the following command:
text
replacepv hdisk2 hdisk10

When the command runs, hdisk2 is replaced by hdisk10, and hdisk2 is no longer assigned to a volume group.

  1. To undefine the failed PV, run the following command:
text
rmdev -dl hdisk2
  1. Physically remove the failed disk from the system.

  2. Verify that the procedure was successful by completing the following steps:

  • To check that all logical volumes are mirrored to the new PV as desired, run the following command:
text
lslv lvname

Check the COPIES attribute of each logical volume affected by the failed PV to ensure that the desired number of copies now exist. If the number of copies of the logical volume is below the desired number, use the mklvcopy command to create additional copies.

  • To verify that all logical volume partitions are synchronized and there are no stale partitions, run the following command:
text
lspv hdisk10

Check the STALE PARTITIONS attribute of the replaced PV to ensure that the count is zero. If there are stale partitions use the syncvg command to synchronize the partitions.

Step 5 completes the replacement procedure for a failed PV.

Replacing a failed PV when the configuration does not allow the use of the replacepv command

Assume that the failed physical volume, hdisk0, and its mirror, hdisk1, are part of the yourvg volume group.

  1. To remove mirror copies from the failed PV, run the following command:
text
unmirrorvg yourvg hdisk0
  1. If the PV failure occurred on rootvg, remove hdisk0 from the boot list by running the following command:

Note: If your configuration uses boot devices other than hdisk0 and hdisk1, add them to the command syntax.

text
bootlist -om normal hdisk1

This step requires that hdisk1 remains a bootable device in rootvg. After completing this step, ensure that hdisk0 does not appear in output.

  1. If the PV failure occurred on rootvg, recreate any dedicated dump devices from the failed PV. If you have a dedicated dump device that was on the failed PV, you can use the mklv command to create a new logical volume on an existing PV. Use the sysdumpdev command to set the new logical volume as the primary dump device.

  2. To undefine the failed PV, run the following command:

Note: Removing the disk device entry will also remove the /dev/ipldevice hard link if the failed PV is the PV used to boot the system.

text
reducevg yourvg hdisk0
rmdev -dl hdisk0
  1. If the failed PV is the most recently used boot device, recreate the /dev/ipldevice hard link that was removed in Step 4 by running the following command:
text
ln /dev/rhdisk1 /dev/ipldevice

Note the r prefixed to the PV name. To verify that your /dev/ipldevice hard link has been recreated, run the following command:

text
ls /dev/ipldevice
  1. Replace the failed disk.

  2. To define the new PV, run the following command:

text
cfgmgr

The cfgmgr command assigns a PV name to the replacement PV. The assigned PV name is likely to be the same as the PV name previously assigned to the failed PV. In this example, assume that the device hdisk0 is assigned to the replacement PV.

  1. To add the new PV to the volume group, run the following command:
text
extendvg yourvg hdisk0

You might encounter the following error message:

text
0516-050 Not enough descriptor space left in this volume group.
Either try adding a smaller PV or use another volume group.

If you encounter this error and cannot add the PV to the volume group, you can try to mirror logical volumes to another PV that already exists in the volume group or add a smaller PV. If neither option is possible, you can try to bypass this limitation by upgrading the volume group to a Big-type or Scalable-type volume group using the chvg command.

  1. Mirror the volume group.

Note: The mirrorvg command cannot be used if all of the following conditions exist:

  • The target system is a logical partition (LPAR).

  • A copy of the boot logical volume (by default, hd5) resides on the failed PV.

  • The replacement PV's adapter was dynamically configured into the LPAR since the last cold boot.

If all of the above conditions exist, use the mklvcopy command to recreate mirror copies for each logical volume as follows: a. Create copies of the boot logical volume to ensure that it is allocated to a contiguous series of physical partitions. b. Create copies of the remaining logical volumes, and synchronize the copies using the syncvg command. c. Make the disk bootable by shutting down the LPAR and activating it instead of rebooting using the shutdown or reboot commands. This shutdown does not have to be done immediately, but it is necessary for the system to boot from the new PV. Otherwise, create new copies of logical volumes in the volume group using the new PV with the following command:

Note: The mirrorvg command disables quorum by default. For rootvg, you will want to use the -m option to ensure that the new logical volume copies are mapped to hdisk0 in the same way as the working disk.

text
mirrorvg yourvg hdisk0
  1. If your configuration holds copies of some logical volumes, you might need to recreate those copies with the following command:
text
mklvcopy -k
  1. If the PV failure occurred on rootvg, initialize the boot record by running the following command:
text
bosboot -a
  1. If the PV failure occurred on rootvg, update the boot list by running the following command:

Note: If your configuration uses boot devices other than hdisk0 and hdisk1, add them to the command.

text
bootlist -om normal hdisk0 hdisk1
  1. Verify that the procedure was successful.
  • To verify that all logical volumes are mirrored to the new PV, run the following command:
text
lslv lvname

Check the COPIES attribute of each logical volume affected by the failed PV to ensure that the desired number of copies now exist. If the number of copies of the logical volume is below the desired number, use the mklvcopy command to create additional copies.

  • To verify that all the logical volume partitions are synchronized, check that there are no stale partitions by running the following command:
text
lspv hdisk0

Check the STALE PARTITIONS attribute of the replaced PV to ensure that the count is zero. If there are stale partitions use the syncvg command to synchronize the partitions.

If the PV failure occurred on rootvg, use the following steps to verify other aspects of this procedure:

  • To verify the boot list, run the following command:
text
bootlist -om normal
  • To verify the dump device, run the following command:
text
sysdumpdev -l
  • To verify the list of bootable PVs, run the following command:
text
ipl_varyon -i
  • To verify the /dev/ipl_device, run the following command:
text
ls -i /dev/rhdisk1 /dev/ipldevice

Ensure the output of the ls command has the same i-node number for both entries.

This step completes the procedure.

Related information

AIX Logical Volume Manager from A to Z: Introduction and Concepts AIX Storage Management

Notifying the administrator when a physical volume is missing:

Although AIX logs an error when a physical volume becomes inaccessible, there are circumstances in which an error can go undetected.

For example, when the physical volume is part of a mirrored volume group, users do not notice a problem because a good copy of the data remains accessible. In such cases, automatic notification can alert the administrator to the problem before the users notice any disruption to their work.

The following procedure describes how to set up automatic notification when a physical volume is declared missing. By modifying the following procedure, you can track other errors that are significant to you.

The information in this how-to scenario was tested using specific versions of AIX. The results you obtain might vary significantly depending on your version and level of AIX.

  1. With root authority, make a backup copy of the /etc/objrepos/errnotify ODM file. You can name the backup copy anything that you choose. In the following example, the backup copy appends the errnotify file name with the current date:
text
cd /etc/objrepos
cp errnotify errnotify current_date
  1. Use your favorite editor to create a file named /tmp/pvmiss.add that contains the following stanza:
text
errnotify:
 en_pid = 0
 en_name = "LVM_SA_PVMISS"
 en_persistenceflg = 1
 en_label = "LVM_SA_PVMISS"
 en_crcid = 0
 en_type = "UNKN"
 en_alertflg = ""
 en_resource = "LVDD"
 en_rtype = "NONE"
 en_rclass = "NONE"
 en_method = "/usr/lib/ras/pvmiss.notify $1 $2 $3 $4 $5 $6 $7 $8 $9"

After you complete all the steps in this topic, the error notification daemon will automatically expand the $1 through $9 in this script with detailed information from the error log entry within the notification message.

  1. Use your favorite editor to create a file named /usr/lib/ras/pvmiss.notify with the following contents:

(32줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

  1. Save your file and exit the editor.

  2. Set the appropriate permissions on the file that you created. For example:

text
chmod 755 /usr/lib/ras/pvmiss.notify
  1. Type the following command to add the LVM_SA_PVMISS definition that you created in step 2 to the ODM:
text
odmadd /tmp/pvmiss.add

Now, the system runs the /usr/lib/ras/pvmiss.notify script whenever an LVM_SA_PVMISS error occurs. This script sends a message to the console and also sends mail to the root user.

Related concepts

Logical volume storage Logical volumes are groups of information located on physical volumes.

Related information

odmadd command

Splitting a mirrored disk from a volume group

Snapshot support helps you protect the consistency of your mirrored volume groups from potential disk failure.

Using the snapshot feature, you can split off a mirrored disk or disks to use as a reliable (from the standpoint of the LVM metadata) point-in-time backup of a volume group, and, when needed, reliably reintegrate the split disks into the volume group. In the following procedure, you first split off a mirrored disk from a volume group and then you merge the split-off disk into the original volume group. To further ensure the reliability of your snapshot, file systems must be unmounted and applications that use raw logical volumes must be in a known state (a state from which the application can recover if you need to use the backup).

A volume group cannot be split if any one of the following is true:

  • A disk is already missing.

  • The last non-stale partition would be on the split-off volume group.

  • Any stale partitions exist in the volume group, unless you use the force flag (-f) with the splitvg command.

Furthermore, the snapshot feature (specifically, the splitvg command) cannot be used in enhanced or classic concurrent mode. The split-off volume group cannot be made concurrent or enhanced concurrent and there are limitations to the changes allowed for both the split-off and the original volume group. For details, read the chvg command description.

The information in this how-to scenario was tested using specific versions of AIX. The results you obtain might vary significantly depending on your version and level of AIX.

  1. Ensure that the volume group is fully mirrored and that the mirror exists on a disk or set of disks that contains only this set of mirrors.

  2. To enable snapshot support, split off the original volume group (origVG) to another disk or set of disks, using the following command:

text
splitvg origVG

At this point, you now have a reliable point-in-time backup of the original volume group. Be aware, however, that you cannot change the allocation on the split-off volume group.

  1. Reactivate the split-off disk and merge it into the original volume group using the following command:
text
joinvg origVG

At this point, the split-off volume group is now reintegrated with the original volume group.

Related concepts

Logical volume storage Logical volumes are groups of information located on physical volumes.

Related information

chvg command joinvg command recreatevg command splitvg command

AIX Logical Volume Manager, from A to Z: Introduction and Concepts

AIX Storage Management