mksysb 명령어 (AIX 5.3·6.1)

핵심 정리

  • rootvg(운영 체제)를 백업합니다. 시스템이 망가졌을 때 이 이미지로 원래 상태로 다시 설치하거나 다른 시스템을 복제할 수 있습니다.
  • 자주 쓰는 형태: 테이프 mksysb -i /dev/rmt0(부팅 가능), 파일 mksysb -i -X /backup/hostA.mksysb(NIM으로 복원), 제외 목록 사용 mksysb -ie ....
  • -i로 /image.data(볼륨 그룹·LV·파일 시스템 구성)를 새로 만들어 함께 넣습니다. 늘 쓰는 것이 좋습니다.
  • rootvg만 백업하며 raw LV, 사용자 정의 페이징 공간, 다른 볼륨 그룹은 들어가지 않습니다. 다른 볼륨 그룹은 savevg로 따로 백업합니다.
  • 백업 중에는 시스템 활동을 줄이고, 끝나면 lsmksysb -lf 파일로 내용을 확인합니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (6.1에서 -G, -N, -M, -P, -T, -x, -Z가 더해짐)
원문 IBM Commands Reference — 5.3 Volume 3, 6.1 Volume 3
파일 /usr/bin/mksysb, /image.data, /bosinst.data, /etc/exclude.rootvg
관련 명령어 savevg, lsmksysb, restvg, mkszfile, mkcd, alt_disk_install

목적

rootvg의 설치 가능한 이미지를 파일이나 부팅 가능한 테이프에 만듭니다.

영어 원문

Creates an installable image of the root volume group either in a file or onto a bootable tape.

구문

text
mksysb [ -a ] [ -A ] [ -b Number ] [ -e ] [ -F filename ] [ -i ] [ -m ] [ -p ] [ -P ] [ -t argument ] [ -v ] [ -V ] [ -x file ] [ -X ] [ -Z ] [ -G | -N ] [ -M ] [ -T ] Device | File

5.3의 구문에는 -P, -x, -Z, -G, -N, -M, -T가 없습니다.

설명

mksysb 명령은 운영 체제(곧 루트 볼륨 그룹)를 백업합니다. 시스템이 손상되면 이 백업으로 원래 상태로 다시 설치할 수 있습니다. 테이프나 UDFS(사용자 정의 파일 시스템)를 쓸 수 있는 매체에 만들면 백업이 부팅 가능하며, 백업에서 설치하는 데 필요한 설치 프로그램도 들어갑니다.

참고(6.1): 두 인스턴스가 모두 마운트된 multibos 환경이면 alt_disk_mksysb 명령으로만 복원할 수 있습니다.

(6.1) mksysb 이미지로 다른 시스템을 복원할 수도 있습니다.

파일 시스템 이미지는 backup 파일 형식입니다. 테이프 형식에는 부트 이미지, bosinstall 이미지, 빈 목차, 그 뒤에 시스템 백업(루트 볼륨 그룹) 이미지가 들어갑니다. 루트 볼륨 그룹 이미지는 backup 파일 형식이며 데이터 파일로 시작하고 선택적인 맵 파일이 뒤따릅니다.

5.3 문서에는 "부팅 가능한 rootvg 백업의 부트 이미지는 지금 실행 중인 커널을 따른다. 64비트 커널이면 백업도 64비트라 64비트 시스템만 부팅하고, 32비트 커널이면 32·64비트 시스템을 모두 부팅한다"는 문단이 있습니다.

mksysb가 쓰는 데이터 파일 가운데 하나가 /bosinst.data입니다. 없으면 /var/adm/ras/bosinst.data를 /(루트)로 복사합니다. bosinst.data의 target_disk_data 스탠자는 늘 mksysb를 실행하는 시스템의 루트 볼륨 그룹에 있는 디스크에 맞게 고칩니다.

직접 고친 /bosinst.data를 쓰면서 target_disk_data 스탠자가 바뀌지 않게 하려면 /save_bosinst.data_file을 만듭니다. 이 파일이 있으면 /bosinst.data를 고치지 않습니다.

