IBM Support

Extract mksysb image from tape

Technote (FAQ)


Question

How to extract mksysb from tape to file for NIM Usage

Cause

There may be occasions where a machine's backup resides on tape but the mksysb needs to be transferred to a NIM server for remote installations. This document describes how to properly extract a mksysb image backed up onto tape and restore it to a file.

Answer

Extract Mksysb from tape to NIM resource


Introduction
Extract the /tapeblksz file from the tape
Using the 'lsmksysb' command to verify mksysb tape readability
Extract the mksysb image from the tape
Verify that the system recognizes extracted file as a mksysb image
Using the new mksysb file as a NIM resource


*For future reference, all further mentions using the word “media” will refer to Base AIX Installation DVDs, unless otherwise specified.
Furthermore, all references for any device (cdrom, ethernet, tape, etc) will always be cd0, ent0, rmt0, hdisk0, etc, unless otherwise noted. You may, depending on your environment, need to use other devices. Substitute as needed.


Introduction


This document will describe how to extract a mksysb image that currently exists on tape and store it to disk. Additionally, this document provides an application for the extracted mksysb used for a NIM environment.

This resource was written with the presumption that a mksysb has already been written to tape.

(!) NOTE: Before beginning this procedure, please read through the following reference for a better understanding of the mksysb structure and layout on tape:

Reference 1: Creating a mksysb backup to tape
http://www.ibm.com/support/docview.wss?uid=isg3T1010809



Extract the /tapeblksz file from the tape


This is an important step because different tape devices can be set to write the media at different block sizes. If the tape device is set to a different block size than the tape, it may not read the tape properly, or at all.

The tape device block size first has to be configured to read 512 byte blocks to find out what information the ./tapeblksz file has. This file holds the information concerning the block size setting when the tape was written. The block size had to be changed to 512 because the ./tapeblksz file is written to the second image of the mksysb in 512 byte blocks.

Change the block size of the tape to 512 byte blocks




# chdev -l rmt0 -a block_size=512
rmt0 changed




Rewind the tape after the block size change.




# tctl -f /dev/rmt0 rewind




Run the ‘restore’ command which will point to the second image of the mksysb backup and extract the tapeblksz file to your current working directory:




# restore -s2 -xqvf /dev/rmt0.1 ./tapeblksz
New volume on /dev/rmt0.1:
Cluster 51200 bytes (100 blocks).
Volume number 1
Date of backup: Thu May 7 15:44:07 2009
Files backed up by name
User root
x 10 ./tapeblksz
total size: 10
files restored: 1




Running a ‘cat’ against ./tapeblksz provides the block size at which the tape was created.




# cat tapeblksz
1024 NONE




Once the block size is obtained, change the tape block size to the size specified by the ./tapeblksz file. In this case it will need to be changed to 1024.




# chdev -l rmt0 -a block_size=1024
rmt0 changed




Be sure to rewind the tape after changing the block size.




# tctl -f /dev/rmt0 rewind




On the target system where the mksysb file will be extracted, be sure to find a location that has plenty of space to hold the mksysb file.

Mksysb files can be fairly large, so when moving them from one medium to a filesystem it is important to consider a few things.

First, check the ulimit for root to make sure the 'fsize' = >2Gb
# ulimit –a
-or-
# vi /etc/security/limits

Secondly, confirm that the filesystem being written to is large file enabled JFS or a JFS2 filesystem. The following output includes the ‘lsfs’ and ‘df’ commands to verify the filesystem format and space information.




# lsfs
Name          Nodename    MountPt    VFS   Size      Options  Auto  Accounting
/dev/hd4        --              /               jfs2 786432      --       yes     no
/dev/hd1        --              /home       jfs2 4456448     --      yes     no
/dev/hd2        --              /usr          jfs2  2883584    --      yes     no
/dev/hd9var    --             /var          jfs2  262144      --      yes     no
/dev/hd3        --              /tmp         jfs2  262144      --      yes     no
/proc              --             /proc        procfs --             --      yes     no
/dev/hd10opt  --             /opt           jfs2 262144       --      yes     no
/dev/fslv00     --             /lppbackup jfs2 100663296  rw     yes     no
/dev/fslv02     --             /mksysb    jfs2  20971520   rw     yes     no

# df -g
Filesystem    GB blocks    Free    %Used    Iused    %Iused    Mounted on
/dev/hd4      0.38            0.35     7%        2189       3%        /
/dev/hd2      1.38            0.11     92%      34296     54%       /usr
/dev/hd9var  0.12           0.11     11%      443         2%        /var
/dev/hd3      0.12            0.12     2%        41          1%        /tmp
/dev/hd1      2.12            2.06     4%        38          1%        /home
/proc            -                 -          -           -             -           /proc
/dev/hd10opt 0.12           0.05     63%      1538       13%      /opt
/dev/fslv00   48.00          19.17   61%      511         1%        /lppbackup
/dev/fslv02   10.00          8.20     18%      4            1%        /mksysb






