restvg 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-restvg
핵심 정리
savevg백업으로 사용자 볼륨 그룹을 다시 만들고 LV, 파일 시스템, 파일을 모두 되살립니다:restvg -f /backup/datavg.savevg hdisk4 hdisk5.- 디스크를 주지 않으면 백업의
vgname.data에 적힌 디스크를 씁니다. 대상 디스크는 PVID가 있고 볼륨 그룹에 속하지 않아야 합니다. - 복원 전에
restvg -l -f 백업으로 백업 정보(볼륨 그룹, 날짜, oslevel, 크기, LV 목록)를 확인합니다. -r은 파일 없이 볼륨 그룹·LV·파일 시스템 구조만 만듭니다. 데이터는 다른 백업 소프트웨어로 복원할 때 씁니다.-s는 LV를 최소 크기로 만듭니다.- rootvg는 복원할 수 없습니다(rootvg는 mksysb로 다시 설치). 개별 파일은
restore -xvqf나restorevgfiles로 꺼냅니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (내용이 같고, 6.1 문서에 listvgbackup·restorevgfiles 안내가 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 4, 6.1 Volume 4 |
| 파일 | /usr/bin/restvg, /tmp/vgdata/vgname/vgname.data |
| 관련 명령어 | savevg, mkvgdata, restore, listvgbackup, restorevgfiles, reducevg |
목적
사용자 볼륨 그룹과 그 안의 모든 컨테이너와 파일을 복원합니다.
영어 원문
Restores the user volume group and all its containers and files.
구문
restvg [ -b Blocks ] [ -d FileName ] [ -f Device ] [ -l ] [ -q ] [ -r ] [ -s ] [ -n ] [ -P PPsize ] [ DiskName ... ]
설명
restvg 명령은 savevg가 만든 백업 이미지에 든 /tmp/vgdata/vgname/vgname.data 파일(vgname은 볼륨 그룹 이름)에 적힌 대로 사용자 볼륨 그룹과 그 안의 모든 컨테이너와 파일을 복원합니다.
restvg는 사용자 볼륨 그룹을 복원합니다. 루트 볼륨 그룹(rootvg)은 bosinstall 루틴이 다시 설치합니다. 백업 이미지에 rootvg가 있으면 오류로 끝냅니다.
vgname.data의 logical_volume_policy 스탠자에서 EXACT_FIT 필드가 yes이면 맵 파일로 각 논리 볼륨의 물리 파티션 배치를 그대로 지킵니다. 대상 디스크는 vgname.data의 source_disk_data 스탠자에 적힌 원본 디스크 이상의 크기여야 합니다.
참고:
- 백업 이미지의 파일을 보거나 개별 파일을 복원하려면
restore명령의-T나-x플래그를 씁니다. - 볼륨 그룹에
varyonvg를 실행하면 LTG(논리 트랙 그룹) 크기는 디스크들의 공통 최대 전송 크기로 정해집니다.
영어 원문
The restvg command restores the user volume group and all its containers and files, as specified in the /tmp/vgdata/vgname/vgname.data file (where vgname is the name of the volume group) contained within the backup image created by the savevg command.
The restvg command restores a user volume group. The bosinstall routine reinstalls the root volume group (rootvg). If the restvg command encounters a rootvg volume group in the backup image, the restvg command exits with an error.
If a yes value has been specified in the EXACT_FIT field of the logical_volume_policy stanza of the /tmp/vgdata/vgname/vgname.data file, the restvg command uses the map files to preserve the placement of the physical partitions for each logical volume. The target disks must be of the same size or larger then the source disks specified in the source_disk_data stanzas of the vgname.data file.
Note:
To view the files in the backup image or to restore individual files from the backup image, the user must use the restore command with the
-Tor-xflag, respectively. (Refer to the restore command for more information.)When you run the varyonvg command on the volume group, the logical track group (LTG) size will be set to the common max transfer size of the disks.
플래그
| 플래그 | 설명 |
|---|---|
-b Blocks |
한 번에 읽을 512바이트 블록 수. 없으면 restore가 기본 100을 씁니다. 크면 테이프 장치로의 물리 전송이 커집니다. |
| DiskName... | vgname.data에 적힌 디스크 대신 쓸 디스크 장치. 빈 물리 볼륨, 곧 PVID가 있고 볼륨 그룹에 속하지 않아야 합니다. 새 디스크면 mkdev로 시스템에 더하고, 볼륨 그룹에 속해 있으면 reducevg로 빼야 합니다. |
-d FileName |
복원하는 백업 이미지 안의 것 대신 쓸 vgname.data 파일. 상대·절대 경로 모두 됩니다. |
-f Device |
백업 매체의 장치 이름. 기본 /dev/rmt0. |
-l |
볼륨 그룹 백업의 유용한 정보를 보여 줍니다. -f가 필요합니다. 볼륨 그룹, 백업 날짜와 시각, 백업한 시스템의 uname 출력, oslevel, 권장 유지 보수·기술 수준, 백업 크기(MB), 축소 크기(MB)를 보여 줍니다. 축소 크기는 모든 파일 시스템의 데이터 크기이고, 전체 크기는 각 파일 시스템의 전체 크기(빈 공간 + 데이터)입니다. 백업한 볼륨 그룹의 LV와 파일 시스템 정보(lsvg -l vgname과 같음)도 보여 줍니다. |
-n |
기존 맵 파일을 무시합니다. vgname.data의 EXACT_FIT 값보다 우선합니다. |
-P PPsize |
물리 파티션 크기(MB). 없으면 복원할 가장 큰 디스크에 맞는 값을 씁니다. vgname.data의 값과 다르면 각 LV의 파티션 수를 새 크기에 맞게 바꿉니다. 디스크 크기에 비해 너무 작은 값을 주면 더 큰 값을 쓰고, 큰 값을 주면 그 값을 씁니다. |
-q |
복원 전에 볼륨 그룹 이름과 대상 디스크를 보여 주는 확인 질문을 하지 않습니다. |
-r |
볼륨 그룹 구조만 다시 만듭니다. 백업(FileName이나 Device)에서 볼륨 그룹, LV, 파일 시스템을 만들되 파일과 데이터는 복원하지 않습니다. 데이터는 다른 회사 소프트웨어로 복원하고 AIX LV 구조만 필요할 때 씁니다. 필요한 정보를 얻을 백업 이미지나 vgname.data가 있어야 하므로 -f나 -d와 함께 써야 합니다. |
-s |
LV를 파일 시스템을 담을 수 있는 최소 크기로 만듭니다. 크기는 vgname.data의 lv_data 스탠자 LV_MIN_LPS 값입니다. logical_volume_policy 스탠자의 SHRINK, EXACT_FIT 값보다 우선하며, SHRINK=yes, EXACT_FIT=no와 같은 효과입니다. |
영어 원문
-bBlocks — Specifies the number of 512-byte blocks to read in a single input operation. If this parameter is not specified the default of 100 is used by the restore command. Larger values result in larger physical transfers to tape devices.- DiskName... — Specifies the names of disk devices to be used instead of the disk devices listed in the vgname.data file. Target disk devices must be defined as empty physical volumes; that is, they must contain a physical volume identifier and must not belong to a volume group. If the target disk devices are new, they must be added to the system using the mkdev command. If the target disk devices belong to a volume group, they must be removed from the volume group using the reducevg command.
-dFileName — The -d flag is an optional flag, which, if specified, must be followed by a filename. This file will be used as the vgname.data file instead of the one contained within the backup image being restored. The filename can be specified by either a relative or an absolute pathname.-fDevice — Specifies the device name of the backup media. The default is /dev/rmt0.-l— Displays useful information about a volume group backup. This flag requires the-fdevice flag. This flag causes restvg to display information such as volume group, date and time backup was made, uname output from backed up system, oslevel, recommended maintenance and technology level, backup size in megabytes, and backup shrink size in megabytes. The shrink size is the size of the data on all filesystems. The full size is the total size of each filesystem (unused + data). The-lflag also displays the logical volume and filesystem information of the backed up volume group, equivalent to running "lsvg -l vgname".-n— Specifies that the existing MAP files are ignored. The-nflag overrides the value of theEXACT_FITfield in thelogical_volume_policystanza of the vgname.data file.-PPPsize — Specifies the number of megabytes in each physical partition. If not specified, restvg uses the best value for the PPsize, dependent upon the largest disk being restored to. If this is not the same as the size specified in the vgname.data file, the number of partitions in each logical volume will be appropriately altered with respect to the new PPsize. If a PPsize is specified that is smaller than appropriate for the disk sizes, the larger PPsize will be used. If a PPsize is specified that is larger than appropriate for the disk sizes, the specified larger PPsize will be used.-q— Specifies that the usual prompt not be displayed before the restoration of the volume group image. If this flag is not specified, the prompt displays the volume group name and the target disk-device names.-r— Recreates a volume groups structure only. This allows restvg to create (for the specified backup FileName or Device) the volume group, logical volumes, and filesystems, from the backup, without restoring any files or data. This is useful for users who use third party software for restoring data and just need all the AIX logical volume structure in place. Note: be used with either the-fDevice flag or the-dFileName flag. This is because restvg requires a backup image or vgname.data file to get all the information it needs to recreate the logical volume structure of the volume group desired.-s— Specifies that the logical volumes be created at the minimum size possible to accommodate the file systems. This size is specified by the value ofLV_MIN_LPSfield of thelv_datastanza of the vgname.data file (where vgname is the name of the volume group). The-sflag overrides the values of theSHRINKandEXACT_FITfields in thelogical_volume_policystanza of the vgname.data file. The-sflag causes the same effect as values ofSHRINK=yesandEXACT_FIT=nowould cause.
예제
| 명령 | 하는 일 |
|---|---|
restvg -f/dev/rmt1 hdisk2 hdisk3 |
/dev/rmt1의 볼륨 그룹 이미지를 hdisk2, hdisk3에 복원 |
restvg -f/mydata/myvg |
파일 /mydata/myvg의 이미지를 백업 안 vgname.data에 적힌 디스크에 복원 |
restvg -r -d /home/my_dir/my_vg.data |
my_vg.data만으로 파일 없이 볼륨 그룹 LV 구조를 다시 만듦(vgname.data는 mkvgdata로 만들 수 있음) |
restvg -r -f /dev/rmt0 |
/dev/rmt0 테이프 백업 안의 vgname.data로 파일 없이 구조만 다시 만듦 |
restvg -l -f /dev/rmt0 |
/dev/rmt0 테이프에 백업한 볼륨 그룹의 정보를 보여 줌 |
restvg -f /dev/usbms0 |
/dev/usbms0의 이미지를 백업 안 vgname.data에 적힌 디스크에 복원 |
(6.1) 볼륨 그룹 백업은 listvgbackup, 볼륨 그룹 백업에서 개별 파일 복원은 restorevgfiles 명령을 봅니다.
자주 쓰는 형태:
restvg -l -f /backup/datavg.savevg # 백업 정보
lspv | grep None # 빈 디스크
restvg -q -f /backup/datavg.savevg hdisk4
restore -xvqf /backup/datavg.savevg ./data/app/conf.xml # 파일 하나만
영어 원문
- To restore the volume group image from the /dev/rmt1 device, onto the hdisk2 and hdisk3 disks, enter:
restvg -f/dev/rmt1 hdisk2 hdisk3
- To restore the volume group image saved in /mydata/myvg file onto the disks specified in the vgname.data file contained within the backup image, enter:
restvg -f/mydata/myvg
- To recreate the volume group logical volume structure without restoring any files using only the vgname.data file
/home/my_dir/my_vg.data, enter:
restvg -r -d /home/my_dir/my_vg.data
Note: vgname.data files can be created for a volume group by using the mkvgdata command.
- To recreate the volume group logical volume structure without restoring any files using the vgname.data file inside of the volume group backup located on the tape in /dev/rmt0, enter the following:
restvg -r -f /dev/rmt0
- To display volume group information about the volume group backed up on the tape in /dev/rmt0, enter:
restvg -l -f /dev/rmt0
- To restore the volume group image from the /dev/usbms0 device, onto the disks specified in the vgname.data file contained within the backup image, enter the following command:
restvg -f /dev/usbms0
Note: For information about backing up a volume group, see the listvgbackup command. To restore individual files from a volume group backup, see the restorevgfiles command.
Related reference:
- restore Command
- reducevg Command
Related information:
- mkvgdata command
- savevg command
- mkdev command
리눅스(GNU)와 다른 점
리눅스에는 mksysb처럼 부팅 가능한 시스템 이미지를 만드는 표준 명령이 없어 ReaR(Relax-and-Recover)나 Clonezilla 같은 도구를 쓰고, 볼륨 그룹 구조는 vgcfgbackup·vgcfgrestore로 저장·복원합니다. 파일 백업은 tar, rsync, ext 계열의 dump·restore, XFS의 xfsdump·xfsrestore를 씁니다. 백업 목록 보기는 tar -tvf, 일부 파일 복원은 tar -xvf 백업 경로입니다.