참고:

  1. mksysb가 실행되는 동안 시스템 활동을 줄입니다.
  2. raw 장치나 사용자 정의 페이징 공간의 데이터는 이미지에 들어가지 않습니다.
  3. /usr 파일 시스템을 원격으로 마운트한 시스템은 백업 이미지로 다시 설치할 수 없습니다.
  4. /dev/netbios나 제품과 함께 제공되지 않는 일부 장치 드라이버처럼 특수 기능의 장치 구성은 모두 복원되지 않을 수 있습니다.
  5. 아카이브 이미지는 backup 명령으로 만듭니다. 백업하는 JFS2의 확장 속성(EA) 형식도 /usr/bin/mkszfile 셸 스크립트로 저장합니다.
  6. 실행 전에 /dev/ipldevice를 지우면 0301-150 bosboot 오류가 납니다. 대부분 무시해도 되며, 성공 여부는 반환 코드로 확인합니다.
  7. (6.1) 암호화 파일 시스템이 있는 상태에서 테이프 백업을 만들려면 -Z를 써야 합니다. 암호화 파일 시스템이 든 테이프 백업으로는 시스템을 다시 설치할 수 없습니다.

CD로 백업하려면 mkcd, DVD로 백업하려면 mkdvd 명령을 봅니다.

영어 원문

The mksysb command creates a backup of the operating system (that is, the root volume group). You can use this backup to reinstall a system to its original state if it is corrupted. If you create the backup on tape or user defined file system (UDFS) capable media, the backup is bootable and includes the installation programs that are needed to install from the backup.

Note: If the system has a multibos environment where both instances are mounted, you can restore the backup only by using the alt_disk_mksysb command.

You can also use a mksysb image to restore another system.

The file system image is in backup-file format. The tape format includes a boot image, a bosinstall image, and an empty table of contents followed by the system backup (root volume group) image. The root volume group image is in backup-file format, starting with the data files and then any optional map files.

One of the data files that the mksysb command uses is the /bosinst.data file. If the /bosinst.data file does not exist, the /var/adm/ras/bosinst.data file is copied to / (root). The mksysb command always updates the target_disk_data stanzas in the bosinst.data file to match the disks currently in the root volume group of the system where the mksysb command is running.

If you are using a customized /bosinst.data file and do not want the target_disk_data stanzas that are updated, you must create /save_bosinst.data_file. The mksysb command does not update /bosinst.data if the /save_bosinst.data_file exists.

Notes:

  1. When the mksysb command is running, ensure that system activity is minimal.

  2. The image that the mksysb command creates does not include data on raw devices or in user-defined paging spaces.

  3. If you are using a system with a remote-mounted /usr file system, you cannot reinstall your system from a backup image.

  4. The mksysb command might not restore all device configurations for special features, such as /dev/netbios and some device drivers that are not shipped with the product.

  5. The mksysb command uses the backup command to create an archive image. The mksysb command also saves the extended attributes (EA) format for any Enhanced Journaled File System (JFS2) that are being backed up. It uses the /usr/bin/mkszfile shell script to save this information.

  6. If you remove the /dev/ipldevice before running the mksysb command, the 0301-150 bosboot error occurs. This message, in most cases, can be ignored. Confirm the success of the mksysb command by the return code.

  7. If you are creating a tape backup and have encrypted file systems, you must use the -Z flag. You cannot reinstall your system from a tape backup image that contains encrypted file systems.

To create a backup of the operating system to a CD, refer to the mkcd Command. To create a backup of the operating system to a DVD, refer to the mkdvd Command.

플래그

플래그 설명
-a 확장 속성이나 NFS4 ACL을 백업하지 않습니다.
-A DMAPI(Data Management API) 파일 시스템 파일을 백업합니다.
-b Number 한 번에 쓸 512바이트 블록 수. backup이 이름으로 테이프에 쓸 때 기본 100이며, 쓰기 크기는 블록 수 × 블록 크기(기본 51200 = 100 × 512)입니다. 쓰기 크기는 테이프 물리 블록 크기의 배수여야 합니다.
-e /etc/exclude.rootvg에 적힌 파일을 백업에서 뺍니다. 아래 "제외 목록"을 봅니다.
-F filename 이미 만든 mksysb 이미지로 백업 테이프를 만들며, 부팅 가능하게 하려 합니다. 테이프 장치와 함께만 씁니다.
-G (6.1) WPAR 파일 시스템을 백업에서 뺍니다. -N과 함께 쓸 수 없습니다.
-i mkszfile을 불러 /image.data를 만듭니다. 볼륨 그룹, 논리 볼륨, 파일 시스템, 페이징 공간, 물리 볼륨 정보가 들어가며 설치 과정이 씁니다. 써야 합니다. 쓰지 않으면 공간 요구가 맞지 않는 옛 /image.data가 저장될 수 있습니다. mkszfile을 실행하기 전에 /tmp에 부트 이미지를 담을 공간이 있는지 확인합니다(백업과 설치 때 모두 필요). 필요한 공간은 bosboot -q -a -d device로 보며, UDFS 장치 /dev/usbms0은 bosboot가 지원하지 않으므로 /dev/cd0을 줍니다. -X를 쓰면 이 확인이 필요 없습니다.
-m mkszfile -m을 불러 맵 파일을 만듭니다. -i의 기능도 함께 합니다.
-M (6.1) multibos용 백업 파일을 만듭니다. /, /usr, /var, /opt를 백업하며, 시스템을 다시 설치하는 데 쓰면 안 됩니다. 시스템과 같은 수준의 bos.alt_disk_install.boot_images 파일셋이 있어야 합니다.
-N (6.1) defined 상태인 WPAR의 파일 시스템을 백업에 넣습니다. 그 파일 시스템은 모두 rootvg에 있어야 합니다.
-p 백업하는 파일을 소프트웨어로 압축(packing)하지 않습니다. 자체 압축을 하는 테이프 드라이브가 있습니다.
-P (6.1) /etc/exclude_packing.rootvg, /etc/exclude_packing.vgname, /etc/exclude_packing.WPARname에 한 줄에 하나씩 적힌 파일은 압축하지 않습니다. 예를 들어 /etc/filesystems와 /usr/bin/zcat을 압축에서 빼려면 그 둘을 연달아 적습니다. -p와 함께 쓸 수 없습니다.
-t argument -F로 지정한 mksysb 파일로 부트 이미지를 만들 디렉터리나 파일 시스템. 없으면 /tmp를 씁니다. 약 100MB가 필요하며 부트 이미지를 만든 뒤 풀립니다.
-T (6.1) 스냅숏으로 백업합니다. JFS2에만 해당하며 외부 JFS2 스냅숏을 만듭니다. 스냅숏은 특정 시점의 이미지라 시스템을 잠시 멈출 필요가 없습니다. 스냅숏 크기는 파일 시스템의 2~15%이고 백업이 끝나면 지웁니다. 다만 다른 스냅숏이 이미 있으면 지우지 않고, 내부 스냅숏이 있으면 외부 스냅숏을 만들 수 없어 스냅숏 없이 백업합니다. JFS는 이전처럼 백업합니다. -i도 함께 줘야 하며, 아니면 옛 /image.data의 공간 요구가 맞지 않아 스냅숏에 저장할 때 실패할 수 있습니다.
-v 자세한 모드. 백업하는 파일을 나열합니다.
-V 테이프 백업을 검증합니다. 백업 테이프의 각 파일 머리글을 확인하고 읽기 오류를 바로 알려 줍니다.
-x file (6.1) 파일에 적힌 파일 시스템을 백업에서 뺍니다. 마운트 지점을 한 줄에 하나씩 적습니다. 주의: 운영 체제 백업에서 파일 시스템을 빼면 그 백업으로 시스템을 복원하지 못할 수 있습니다.
-X 필요하면 /tmp 파일 시스템을 자동으로 늘립니다. 부팅 가능한 테이프 백업을 만들 때 부트 이미지를 둘 공간이 필요할 수 있습니다.
-Z (6.1) 모든 파일, 디렉터리, 파일 시스템의 EFS(암호화 파일 시스템) 정보를 백업하지 않습니다. 암호화 파일 시스템이 있는 상태에서 테이프로 백업할 때는 반드시 씁니다.

제외 목록(-e)

빼려는 파일 이름 패턴을 ASCII 편집기로 /etc/exclude.rootvg에 적습니다. 패턴은 grep 명령의 패턴 일치 규칙으로 해석합니다. SMIT에서는 Exclude Files 필드에서 Tab을 한 번 눌러 yes로 바꿉니다. 모든 파일은 .(현재 작업 디렉터리) 기준 상대 경로로 백업됩니다.

  1. scratch라는 디렉터리의 내용을 모두 빼려면 /scratch/를 적습니다.
  2. 경로 중간에 /tmp가 든 다른 디렉터리는 빼지 않고 /tmp 디렉터리의 내용만 빼려면 ^./tmp/를 적습니다. /tmp 마운트 지점 자체는 남습니다.

줄의 처음부터 일치해야 하면 검색 문자열을 ^(캐럿)과 .(점), 파일·디렉터리 이름 순으로 씁니다. 빼려는 이름이 다른 이름의 일부이면 ^.로 줄의 처음을, $(달러)로 줄의 끝을 지정합니다.

영어 원문
  • -a — Does not back up extended attributes or Network File System version 4 (NFS4) access control lists (ACLs).
  • -A — Backs up Data Management API (DMAPI) file system files.
  • -b number — Specifies the number of 512-byte blocks to write in a single output operation. When the backup command writes to tape devices, the default is 100 for backups by name. The write size is the number of blocks that are multiplied by the block size. The default write size for the backup command that writes to tape devices is 51200 (100 * 512) for backups by name. The write size must be an even multiple of the tape's physical block size.