Using the 'lsmksysb' command to verify mksysb tape readability


The 'lsmksysb' command is a useful command to obtain information regarding the mksysb and verifies that the system acknowledges the mksysb image on the tape.

(!) NOTE: 'lsmksysb' is not a command that verifies whether a tape will be bootable or restore without issues. Reference the 'lsmksysb' man page or infocenter for more information on 'lsmksysb':

Reference 2: InfoCenter: lsmksyb command
http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.cmds%2Fdoc%2Faixcmds3%2Flsmksysb.htm

Running the command, '# lsmksysb -lf /dev/rmt0', will list out information about the mksysb including: the date the mksysb was taken, the oslevel, the size of the mksysb, the lv structure, etc.





# lsmksysb -lf /dev/rmt0

VOLUME GROUP: rootvg
BACKUP DATE/TIME: Thu May 7 15:42:48 CDT 2009
UNAME INFO: AIX shaevelbso 3 5 00059D5C4C00
BACKUP OSLEVEL: 5.3.7.0
MAINTENANCE LEVEL: 5300-07
BACKUP SIZE (MB): 7168
SHRINK SIZE (MB): 4358
VG DATA ONLY: no


rootvg:
LV NAME      TYPE        LPs   PPs   PVs      LV STATE        MOUNT POINT
hd5             boot         1      1      1          closed/syncd   N/A
hd6             paging      4      4      1          open/syncd     N/A
hd8             jfs2log      1      1      1          open/syncd     N/A
hd4             jfs2          3      3      1          open/syncd      /
hd2             jfs2          11    11    1           open/syncd     /usr
hd9var        jfs2          1      1      1           open/syncd     /var
hd3             jfs2          1      1      1          open/syncd     /tmp
hd1             jfs2          17    17     1          open/syncd     /home
hd10opt       jfs2          1      1      1          open/syncd     /opt
lg_dumplv   sysdump   16    16     1          open/syncd     N/A






Extract the mksysb image from the tape


At this point we know that the mksysb on the tape actually resides as the fourth image of the mksysb backup. Therefore, a command needs to be used to extract the fourth image from the mksysb tape and store it to a file on the system. The 'dd' command can be used to perform this operation.

To extract the mksysb from the tape, run the following, using the block size obtained from the ./tapeblksz file for the bs= value in the dd command.:




# dd if=/dev/rmt0.1 of=/mksysb/test.shaevel bs=1024 fskip=3
1462150+0 records in
1462150+0 records out




Verify that the system recognizes extracted file as a mksysb image


After the mksysb file has been extracted, ensure that the system still acknowledges the file as a mksysb:

If not in the directory already, make sure to change directory to where the mksysb file resides:




# cd /mksysb




Run the 'lsmksysb' command to list out the information about the backup.




# lsmksysb -lf test.shaevel


VOLUME GROUP: rootvg
BACKUP DATE/TIME: Thu May 7 15:42:48 CDT 2009
UNAME INFO: AIX shaevelbso 3 5 00059D5C4C00
BACKUP OSLEVEL: 5.3.7.0
MAINTENANCE LEVEL: 5300-07
BACKUP SIZE (MB): 7168
SHRINK SIZE (MB): 4358
VG DATA ONLY: no

rootvg:
LV NAME      TYPE        LPs   PPs   PVs      LV STATE        MOUNT POINT
hd5             boot         1      1      1          closed/syncd   N/A
hd6             paging      4      4      1          open/syncd     N/A
hd8             jfs2log      1      1      1          open/syncd     N/A
hd4             jfs2          3      3      1          open/syncd      /
hd2             jfs2          11    11    1           open/syncd     /usr
hd9var        jfs2          1      1      1           open/syncd     /var
hd3             jfs2          1      1      1          open/syncd     /tmp
hd1             jfs2          17    17     1          open/syncd     /home
hd10opt       jfs2          1      1      1          open/syncd     /opt
lg_dumplv   sysdump   16    16     1          open/syncd     N/A





The 'lsmksysb' output confirms that this file is a mksysb.



Using the new mksysb file as a NIM resource


At this point, the mksysb file has been successfully extracted from the tape media. From here the extracted mksysb can be defined as a resource on a NIM server to restore a machine through the network if necessary. For more information on creating a mksysb NIM resource, please reference:

Reference 3: NIM Setup Guide
http://www.ibm.com/support/docview.wss?uid=isg3T1010383

Document information

More support for: AIX family

Software version: 5.3, 6.1, 7.1

Operating system(s): AIX

Software edition: Enterprise, Standard

Reference #: T1011679

Modified date: 14 April 2011


Translate this page: