restore 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-restore
핵심 정리
backup(그리고mksysb,savevg)으로 만든 아카이브에서 파일을 꺼냅니다. 목록 보기는restore -Tvf /dev/rmt0, 파일 하나 복원은restore -xvqf 백업 ./etc/hosts.- 파일 이름은
-T목록에 나온 그대로(보통./로 시작) 줍니다. 상대 경로 아카이브는 현재 디렉터리 기준으로 복원되므로 먼저 임시 디렉터리로cd합니다. - 이름 아카이브에서 디렉터리 전체는
-xd, i-node(파일 시스템) 아카이브는-x만으로 디렉터리 안 파일을 모두 복원합니다. 대화식으로 고르려면-i. - 파일 시스템 전체 복원은 새로 만든 파일 시스템의 루트에서
restore -rvqf를 수준 0부터 차례로 실행합니다. 마지막 증분까지 끝나면restoresymtable을 지웁니다. - 한 테이프에 백업이 여럿이면 되감지 않는 장치(
/dev/rmt0.1)와-s 번호로 고릅니다.-P는 내용 없이 권한·소유자·시간·ACL만 복원합니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 Trusted AIX용 -O, -I, -L이 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 4, 6.1 Volume 4 |
| 파일 | /usr/sbin/restore, restoresymtable |
| 관련 명령어 | backup, mksysb, savevg, lsmksysb, restorevgfiles, tctl, dd |
목적
backup 명령으로 만든 아카이브에서 파일을 꺼냅니다.
영어 원문
Extracts files from archives that are created with the backup command.
구문
restore -x [ d M n O Q v q e ] [ -b Number ] [ -L Label ] [ -I Label ] [ -f Device ] [ -s SeekBackup ] [ -E { force | ignore | warn } ] [ File ... ]
restore -T | -t [ a l n q v Q ] [ -b Number ] [ -f Device ] [ -s SeekBackup ]
restore -r [ B O n q v y ] [ -b Number ] [ -f Device ] [ -s SeekBackup ]
restore -R [ B O n v y ] [ -b Number ] [ -f Device ] [ -s SeekBackup ]
restore -i [ O h m n q v y ] [ -b Number ] [ -f Device ] [ -s SeekBackup ]
restore -x [ B O h n m q v y ] [ -b Number ] [ -f Device ] [ -s SeekBackup ] [ File ... ]
restore -X Number [ -MdnqveOQ ] [ -b Number ] [ -f Device ] [ -s Number ] [ -E { force | ignore | warn } ] [ File ... ]
restore -t | -T [ B a l n h q v y ] [ -b Number ] [ -f Device ] [ -s SeekBackup ] [ File ... ]
restore -Pstring [ B d q v Q ] [ b Number ] [ s SeekNumber ] [ -L Label ] [ -I Label ] [ -f Device ] [ File ... ]
restore -Pstring [ h q v ] [ b Number ] [ s SeekNumber ] [ -f Device ] [ File ... ]
차례로 이름 아카이브 복원, 이름 아카이브 목록, 파일 시스템 아카이브 복원(-r, -R, -i, -x), 지정한 볼륨부터 복원, 파일 시스템 아카이브 목록, 이름 아카이브 속성 복원, 파일 시스템 아카이브 속성 복원입니다. 5.3의 구문에는 O, -L, -I가 없습니다.
설명
restore 명령은 backup 명령이 만든 아카이브를 읽어 그 안의 파일을 꺼냅니다. 아카이브는 파일 이름 형식이나 파일 시스템 형식이며, 디스크, 디스켓, 테이프에 있을 수 있습니다. 파일은 아카이브할 때와 같은 방법으로 복원해야 하므로 아카이브 형식을 알아야 합니다. 형식은 -T로 보이는 아카이브 볼륨 머리글 정보로 알 수 있습니다. -x, -r, -T, -t를 쓰면 형식을 자동으로 판단합니다.
-x와 파일 이름을 주면 파일 이름·파일 시스템 아카이브 모두에서 개별 파일을 복원할 수 있습니다. 파일 이름은 아카이브에 있는 그대로 줘야 합니다. 파일 시스템 아카이브에서는 -i로 대화식으로 복원할 수 있습니다. -T는 아카이브의 파일 이름을 표준 출력으로 보여 줍니다.
아카이브 내용을 꺼내려면 파일 시스템 장치에 쓰기 권한이 있거나 Restore 권한이 있어야 합니다.
기본 매체는 디스켓 장치 /dev/rfd0입니다. 표준 입력에서 복원하려면 -f에 -(빼기)를 줍니다. 장치 범위를 줄 수도 있습니다.
참고:
- 다중 볼륨 아카이브에서 복원하면 마운트된 볼륨을 읽고 다음 볼륨을 요청한 뒤 기다립니다. 다음 볼륨을 넣고 Enter를 누르면 계속합니다.
- 장치 블록 크기가 0인 테이프 장치에 만든 아카이브는, 테이프를 만들 때 쓴 블록 크기를 알아야 복원할 수 있습니다.
- 한 테이프에 아카이브가 여럿 있을 수 있습니다. 테이프에서 여러 아카이브를 복원할 때 입력 장치는 열 때 다시 감지 않고 닫을 때 되감지 않는 장치여야 합니다.
-B,-s,-X를 쓰지 않을 때는 되감지 않는 장치로 복원하지 않습니다. 테이프 장치는rmt특수 파일 문서를 봅니다.
영어 원문
The restore command reads archives created by the backup command and extracts the files that are stored on them. These archives can be in either file name or file system format. An archive can be stored on disk, diskette, or tape. Files must be restored by using the same method that was used to archive the files. This operation requires that you know the format of the archive. The archive format can be determined by examining the archive volume header information that is displayed when you use the -T flag. When the -x, -r, -T, or -t flags are used, the restore command automatically determines the archive format.
Individual files can be restored from either file name or file system archives by using the -x flag and specifying the file name. The file name must be specified as it exists on the archive. Files can be restored interactively from file system archives by using the -i flag. The names of the files on an archive can be written to standard output by using the -T flag.
Users must have write access to the file system device or have Restore authorization to extract the contents of the archive.
The diskette device, /dev/rfd0, is the default media for the restore command. To restore from standard input, specify a - (dash) with the -f flag. You can also specify a range of devices, such as /dev/rfd0.
Notes:
If you are restoring from a multiple-volume archive, the restore command reads the volume that mounted, prompts you for the next volume, and waits for your response. After the next volume is inserted, press the Enter key to continue restoring files.
If an archive, created by using the backup command, is made to a tape device with the device block size set to 0, it is necessary for you to have explicit knowledge of the block size that was used when the tape was created to restore from the tape.
Multiple archives can exist on a single tape. When multiple archives are restored from the tape, the restore command expects the input device to be a no-retension-on-open, no-rewind-on-close tape device. Do not use a no-rewind tape device for restoring unless either the
-B,-s, or-Xflag is specified. For more information on using tape devices, see the rmt special file.
File system archives
파일 시스템 아카이브는 아카이브 방식 때문에 i-node 아카이브라고도 합니다. backup에 파일 시스템 이름을 주면 그 안의 파일을 파일 시스템 안의 구조와 배치에 따라 아카이브합니다. restore는 파일 시스템의 내부 구조를 따로 이해하지 않고 파일 시스템 아카이브의 파일을 복원합니다.
파일 시스템 아카이브를 복원할 때 현재 디렉터리에 restoresymtable 파일을 만들어 씁니다. 증분 파일 시스템 복원에 필요한 파일입니다.
참고: 증분 파일 시스템 백업과 복원을 하는 동안에는 restoresymtable 파일을 지우지 않습니다.
-r이나 -R을 쓰면 File 매개변수는 무시합니다.
파일 이름 아카이브
backup에 아카이브할 파일 이름 목록을 주어 만듭니다. restore는 파일 시스템의 내부 구조를 따로 이해하지 않고 복원합니다. 꺼낼 파일을 지정할 때 메타 문자를 쓸 수 있어, 패턴 일치로 파일을 꺼낼 수 있습니다. 패턴 파일 이름은 작은따옴표로 감싸야 합니다.
영어 원문
File system archives are also known as i-node archives because the method used to archive the files. A file system name is specified with the backup command, and the files within that file system are archived based on their structure and layout within the file system. The restore command restores the files on a file system archive without any special understanding of the underlying structure of the file system.
When you restore the file system archives, the restore command creates and uses a file named restoresymtable. This file is created in the current directory. The file is necessary for the restore command to do incremental file system restores.
Note: Do not remove the restoresymtable file if you run incremental file system backups and restores.
The File parameter is ignored when you use either the -r or the -R flag.
File name Archives
File name archives are created by specifying a list of file names to archive to the backup command. The restore command restores the files from a file name archive without any special understanding of the underlying structure of the file system. The restore command allows for metacharacter to be used when you specify files for archive extraction. This process provides the capability to extract files from an archive that is based on pattern matching. A pattern file name must be enclosed in single quotations, and patterns must be enclosed in brackets (...).
About sparse files
운영 체제 파일 시스템에서 긴 Null 문자열을 가진 파일은 다른 파일보다 효율적으로 저장할 수 있습니다. Null 문자열이 할당 블록 전체에 걸치면 그 블록은 디스크에 아예 저장하지 않습니다. 이렇게 블록이 하나 이상 빠진 파일을 희소(sparse) 파일이라 하고, 빠진 블록을 구멍(hole)이라 합니다.
참고: 이름 형식으로 아카이브한 파일(압축 여부와 상관없이)을 복원할 때, 원래 희소하지 않았던 파일이 희소 파일로 복원될 수 있습니다. 복원하기 전에 파일이 희소한지 알아야 합니다. -e를 켜면 희소 파일도 희소하지 않게 복원하기 때문입니다. -e는 복원할 파일이 4KB보다 긴 Null을 가진 비희소 파일일 때만 켭니다. 켜면 일반 파일은 그대로, 비희소 데이터베이스 파일은 비희소로 복원합니다.
영어 원문
Files in the operating system file system that contain long strings of Nulls can be stored efficiently when compared to the other files. If a string of Nulls spans an entire allocation block, that whole block is not stored on disk at all. Files where one or more blocks are omitted in this way are called sparse files. The missing blocks are also known as holes.
Note: Restores the non-sparse files as nonsparse because they were archived by the name format of the backup command for both packed and unpacked files. It is necessary to know the sparseness and nonsparseness of the file being restored before you archive the files. This check is required because by enabling the -e flag, the flag restores the sparse files as nonsparse. This flag must be enabled only if the files to be restored are non-sparse consisting of more than 4 KB Nulls. If the -e flag is specified during the restore operation, it successfully restores all normal files normally and nonsparse database files as nonsparse.
플래그
| 플래그 | 설명 |
|---|---|
-a |
t, T와 함께 쓰면 아카이브의 파일 목록을 권한과 함께 보여 줍니다. |
-B |
아카이브를 표준 입력에서 읽습니다. 보통은 매체를 직접 살펴 형식을 정하지만 파이프로 받으면 그럴 수 없으므로, 파일 시스템 형식이고 장치는 표준 입력(-f -)이라고 가정합니다. |
-b Number |
한 번에 읽을 블록 수. 이름 백업은 512바이트, i-node 백업은 1024바이트 블록입니다. 테이프에서 읽을 때 기본은 이름 백업 100, i-node 백업 32이며, 읽기 크기는 각각 51200(100 × 512), 32768(32 × 1024)입니다. 읽기 크기는 테이프 물리 블록 크기의 배수여야 하며, 고정 블록 모드(0이 아님)에서 배수가 아니면 올바른 값을 찾아 바꾸고 표준 출력에 알린 뒤 계속하고, 찾지 못하면 오류로 끝냅니다. 크면 물리 전송이 커집니다. 디스켓에서 읽을 때는 무시하고 트랙 단위로 읽습니다. |
-d |
File이 디렉터리면 그 안의 파일을 모두 복원합니다. 이름 형식 아카이브에 씁니다. |
-e |
희소 파일로 복원하지 않습니다. 블록 단위로 정렬된 Null 영역도 실제 공간을 할당해 Null로 채우며, 파일 크기만큼 파일 시스템 공간을 차지합니다. 4KB보다 긴 Null을 가진 비희소 파일을 복원할 때만 켭니다. |
-E { force, ignore, warn } |
익스텐트 속성 처리. force는 파일의 고정 익스텐트 크기나 공간 예약을 보존할 수 없으면 그 파일의 복원을 실패시킴, ignore는 오류를 무시, warn은 경고(기본). |
-f Device |
입력 장치. 경로 이름(예: /dev/rmt0)으로 주며, -(빼기)면 표준 입력에서 읽어 dd 등의 출력을 파이프로 받을 수 있습니다. 장치 범위를 /dev/deviceXXX-YYY(XXX가 YYY보다 작음, 예: /dev/rfd0-3) 형식으로 줄 수도 있습니다. 범위의 장치는 모두 같은 종류이고 테이프면 물리 블록 크기가 같아야 하며, 범위의 장치를 차례로 쓰고 다 쓰면 새 볼륨을 요청합니다. |
-h |
디렉터리 자체만 복원하고 그 안의 파일은 복원하지 않습니다. 파일 시스템 형식 아카이브에 쓰며, -r, -R과 함께면 무시합니다. |
-I Label |
(6.1) 아카이브에서 보안 레이블이 없는 파일에 이 무결성(integrity) 레이블을 적용합니다. 레이블은 시스템에 있어야 하며, Trusted AIX에서 이름으로 복원할 때만 씁니다. |
-i |
파일 시스템 아카이브에서 파일을 대화식으로 골라 복원합니다. 하위 명령은 아래 표에 있습니다. |
-l |
-t, -T와 함께 쓰면 시각, 권한, 크기, 소유자, 그룹을 포함한 자세한 목록을 보여 줍니다. -a보다 우선합니다. |
-L Label |
(6.1) 아카이브에서 보안 레이블이 없는 파일에 이 민감도(sensitivity) 레이블을 적용합니다. 레이블은 시스템에 있어야 하며, Trusted AIX에서 이름으로 복원할 때만 씁니다. |
-M |
복원한 파일의 접근·수정 시각을 복원한 시각으로 정합니다. ar로 만든 아카이브 파일이면 모든 멤버 머리글의 수정 시각도 바꿉니다. 이름을 준 개별 파일을 -x나 -X로 복원할 때만 씁니다. 없으면 백업 매체의 시각을 유지합니다. AIX 4.2 형식의 i-node·이름 백업 데이터에 씁니다. |
-m |
복원한 파일 이름을 아카이브의 i-node 번호로 바꿉니다. 몇 개 파일을 다른 이름으로 복원할 때 유용합니다. 디렉터리 계층과 링크는 보존되지 않으며, 디렉터리와 하드 링크는 일반 파일로 복원됩니다. 파일 시스템 형식 아카이브에 씁니다. |
-n |
기본으로 복원하는 ACL, PCL, 이름 있는 확장 속성을 무시합니다. EFS 정보가 있으면 EFS 확장 속성은 -n이 있어도 복원합니다. Trusted AIX에서는 Trusted AIX 보안 속성도 무시합니다. |
-O |
(6.1) Trusted AIX 보안 속성을 무시합니다. |
-Pstring |
파일 내용은 복원하지 않고 속성만 복원합니다. 대상 경로에 파일이 없으면 만들지 않습니다. string은 A(모든 속성), a(권한만), o(소유자만), t(시각만), c(ACL만)의 조합입니다. v, h, b, s, f, B, d, q와 함께 쓸 수 있고 이름·파일 시스템 아카이브 모두에 씁니다. 심볼릭 링크면 링크가 아니라 대상 파일의 메타데이터를 바꿉니다. root가 실행하면 다른 사용자 소유 파일의 속성도 덮어씁니다. |
-Q |
이름 백업에서 오류를 만나면 복구하지 않고 바로 끝냅니다. |
-q |
첫 볼륨이 준비되었으므로 볼륨을 마운트하고 Enter를 누르라고 묻지 않습니다. 여러 볼륨에 걸치면 다음 볼륨은 묻습니다. |
-r |
파일 시스템 아카이브의 모든 파일을 복원합니다. 수준 0 백업 전체를 복원하거나, 수준 0을 복원한 뒤 증분 백업을 복원할 때만 씁니다. 증분 복원 사이에 정보를 넘기는 restoresymtable은 마지막 증분을 복원한 뒤 지워야 합니다. File 매개변수는 무시합니다. |
-R |
다중 볼륨 파일 시스템 아카이브의 특정 볼륨을 요청해, 중단된 복원을 다시 시작합니다. File 매개변수는 무시하며, 다시 시작하면 -r처럼 동작합니다. |
-s SeekBackup |
여러 백업이 든 테이프에서 찾아 복원할 백업. 테이프에만 해당하며, 닫을 때 되감지 않고 열 때 다시 감지 않는 장치(/dev/rmt0.1, /dev/rmt0.5 등)를 줘야 합니다. 되감는 장치를 주면 오류로 끝납니다. 되감지 않는 장치에 -s를 주지 않으면 -s1을 씁니다. 값은 1~100이며, 아카이브의 테이프상 위치가 아니라 지금 헤드 위치 기준입니다. |
-t |
백업 아카이브 정보를 보여 줍니다. 파일 시스템 형식이면 아카이브의 파일 목록을 i-node 번호와 함께, 백업한 파일 시스템의 루트(/) 기준 이름으로 표준 출력에 보여 줍니다. File이 없으면 모든 파일, 있으면 그 파일(디렉터리면 그 안의 모든 파일)을 보여 줍니다. 이름 형식이면 볼륨 머리글 정보를 표준 오류로 보여 주므로 아카이브 형식을 알아내는 데 씁니다. |
-T |
백업 아카이브 정보를 보여 줍니다. 이름 형식이면 볼륨 머리글 정보를 표준 오류로, 파일 목록을 표준 출력으로 보여 주며 File은 무시합니다. 파일 시스템 형식이면 -t와 같습니다. |
-v |
복원하는 파일 정보를 보여 줍니다. 이름 형식에서 -x나 -T와 함께면 아카이브의 파일 크기(바이트)를 보여 줍니다. 디렉터리·블록·문자 장치는 0, 심볼릭 링크는 링크 크기, 하드 링크는 파일 크기로 나오며 끝에 합계가 나옵니다. 파일 시스템 형식이면 디렉터리와 그 밖의 멤버를 구별해 보여 줍니다. |
-x |
File로 지정한 파일을 복원합니다. 없으면 모든 멤버를 복원합니다. 디렉터리를 주면 이름 형식은 디렉터리만, 파일 시스템 형식은 그 안의 모든 파일을 복원합니다. 이름은 restore -T가 보여 주는 것과 같아야 하며 아카이브된 이름 그대로 복원됩니다. 상대 경로(./filename)로 아카이브했으면 현재 디렉터리 기준으로, 파일 시스템 형식이면 늘 현재 디렉터리 기준으로 복원됩니다. 필요한 디렉터리는 자동으로 만들며, 파일 시스템 백업에서는 시작 볼륨 번호를 묻습니다. 셸 패턴 메타 문자를 쓸 수 있습니다(아래 참고). |
-X VolumeNumber |
다중 볼륨 이름 백업의 지정한 볼륨부터 복원합니다. 시작하면 -x처럼 동작하며, 이름 아카이브에만 씁니다. |
-y |
테이프 오류가 나도 계속 복원합니다. 보통은 계속할지 묻습니다. 어느 쪽이든 읽기 버퍼의 데이터는 0으로 채워집니다. 파일 시스템 형식에만 씁니다. |
-? |
사용법을 보여 줍니다. |
-i의 하위 명령
| 하위 명령 | 설명 |
|---|---|
cd Directory |
현재 디렉터리를 바꿈 |
add [ File ] |
꺼낼 목록에 File을 더함. 디렉터리면 그 안의 모든 파일도 더함(-h가 없을 때). 없으면 현재 디렉터리를 더함 |
delete [ File ] |
꺼낼 목록에서 File을 뺌. 디렉터리면 그 안의 모든 파일도 뺌(-h가 없을 때) |
ls [ Directory ] |
디렉터리의 내용을 보여 줌. 디렉터리 이름 뒤에 /, 꺼낼 목록에 든 것 앞에 *가 붙고, verbose면 i-node 번호도 나옴. 없으면 현재 디렉터리 |
extract |
꺼낼 목록의 모든 디렉터리와 파일을 복원 |
pwd |
현재 디렉터리의 전체 경로 |
verbose |
ls가 i-node 번호를 보여 주고, 꺼낼 때 파일마다 정보를 더 보여 줌 |
setmodes |
꺼낼 목록에 더한 모든 디렉터리의 소유자, 모드, 시각을 정함 |
quit |
바로 끝냄. 꺼낼 목록의 파일은 복원하지 않음 |
help |
하위 명령 요약 |
-x의 패턴 일치
셸 경로 이름 globbing과 같은 규칙입니다.
| 메타 문자 | 뜻 |
|---|---|
* |
0개 이상의 문자. 다만 .(마침표)나 /(빗금)는 아님 |
? |
문자 하나. 다만 .나 /는 아님 |
[ ] |
괄호 안 문자 가운데 하나. 빼기로 이은 두 문자가 있으면 현재 로캘에서 그 사이의 문자. 괄호 안의 .나 /는 파일 이름의 .나 /와 일치하지 않음 |
\ |
바로 다음 문자를 메타 문자로 해석하지 않음 |
영어 원문
Item Descriptor -a Specified with the t and T option, the -a option displays the list of files in the archive, along with their permissions. -B Specifies that the archive must be read from standard input. Normally, the restore command examines the actual medium to determine the backup format. When you use a | (pipe), this examination cannot occur. As a result, the archive is assumed to be in file system format, and the device is assumed to be standard input (-f).
Item Descriptor -bNumber Specifies the number of 512-byte blocks for backups done by name. For backups that are done by i-node, the flag specifies the number of 1024-byte blocks to read in a single output. When the restore command reads from tape devices, the default is 100 for backups by name and 32 for backups by i-node.
The read size is the number of blocks that are multiplied by the block size. The default read size for the restore command reading from tape devices is 51200 (100 * 512) for backups by name and 32768 (32 * 1024) for backups by i-node. The read size must be an even multiple of the tapes physical block size. If the read size is not an even multiple of the tapes physical block size and it is in fixed block mode (nonzero), the restore command tries to determine a valid value for Number. If successful, the restore command changes Number to the new value, write a message about the change to standard output, and continues. If unsuccessful in finding a valid value for Number, the restore command writes an error message to standard error and exits with a nonzero return code. Larger values for the Number parameter result in larger physical transfers from the tape device.
The value of the -b flag is always ignored when the restore command reads from diskette. In this case, the command always reads in clusters that occupy a complete track.
-d Indicates that, if the File parameter is a directory, all files in that directory must be restored. This flag can be used when the archive is in file name format. -e Specifies to not restore sparse files actively. If a file has a block that is aligned and sized areas that are Null populated, then the restore operation creates physical space for those file system blocks to be allocated and filled with Nulls. The file size that is specified in bytes corresponds to the space taken within the file system.
This flag must be enabled only if files are to be restored are nonsparse consisting of more than 4 KB Nulls. If the -e flag is specified during restore, it successfully restores all normal files normally and nonsparse database files as nonsparse.
-E The -E option extracts beginning at a specified volume number and requires one of the following arguments. If you omit the -E option, warn is the default behavior. force Fails the restore operation on a file if the fixed extent size or space reservation of the file cannot be preserved. ignore Ignores any errors in preserving extent attributes. warn Issues a warning if the space reservation or the fixed size of the file cannot be preserved. -fDevice Specifies the input device. To receive input from a named device, specify the Device variable as a path name such as /dev/rmt0. To receive input from the standard output device, specify a - (minus sign). The - (minus) feature allows to pipe the input of therestore command from the dd command.
You can also specify a range of archive devices. The range specification must be in the following format:
/dev/deviceXXX-YYY
where XXX and YYY are whole numbers, and XXX must always be less than YYY; for example, /dev/rfd0-3.
All devices in the specified range must be of the same type. For example, you can use a set of 8 mm, 2.3GB tapes or a set of 1.44MB diskettes. All tape devices must be set to the same physical tape block size.
If the Device variable specifies a range, therestore command automatically goes from one device in the range to the next. After all the specified devices are exhausted , therestore command halts and requests that new volumes be mounted on the range of devices.
-h Restores only the actual directory, not the files that are contained in it. This flag can be used when the archive is in file system format. This flag is ignored when used with the -r or -R flags. -I Label The restore command applies this integrity label for files without security labels in the archive. The label that is supplied must exist on the system. This option is valid only for restoring files by name on Trusted AIX.
Item Descriptor -i Restores the selected files interactively from a file system archive. The following are the subcommand for the -i flag: cdDirectory Changes the current directory to the specified directory. add [ File] Specifies that the File parameter is added to the list of files to extract. If File is a directory, that directory and all the files that are contained in it are added to the extraction list (unless the -h flag is used). If File is not specified, the current directory is added to the extraction list. delete [File] Specifies that the File parameter is to be removed from the list of files to be extracted. If File is a directory, that directory and all the files that are contained in it are removed from the extraction list (unless the -h flag is used). ls [Directory] Displays the directories and files that are contained within the Directory parameter. Directory names are displayed with a / (slash) after the name. Files and directories, within the specified directory, that are on the extraction list are displayed with an * (asterisk) before the name. If verbose mode is on, the i-node number of the files and directories is also displayed. If the Directory parameter is not specified, the current directory is used. extract Restores all the directories and files on the extraction list. pwd Displays the full path name of the current directory. verbose Causes the ls subcommand to display the i-node number of files and directories. More information about each file is also displayed as it is extracted from the archive. setmodes Sets the owner, mode, and time for all directories added to the extraction list. quit Causes restore to exit immediately. Any files on the extraction list are not restored. help Displays a summary of the subcommand. -l Specified with the -t and -T option. When specified, displays a detailed list of files, which includes the timestamp, file permissions, file size, owner, and group. The -l option overrides the -a option. -LLabel The restore command applies this sensitivity label for files without security labels in the archive. The label that is supplied must exist on the system. This option is valid only for restoring files by name on Trusted AIX. -M Sets the access and modification times of restored files to the time of restoration. If a restored file is an archive that is created by the ar command, the modification times in all the member headers are also set to the time of restoration. You can specify the -M flag only when you are restoring individually named files and only if the -x or -X flags are also specified. When the -M flag is not specified, the restore command maintains the access and modification times as displayed on the backup medium.
The-M flag is used when the data is in the AIX 4.2 backup by-i-node or by-name format.
-m Renames restored files to the file's i-node number as it exists on the archive. This function is useful if a few files are being restored and you want these files that are restored under a different file name. Since any restored archive members are renamed to their i-node numbers, directory hierarchies and links are not preserved. Directories and hard links are restored as regular files. The -m flag is used when the archive is in file system format. -n By default the restore command restores any ACLs, PCLs, or named extended attributes in the archive. The -n flag causes the restore command to ignore any ACLs, PCLs, or named extended attributes in the archive and not restore them.When the archived files contain Encrypted file system (EFS) information, the EFS extended attributes are restored even if the -n flag is specified. On Trusted AIX systems, the -n option causes the restore command to ignore Trusted AIX security attributes.
For more information about EFS restoration, see Backup and restore in Security.
-O Causes the restore command to ignore Trusted AIX security attributes.
Item Descriptor -Pstring Restore only the file attributes. Does not restore the file contents. If the file specified does not exist in the target directory path, the files are not created. This flag restores file attributes selectively depending on the flags that are specified in the string parameter. String parameter can be a combination of the following characters: A restore all attributes. a restore only the permissions of the files. o restore only the ownership of the files. t restore only the timestamp of the files. c restore only the ACL attributes of the files. Note: Among the existing options for the restore command, options v, h, b, s, f, B, d, and q are valid with the P option. The P option can be used with both file name and file system archives. If the File argument is a symbolic link, then the metadata of the target file is modified and not that of the symbolic link.
Note: Usage of the -P flag overwrites the attributes of files that are owned by another user when run by the superuser.
-Q Specifies that the command must exit when an error is encountered, for backups done by name. This process does not attempt to recover and continue processing the archive, when an error occurs. -q Specifies that the first volume is ready to use and that the restore command cannot prompt you to mount the volume and hit Enter. If the archive spans multiple volumes, the restore command prompts you for the subsequent volumes. -r Restores all files in a file system archive. The -r flag is only used to restore complete level 0 backups or to restore incremental backups after a level 0 backup is restored. The restoresymtable file is used by restore to pass information between incremental restores. This file must be removed when the last incremental backup is restored. The File parameter is ignored when use the -r flag. -R Requests a specific volume of a multiple-volume, file system archive. The -R flag allows a previously interrupted restore to be restarted. The File parameter is ignored when you use the -R flag. When the restore command is restarted, it functions similar to the -r flag. -sSeekBackup Specifies the backup to seek and restore on a multiple-backup tape archive. The -s flag is only applicable when the archive is written to a tape device. To use the -s flag properly, a no-rewind-on-close and no-retension-on-open tape device, such as /dev/rmt0.1 or /dev/rmt0.5, must be specified. If the -s flag is specified with a rewind tape device, the restore command displays an error message and exits with a nonzero return code. If a no-rewind tape device is used and the -s flag is not specified, a default value of -s1 is used. The value of the SeekBackup parameter must be in the range of 1 to 100 inclusive. It is necessary to use a no-rewind-on-close, no-retension-on-open tape device because of the behavior of the -s flag. The value that is specified with -s is relative to the position of the tapes read/write head and not to an archives position on the tape. For example, to restore the first, second, and fourth backups from a multiple-backup tape archive, the respective values for the -s flag would be -s1, and -s2. -t Displays information about the backup archive. If the archive is in file system format, a list of files that are found on the archive is written to standard output. The name of each file is preceded by the i-node number of the file as it exists on the archive. The file names that are displayed are relative to the root (/) directory of the file system that was backed up. If the File parameter is not specified, all the files on the archive are listed. If the File parameter is used, then just that file is listed. If the File parameter refers to a directory, all the files that are contained in that directory are listed. If the archive is in file name format, information that is contained in the volume header is written to standard error. This flag can be used to determine whether the archive is in the file name or the file system format. -T Displays information about the backup archive. If the archive is in file name format, the information that is contained in the volume header is written to standard error, and a list of files that are found on the archive is written to standard output. The File parameter is ignored for file name archives. If the archive is in file system format, the behavior is identical to the -t flag. -v Displays information when the file name is restored . If the archive is in file name format and either the -x or -T flag is specified, the size of the file as it exists on the archive is displayed in bytes. Directory, block, or character device files are archived with a size of 0. Symbolic links are listed with the size of the symbolic link. Hard links are listed with the size of the file, which is how they are archived. Once the archive is read, a total of these sizes is displayed. If the archive is in file system format, directory and nondirectory archive members are distinguished.
Item Descriptor -x Restores individually named files that are specified by the File parameter. If the File parameter is not specified, all the archive members are restored. If the File parameter is a directory and the archive is in file name format, only the directory is restored. If the File parameter is a directory and the archive is in file system format, all the files that are contained in the directory are restored. The file names that are specified by the File parameter must be the same as the names shown by the restore-T command. Files are restored with the same name they were archived with. If the file name was archived by using a relative path name (./filename), the file is restored relative to the current directory. If the archive is in file system format, files are restored relative to the current directory.
The restore command automatically creates any needed directories. When you use this flag to restore file system backups, you are prompted to enter the beginning volume number.
The restore command allows for shell-style pattern matching metacharacters to be used when files for archive extraction is specified . The rules for matching metacharacters are the same as used in shell pathname "globbing," namely: * (asterisk) Matches zero or more characters, but not a '.' (period) or '/' (slash). ? (question mark) Matches any single character, but not a '.' (period) or '/' (slash). [ ] (brackets) Matches any one of the characters that are enclosed within the brackets. If a pair of characters that are separated by a dash is contained within the brackets, the pattern matches any character that lexically falls between the two characters in the current local. Additionally, a '.' (period) or a '/' (slash) within the brackets does not match a '.' (period) or a '/' (slash) in a file name. \ (backslash) Matches the immediately following character, preventing its possible interpretation as a metacharacter.
-XVolumeNumber Begins restoring from the specified volume of a multiple-volume, file name backup. When the restore command is started, the command behaves similar to the -x flag. The -X flag applies to file name archives only. -y Continues restoring when tape errors are encountered. Normally, the restore command request input to continue. In either case, all data in the read buffer is replaced with zeros. The -y flag applies only when the archive is in file system format. -? Displays a usage message.
종료 상태
| 값 | 뜻 |
|---|---|
| 0 | 성공 |
| 0보다 큼 | 오류 |
영어 원문
This command returns the following exit values:
Item Descriptor 0 Successful completion. >0 An error occurred.
보안
Trusted AIX 시스템에서는 권한이 있는 사용자만 실행할 수 있으며, aix.fs.manage.restore 권한이 필요합니다.
(6.1) RBAC와 Trusted AIX 사용자: 이 명령은 특권 작업을 할 수 있으며 특권 사용자만 할 수 있습니다. 권한과 특권은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다.
영어 원문
On Trusted AIX systems, only authorized users can run the restore command.
Item Descriptor aix.fs.manage.restore Required to run this command.
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.
예제
- 디스켓 장치
/dev/rfd0에 있는 파일 이름·파일 시스템 아카이브의 파일 이름을 나열합니다. 기본 장치에서 읽어 모든 파일과 디렉터리 이름을 보여 주며, 파일 시스템 아카이브면 이름 앞에 i-node 번호가 붙습니다.-q로 첫 볼륨이 준비되었으니 묻지 않게 합니다.
restore -Tq
- 현재 디렉터리의 아카이브
myhome.bkup에서system.data를 현재 디렉터리로 꺼냅니다. 이름은-T가 보여 주는 대로 주며,-v로 진행 정보를 보여 줍니다. 두 형식 모두에 해당합니다.
restore -xvqf myhome.bkup system.data
- 이름 아카이브에서
/home/mike/tools디렉터리와 그 안의 파일·하위 디렉터리를 모두 복원합니다(-d). 디렉터리가 없으면 만듭니다.
restore -xdvqf /dev/rmt0 /home/mike/tools
- 파일 시스템 아카이브에서 같은 디렉터리와 내용을 복원합니다.
restore -xvqf /dev/rmt0 /home/mike/tools
/dev/rmt0의 파일 시스템 아카이브 전체를 현재 디렉터리(복원할 파일 시스템의 루트)에 복원합니다. 증분 아카이브 세트면 수준 0부터 높은 순서(0, 1, 2…)로 복원합니다.
restore -rvqf /dev/rmt0
- 한 볼륨에 백업이 여럿 든 테이프에서 다섯째와 아홉째 백업을 복원합니다.
.1은 열 때 다시 감지 않고 닫을 때 되감지 않는 장치입니다. 다섯째를 복원한 뒤 헤드가 그다음에 있으므로, 아홉째는 지금 위치에서 넷째라-s 4를 줍니다.
restore -xvqs 5 -f/dev/rmt0.1
restore -xvqs 4 -f/dev/rmt0.1
- 10개 테이프에 걸친 다중 백업 아카이브에서 여섯째 테이프에서 시작하는 넷째 백업을 복원합니다. 여섯째 테이프를 넣고, 넷째 백업이 그 테이프의 둘째라면
-s 2를 줍니다. 백업이 다음 볼륨으로 이어지면 끝날 때까지 다음 볼륨을 요청합니다.-s는 전체 아카이브가 아니라 넣은 테이프 기준입니다.
restore -xcs 2 -f /dev/rmt0.1 /home/mike/manual/chap3
- 스트리밍 테이프 성능을 높이려고
dd의 출력을 파이프로 받습니다.dd는 64개 512바이트 블록으로 읽어 표준 출력으로 쓰고,restore도 같은 크기로 읽습니다.dd의 블록 크기는backup으로 테이프를 만들 때의 블록 크기의 배수여야 하므로, 예를 들어find /home -print | backup -ivqf/dev/rmt0 -b64로 만든 아카이브는 이 방법으로 꺼낼 수 없습니다. 이름 형식에만 해당하며, 파일 시스템 형식이면-B가 필요합니다.
dd if=/dev/rmt0 bs=64b | restore -xf- -b64
- 그 밖의 예:
| 명령 | 하는 일 |
|---|---|
chdev -l DeviceName -a BlockSize=32k |
9348 자기 테이프 장치 Model 12에서 블록 크기를 바꿔 성능을 높임 |
restore -xef /dev/rmt0 |
비희소 데이터베이스 파일을 복원 |
restore -xf /dev/rmt0 |
아카이브 전에 희소했던 파일을 희소 파일로 복원 |
restore -Pa -vf /dev/rmt0 |
파일 권한만 복원 |
restore -Pc -vf /dev/rmt0 |
ACL 속성만 복원 |
restore -Ta -vf /dev/rmt0 |
목차를 권한과 함께 보여 줌 |
restore -Tl -vf /dev/rmt0 |
이름 아카이브 목차를 시각·권한과 함께 보여 줌 |
restore -tl -vf /dev/rmt0 |
파일 시스템 아카이브 목차를 시각·권한과 함께 보여 줌 |
자주 쓰는 형태:
restore -Tvf /backup/etc_home.bk | grep hosts
mkdir /tmp/rst; cd /tmp/rst
restore -xvqf /backup/etc_home.bk ./etc/hosts
restore -xvqf /backup/hostA.mksysb ./etc/inittab # mksysb에서 파일 하나
영어 원문
- To list the names of files in either a file name or file system archive on the diskette device
/dev/rfd0, type:
restore -Tq
The archive is read from the /dev/rfd0 default restore device. The names of all the files and directories that are contained in the archive are displayed. For file system archives, the file name is preceded by the i-node number of the file as it exists on the archive. The -q flag tells the restore command that the first volume is available and is ready to be read. As a result, you are not prompted to mount the first volume.
- To restore a specific file, type:
restore -xvqf myhome.bkup system.data
This command extracts the file system.data into the current directory from the archive myhome.bkup. The archive in this example is in the current directory. File and directory names must be specified as they are displayed when the -T flag is used. The -v flag displays information during the extraction. This example applies to both file name and file system archives.
- To restore a specific directory and the contents of that directory from a file name archive, type:
restore -xdvqf /dev/rmt0 /home/mike/tools
The -x flag tells restore to extract files by their file name. The -d tells restore to extract all the files and subdirectories in the /home/mike/tools directory. File and directory names must be specified as they are displayed when you use the -T flag. If the directories do not exist, they are created.
- To restore a specific directory and the contents of that directory from a file system archive, type:
restore -xvqf /dev/rmt0 /home/mike/tools
This command extracts files by file name. File and directory names must be specified as they are displayed when you use the -T flag. If the directories do not exist, they are created.
- To restore an entire file system archive, type:
restore -rvqf /dev/rmt0
This command restores the entire file system that is archived on the tape device, /dev/rmt0, into the current directory. This example assumes you are in the root directory of the file system to be restored. If the archive is part of a set of incremental file system archives, the archives must be restored in increasing backup-level order beginning with level 0 (for example, 0, 1, and 2).
- To restore the fifth and ninth backups from a single-volume, multiple-backup tape, type:
restore -xvqs 5 -f/dev/rmt0.1
restore -xvqs 4 -f/dev/rmt0.1
The first command extracts all files from the fifth archive on the multiple-backup tape that is specified by /dev/rmt0.1. The .1 designator specifies the tape device that is not retensioned when it is opened and rewound when it is closed. It is necessary to use a no-rewind-on-close, no-retension-on-open tape device because of the behavior of the -s flag. The second command extracts all the files from the fourth archive (relative to the current location of the tape head on the tape). After the fifth archive is restored, the tape read/write head is in a position to read the archive.
To extract the ninth archive on the tape, you must specify a value of 4 with the -s flag. This is because the -s flag is relative to your position on the tape and not to an archives position on the tape. The ninth archive is the fourth archive from your current position on the tape.
- To restore the fourth backup, which begins on the sixth tape on a 10-tape multiple-backup archive, put the sixth tape into the tape drive and type:
restore -xcs 2 -f /dev/rmt0.1 /home/mike/manual/chap3
Assuming the fourth backup is the second backup on the sixth tape, specifying -s 2 advances the tape head to the beginning of the second backup on this tape. The restore command then restores the specified file from the archive. If the backup continues onto subsequent volumes and the file is not restored, the restore command instructs you to insert the next volume until the end of the backup is reached. The -f flag specifies the no-rewind, no-retension tape device name.
Note: The -s flag specifies the backup number relative to the tape inserted in the tape drive, not to the overall 10-tape archive.
- To improve the performance on streaming tape devices, pipe the
ddcommand to the restore command by typing:
dd if=/dev/rmt0 bs=64b | restore -xf- -b64
The dd command reads the archive from the tape by using a block size of 64 512-byte blocks and writes the archive to standard output. The restore command reads the standard input by using a block size of 64 512-byte blocks. The value of the block size that is used by the dd command to read the archive from the tape must be an even multiple of the block size that was used to create the tape with the backup command. For example, the following backup command cannot be used to create the archive that this example extracts:
find /home -print | backup -ivqf/dev/rmt0 -b64
This example applies to archives in file name format only. If the archive was in file system format, the restore command must include the -B flag.
- To improve the performance of the restore command on the 9348 Magnetic Tape Unit Model 12, you can change the block size by typing:
chdev -l DeviceName -a BlockSize=32k
- To restore non-sparse database files, type:
restore -xef /dev/rmt0
- To restore files that were sparse before archive as sparse, type:
restore -xf /dev/rmt0
- To restore only the permissions of the files from the archive, type:
restore -Pa -vf /dev/rmt0
- To restore only the ACL attributes of the files from the archive, type:
restore -Pc -vf /dev/rmt0
- To view the table of contents along with the file permissions, type:
restore -Ta -vf /dev/rmt0
- To view the table of contents of file name archive along with the timestamps and file permissions, type:
restore -Tl -vf /dev/rmt0
- To view the table of contents of file system archive along with the timestamps and file permissions, type:
restore -tl -vf /dev/rmt0
파일
| 파일 | 설명 |
|---|---|
/dev/rfd0 |
기본 복원 장치 |
/usr/sbin/restore |
restore 명령 |
영어 원문
Item Descriptor /dev/rfd0 Specifies the default restore device. /usr/sbin/restore Contains the restore command.
Related information:
- ar command
- mkfs command
- fsck command
- rmt command
- System management interface tool
- Trusted AIX
리눅스(GNU)와 다른 점
리눅스에는 mksysb처럼 부팅 가능한 시스템 이미지를 만드는 표준 명령이 없어 ReaR(Relax-and-Recover)나 Clonezilla 같은 도구를 쓰고, 볼륨 그룹 구조는 vgcfgbackup·vgcfgrestore로 저장·복원합니다. 파일 백업은 tar, rsync, ext 계열의 dump·restore, XFS의 xfsdump·xfsrestore를 씁니다. 백업 목록 보기는 tar -tvf, 일부 파일 복원은 tar -xvf 백업 경로입니다. AIX restore의 -r(전체), -i(대화식), -x(개별), -t(목록)와 restoresymtable은 ext 계열 리눅스 restore와 거의 같습니다.