| |

  • -e — Excludes files that are listed in the /etc/exclude.rootvg file from being backed up. The rules for exclusion follow the pattern matching rules of the grep command. If you want to exclude certain files from the backup, create the /etc/exclude.rootvg file, with an ASCII editor, and enter the patterns of file names that you do not want included in your system backup image. The patterns in this file are input to the pattern matching conventions of the grep command to determine which files will be excluded from the backup. If you want to exclude files that are listed in the /etc/exclude.rootvg file, select the Exclude Files field and press the Tab key once to change the default value to yes. For example: 1. To exclude all the contents of the directory that is called scratch, edit the exclude file to read as follows: /scratch/ 2. To exclude the contents of the directory that is called /tmp, and avoid excluding any other directories that contain /tmp in the path name, edit the exclude file to read as follows: ^./tmp/ This excludes all contents of the /tmp directory, but the /tmp mount point for the file system is retained. It does not remove other directories or its contents such as /var, /adm, /sw, and /tmp file system. All files are backed up relative to . (current working directory). To exclude any file or directory for which it is important to have the search match the string at the beginning of the line, use the ^ (caret character) as the first character in the search string, followed by . (dot character), followed by the file name or directory to be excluded. If the file name or directory that is being excluded is a substring of another file name or directory, use the ^. (caret character followed by dot character) to indicate that the search must begin at the beginning of the line and use the $ (dollar sign character) to indicate that the search must end at the end of the line.
  • -F filename — Specifies a previously created mksysb image from which a backup tape is created. An attempt is made to make the backup tape bootable. Additionally, this flag must be used with a tape device.
  • -G — Excludes WPAR file systems from the system backup. This flag is not valid with -N flag.
  • -i — Calls the mkszfile command, which generates the /image.data file. The /image.data file contains details about volume groups, logical volumes, file systems, paging space, and physical volumes. This information is included in the backup for future use by the installation process. You must use the -i flag. Otherwise, an older /image.data file might be saved that does not contain adequate space requirements to restore the system backup. Note: Before you run the mkszfile command, ensure that enough space is available in the /tmp file to store a boot image. This space is needed during both backup and installation. To determine the amount of space that is needed in the /tmp file, enter the following command: bosboot -q -a -d device If you are using UDFS capable device named /dev/usbms0, you must specify /dev/cd0 as the device name because the /dev/usbms0 device is not supported by the bosboot command. If you use the -X flag with the mksysb command, you do not need to run the bosboot command to determine the amount of space needed in the /tmp file.
  • -m — Calls the mkszfile command, with the -m flag to generate map files. Note: The use of the -m flag causes the functions of the -i flag to be executed also.
  • -M — Creates a backup file that is intended for use with the multibos command. The -M flag backs up the /, /usr, /var, and /opt file systems. Do not use the backup to reinstall a system. You must install the bos.alt_disk_install.boot_images fileset at the same level as the system.
  • -N — Includes file systems that belong to a workload partition (WPAR) in the defined state in the system backup. Note: To be included in the backup, all file systems that belong to a WPAR in the defined state must be in the rootvg volume group.
  • -p — Disables software packing of the files as they are backed up. Some tape drives use their own packing or compression algorithms.
  • -P — Excludes files that are listed line by line in the /etc/exclude_packing.rootvg, /etc/exclude_packing.vgname, or /etc/exclude_packing.WPARname file from being packed. For example, to exclude the /etc/filesystems and /usr/bin/zcat file from being packed during the mksysb backup, edit the /etc/exclude_packing.type to add on consecutive lines /etc/filesystems and /usr/bin/zcat. In this case, the file /etc/exclude_packing.type must look like: /etc/filesystems /usr/bin/zcat The -P and -p flags are mutually exclusive.
  • -t argument — Specifies the path to the directory or file system that is used to create a boot image from the mksysb file that is specified by the -F flag. If the -t flag is not used with the -F flag, the boot image is created in the /tmp file by default. Approximately 100 MB of free space is required. After the boot image is created, this space is freed.
  • -T — Creates backup by using snapshots. This command applies only to JFS2 file systems. When you specify the -T flag to use snapshots for creating a volume group backup, external JFS2 snapshots are created. Snapshots allow for a point-in-time image of a JFS2 file system and thus, do not require a system to be put into a temporarily inactive state. The size of the snapshot is 2% - 15% of the size of the file system. The snapshot logical volumes are removed when backup is complete. However, snapshots are not removed if a file system already has other snapshots. Additionally, if a file system has internal snapshots, external snapshots cannot be created and thus, snapshots are not used for creating the backup of the file system. The use of the -T flag does not affect any JFS file systems that are present in the volume group that is being backed up. These file systems are backed up in the same manner as done previously. When you specify the -T flag, you must also specify the -i flag. If you do not specify the -i flag, an older /image.data file might not have adequate space requirements. Therefore, a failure might occur when you save data to the snapshot.
  • -v — Verbose mode. Lists files as they are backed up.
  • -V — Verifies a tape backup. This flag causes the mksysb command to verify the file header of each file on the backup tape and report any read errors as they occur.
  • -x file — Excludes the file systems that are listed in the file from the system backup. File system mount points must be listed one per line.
  • -X — Specifies to automatically expand the /tmp file system if necessary. The /tmp file system might need to be extended to make room for the boot image when creating a bootable backup to tape.
  • -Z — Specifies that the Encrypted File System (EFS) information for all the files, directories, and file systems is not backed up.The -Z flag is required if you have encrypted file systems and are creating a backup on a tape.
  • Attention: Use the -x flag with caution when you exclude the file systems from the backup of the

operating system. The resulting backup might be unusable for system restoration.

매개변수

매개변수 설명
Device, File 장치나 파일 이름
영어 원문
  • Device | File — Specifies the name of the device or file.

종료 상태

값 뜻
0 성공
1 mksysb 사용 오류
2 savevg 사용 오류(savevg는 mksysb의 링크)
3 파일 시스템을 마운트하기 전에 오류
4 트랩으로 끝남
5 공간이 없어 끝남
6 볼륨 그룹 이름이 잘못되어 끝남
영어 원문

This command returns the following exit values:

  • 0 — The command completed successfully.
  • 1 — An error in the mksysb command use occurred.
  • 2 — An error in the savevg command use occurred. The savevg is a link to mksysb.
  • 3 — An error occurred before any file systems were mounted.
  • 4 — Exit because of trap.
  • 5 — Exit because there was no space.
  • 6 — Exit because a volume group name was not valid.

