importvg 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-importvg
핵심 정리
- 디스크에 있는 볼륨 그룹 정의를 읽어 시스템에 등록합니다:
importvg -y datavg hdisk3. 디스크 하나만 주면 같은 볼륨 그룹의 나머지 디스크는 알아서 찾습니다. - 가져온 뒤 자동으로 varyon하며(
-n이면 하지 않음), 파일 시스템 항목을/etc/filesystems에 넣습니다. 마운트하기 전에fsck를 실행합니다. - 같은 이름의 LV가 이미 있으면 이름을 바꾸고 표준 오류로 알립니다. 로그 LV 이름이 바뀌면 그 로그를 쓰는 파일 시스템을 직접 고쳐야 합니다.
- PowerHA 같은 공유 디스크 환경에서는
-L로 다른 노드가 바꾼 내용만 배우고, 클러스터 볼륨 그룹은 주 번호를-V로 모든 노드에서 같게 맞춥니다. - 디스크를 옮긴 뒤
cfgmgr로 인식시키고,lspv에서 PVID로 디스크를 찾습니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 -O와 RBAC 안내가 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 3, 6.1 Volume 3 |
| 파일 | /usr/sbin/importvg |
| 관련 명령어 | exportvg, varyonvg, lspv, fsck, redefinevg |
목적
물리 볼륨 묶음에서 새 볼륨 그룹 정의를 가져옵니다.
영어 원문
Imports a new volume group definition from a set of physical volumes.
구문
importvg [ -V MajorNumber ] [ -y VolumeGroup ] [ -f ] [ -c ] [ -x ] | [ -L VolumeGroup ] [ -n ] [ -F ] [ -R ] [ -I ] [ -O ] PhysicalVolume
설명
importvg 명령은 이전에 내보낸 볼륨 그룹을 시스템에 알립니다. PhysicalVolume 매개변수로는 볼륨 그룹을 식별할 물리 볼륨 하나만 주며, 같은 볼륨 그룹의 나머지 물리 볼륨은 importvg가 찾아 함께 가져옵니다. 가져온 볼륨 그룹은 Concurrent Capable이 아니면 자동으로 varyon합니다. Concurrent Capable 볼륨 그룹은 접근하기 전에 varyonvg로 활성화해야 합니다.
파일 시스템이 있는 볼륨 그룹을 가져오면 새 논리 볼륨과 마운트 지점 값으로 /etc/filesystems를 갱신합니다. 가져와서 varyonvg로 활성화한 뒤에는 파일 시스템을 마운트하기 전에 fsck를 실행해야 합니다. 다만 마운트 지점이 128자보다 길면 LVCB(논리 볼륨 제어 블록)에 정보가 없어 /etc/filesystems에 스탠자를 넣지 못합니다. 이때는 직접 스탠자를 더합니다.
시스템에 같은 이름의 논리 볼륨이 있으면 이름을 바꿉니다. 메시지와 새 이름을 표준 오류로 보여 주고 /etc/filesystems도 새 이름으로 고칩니다. 파일 시스템 로그 LV의 이름을 바꾸면, 그 로그 장치를 쓰는 파일 시스템이 바뀐 장치를 알도록 직접 고쳐야 합니다.
참고:
- root 권한이 있거나 system 그룹 구성원이어야 합니다.
- 가져온 뒤 볼륨 그룹은 자동으로 varyon됩니다. Concurrent Capable이면 직접
varyonvg하라고 알립니다. - 미러된 스트라이프 논리 볼륨이 있는 볼륨 그룹은 AIX 4.3.3보다 오래된 버전으로 가져갈 수 없습니다.
Web-based System Manager(wsm)의 Volumes 응용 프로그램이나 SMIT 빠른 경로 smit importvg로도 실행할 수 있습니다.
영어 원문
The importvg command makes the previously exported volume group known to the system. The PhysicalVolume parameter specifies only one physical volume to identify the volume group; any remaining physical volumes (those belonging to the same volume group) are found by the importvg command and included in the import. An imported volume group is automatically varied unless the volume group is Concurrent Capable. You must use the varyonvg command to activate Concurrent Capable volume groups before you access them.
When a volume group with file systems is imported, the /etc/filesystems file is updated with values for the new logical volumes and mount points. After importing the volume group and activating it with the varyonvg command, you must run the fsck command before the file systems can be mounted. However, the mount point information would be missing from the LVCB (logical volume control block) if it is longer than 128 characters. In this case, the importvg command will not be able to update the /etc/filesystems file with the stanza for the newly imported logical volume. You should manually edit the /etc/filesystems file to add a new stanza for this logical volume.
The importvg command changes the name of a logical volume if the name already exists in the system. It prints a message and the new name to standard error, and updates the /etc/filesystems file to include the new logical volume name. If the importvg command renames any filesystem log logical volumes, you must manually update any file systems using that log device to know about the renamed device.
Notes:
To use this command, you must either have root user authority or be a member of the system group.
As part of the importvg process, the volume group is automatically varied on by the system after it is imported. However, if the volume group is Concurrent Capable then the importvg command prompts you to varyonvg the imported volume group manually.
A volume group with a mirrored striped logical volume cannot be back ported into a version older than AIX 4.3.3.
You can use the Volumes application in Web-based System Manager (wsm) to change volume characteristics. You could also use the System Management Interface Tool (SMIT) smit importvg fast path to run this command.
플래그
| 플래그 | 설명 |
|---|---|
-c |
무시합니다. Enhanced Concurrent Capable 볼륨 그룹만 만들어집니다. |
-f |
볼륨 그룹을 강제로 varyon합니다. |
-L VolumeGroup |
볼륨 그룹에 생긴 변경을 배웁니다. 이 명령으로 새로 생기는 논리 볼륨은 -y의 볼륨 그룹 /dev 특수 파일의 소유자, 그룹, 권한을 따릅니다. 실행 중에는 -F, -n과 같은 일을 합니다. 제한: 이 명령을 실행하는 시스템에서 볼륨 그룹이 활성이면 안 됩니다. 볼륨 그룹을 켜 두고 쓰는 모든 시스템에서 디스크 잠금이 풀려 있어야 합니다(varyonvg -b -u로 풀고 계속 쓸 수 있음). 주는 물리 볼륨은 정상이고 상태를 아는 디스크여야 하며 missing·removed 상태면 안 됩니다. LV 이름이 겹치면 실패하며, 기본 importvg와 달리 이름을 바꾸지 않습니다. |
-F |
같은 볼륨 그룹의 디스크만 VGDA를 확인하는 빠른 importvg입니다. 볼륨 그룹의 모든 물리 볼륨이 정상이고 상태를 아는 상태여야 하며, missing·removed 디스크가 있으면 실패하거나 결과가 맞지 않을 수 있습니다. |
-I |
imfs가 실패하면 importvg도 실패하게 합니다. |
-n |
가져온 뒤 볼륨 그룹을 varyon하지 않습니다. |
-O |
(6.1) 다른 노드에서 varyon되어 있어도 강제로 varyon합니다. AIX 6.1 TL8부터 varyonvg는 활성화 상태를 LVM 메타데이터와 ODM에 기록하고 다른 노드에서 이미 켜져 있으면 실패합니다. varyoffvg가 이 상태를 지우는데, varyoff 전에 시스템이 멈췄거나 강제로 꺼졌으면 재부팅 뒤 varyonvg가 실패하므로 -O로 강제합니다. |
-R |
논리 볼륨 특수 장치 파일의 소유자, 그룹 ID, 권한을 복원합니다. mklv·chlv의 U, G, P 플래그로 정한 값만 복원하며, big·scalable 볼륨 그룹에만 씁니다. |
-V MajorNumber |
가져올 볼륨 그룹의 주 번호. |
-x |
무시합니다. Enhanced Concurrent Capable 볼륨 그룹만 만들어집니다. |
-y VolumeGroup |
새 볼륨 그룹에 쓸 이름. 주지 않으면 자동으로 정합니다. AZ, az, 0~9, 밑줄(_), 빼기(-), 마침표(.)만 쓸 수 있습니다. |
영어 원문
-c— This flag is ignored. Only Enhanced Concurrent Capable volume groups will be created.-f— Forces the volume group to be varied online.-LVolumeGroup — Takes a volume group and learns about possible changes performed to that volume group. Any new logical volumes created as a result of this command emulate the ownership, group identification, and permissions of the /dev special file for the volume group listed in the-yflag. The-Lflag performs the functional equivalent of the-Fand-nflags during execution. Restrictions: • The volume group must not be in an active state on the system executing the-Lflag. • The volume group's disks must be unlocked on all systems that have the volume group varied on and operational. Volume groups and their disks may be unlocked, remain active and used via the varyonvg -b -u command. • The physical volume name provided must be of a good and known state, the disk named may not be in the missing or removed state. • If a logical volume name clash is detected, the command will fail. Unlike the basic importvg actions, clashing logical volume names will not be renamed.-F— Provides a fast version of importvg that checks the Volume Group Descriptor Areas of only the disks that are members of the same volume group. As a result, if a user exercises this flag, they must ensure that all physical volumes in the volume group are in a good and known state. If this flag is used on a volume group where a disk may be in missing or removed state, the command may fail or the results may be inconsistent.-I— Causes the importvg command to fail if imfs fails.-n— Causes the volume not to be varied at the completion of the volume group import into the system.-O— Forces varyon the volume group even if it is varied on in some other node. Note: In AIX 61 TL8 and later releases, varyonvg command updates the LVM metadata and ODM with varyon state of the volume group. During varyon time, varyonvg command reads this data and fails if the volume group is already varied in another node. Varyoffvg command resets the varyon state of the volume group during varyoff time. If system crashes before varying off the volume group or the volume group is forced off, then varyonvg command will fail after reboot. In this scenario, use –O flag to force varyon the volume group.-R— Restores the ownership, group ID, and permissions of the logical volume special device files. These values will be restored only if they were set using U, G and P flags of mklv and chlv commands. This flag is applicable only for volume groups of the types big and scalable.-VMajorNumber — Specifies the major number of the imported volume group.-x— This flag is ignored. Only Enhanced Concurrent Capable volume groups will be created.- Attention: This entry must be added after the entry used to initiate srcmstr.
-yVolumeGroup — Specifies the name to use for the new volume group. If this flag is not used, the system automatically generates a new name. The volume group name can only contain the following characters: "A" through "Z," "a" through "z," "0" through "9," or "_" (the underscore), "-" (the minus sign), or "." (the period). All other characters are considered invalid.
보안
(6.1) RBAC와 Trusted AIX 사용자: 이 명령은 특권 작업을 할 수 있으며 특권 사용자만 할 수 있습니다. 권한과 특권은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다.
영어 원문
Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.
예제
hdisk7에서 볼륨 그룹bkvg를 가져옵니다.bkvg가 시스템에 알려집니다.
importvg -y bkvg hdisk7
- 여러 노드가 연결된(multi-tailed) 시스템에서
-L을 씁니다. 노드 A는datavg를 켜 두었고, 노드 B는datavg를 알지만 켜지 않았습니다.
# 노드 A
varyonvg -b -u datavg
# 노드 B
importvg -L datavg hdisk7
# 노드 A
varyonvg datavg
자주 쓰는 형태:
cfgmgr
lspv # PVID로 옮겨 온 디스크 확인
importvg -y datavg -V 60 hdisk3 # 주 번호 지정
fsck -y /dev/datalv; mount /data
영어 원문
- To import the volume group
bkvgfrom physical volumehdisk7, enter:
importvg -y bkvg hdisk7 The volume group bkvg is made known to the system.
- To use the -L on a multi-tailed system:
Node A has the volume group datavg varied on. Node B is aware of datavg, but it is not varied on. Node A: varyonvg -b -u datavg Node B: importvg -L datavg hdisk7 Node A: varyonvg datavg
파일
| 파일 | 설명 |
|---|---|
/usr/sbin |
importvg 명령이 있는 디렉터리 |
/tmp |
명령이 실행되는 동안 임시 파일을 두는 디렉터리 |
영어 원문
- /usr/sbin — Directory where the importvg command resides.
- /tmp — Directory where the temporary files are stored while the command is running.
Related information:
- exportvg command
- varyonvg command
- Logical volume storage
- PowerHA SystemMirror Administration Guide
리눅스(GNU)와 다른 점
리눅스 LVM2도 물리 볼륨(PV), 볼륨 그룹(VG), 논리 볼륨(LV) 구조가 같지만 명령 이름이 다릅니다. AIX lspv·lsvg·lslv는 pvs/pvdisplay, vgs/vgdisplay, lvs/lvdisplay에, mkvg·extendvg·reducevg는 vgcreate·vgextend·vgreduce에, mklv·extendlv·rmlv는 lvcreate·lvextend·lvremove에, varyonvg·varyoffvg는 vgchange -ay/-an에, importvg·exportvg는 vgimport·vgexport에, migratepv는 pvmove에 해당합니다. AIX의 물리 파티션(PP)은 리눅스의 물리 익스텐트(PE)이고, 미러는 lvcreate --type raid1이나 lvconvert -m1로 만듭니다. 리눅스는 디스크마다 PVID 대신 PV UUID를 쓰며, 파일 시스템은 따로 mkfs로 만듭니다. importvg에 해당하는 것은 vgimport datavg 뒤 vgchange -ay datavg이고, 같은 이름의 VG가 있으면 vgimportclone으로 이름을 바꿔 가져옵니다. /etc/fstab 항목은 직접 넣어야 합니다.