|

예제

명령 하는 일
mksysb -i /dev/rmt0 /image.data를 새로 만들어 테이프 /dev/rmt0에 시스템 백업
mksysb -m /dev/rmt1 맵 파일을 포함한 /image.data를 만들어 /dev/rmt1에 백업
mksysb -i -e /dev/rmt1 /etc/exclude.rootvg에 /home/user1/tmp/를 적어 두고 백업. 디렉터리는 백업하지만 그 안의 파일은 빼고 백업
mksysb -i /mksysb_images/node1 백업 파일 /mksysb_images/node1과 새 /image.data를 만듦. 이 파일은 부팅할 수 없고 NIM으로만 설치할 수 있음
mksysb /dev/rmt0 -V mkszfile을 따로 실행한 뒤 테이프에 백업하고 파일 머리글을 읽을 수 있는지 검증
mksysb -iM /mksysb_images/mksysb1 (6.1) multibos용 백업 파일과 /image.data를 만듦
mksysb -i /dev/usbms0 UDFS 장치 /dev/usbms0에 백업

볼륨 그룹 백업은 listvgbackup, 볼륨 그룹 백업에서 개별 파일 복원은 restorevgfiles 명령을 봅니다.

자주 쓰는 형태:

bash
mksysb -i -X -e /backup/$(hostname).mksysb
lsmksysb -lf /backup/$(hostname).mksysb     # 내용 확인
mksysb -i -T /dev/rmt0                      # 스냅숏 백업(6.1)
영어 원문
  1. To generate a system backup and create an /image.data file (generated by the mkszfile command) to a tape device named /dev/rmt0, enter the following command: mksysb -i /dev/rmt0

  2. To generate a system backup and create an /image.data file with map files (generated by the mkszfile command) to a tape device named /dev/rmt1, enter the following command: mksysb -m /dev/rmt1

  3. To generate a system backup with a new /image.data file, but exclude the files in directory /home/user1/tmp, create the file /etc/exclude.rootvg containing the line /home/user1/tmp/, and enter the following command: mksysb -i -e /dev/rmt1

This command backs up the /home/user1/tmp directory but not the files it contains.

  1. To generate a system backup file named /mksysb_images/node1 and a new /image.data file for that image, enter the following command: mksysb -i /mksysb_images/node1

Note: This file is not bootable and can be installed only by using Network Installation Management (NIM).

  1. After running the mkszfile command independently, to generate a system backup on the tape device /dev/rmt0, and then to verify the readability of file headers, enter the following command: mksysb /dev/rmt0 -V

  2. To generate a system backup file named /mksysb_images/mksysb1 to be used with the multibos command, and to create an /image.data file for that image, enter the following command: mksysb -iM /mksysb_images/mksysb1

  3. To generate a system backup and create an /image.data file (generated by the mkszfile command) to a UDFS capable device named /dev/usbms0, enter the following command: mksysb -i /dev/usbms0

Note: For information backing up a volume group, see the listvgbackup command. To restore individual files from a volume group backup, see the restorevgfiles command.

파일

파일 설명
/usr/bin/mksysb mksysb 명령
영어 원문
  • /usr/bin/mksysb — Contains the mksysb command.

Related reference:

  • “mkszfile Command”

Related information:

  • backup command
  • /image.data file
  • Creating system backups
  • Cloning a system backup

리눅스(GNU)와 다른 점

리눅스에는 mksysb처럼 부팅 가능한 시스템 이미지를 만드는 표준 명령이 없어 ReaR(Relax-and-Recover)나 Clonezilla 같은 도구를 쓰고, 볼륨 그룹 구조는 vgcfgbackup·vgcfgrestore로 저장·복원합니다. 파일 백업은 tar, rsync, ext 계열의 dump·restore, XFS의 xfsdump·xfsrestore를 씁니다. 백업 목록 보기는 tar -tvf, 일부 파일 복원은 tar -xvf 백업 경로입니다.