Friday 18 October 2013

Creating and Restoring a Mksysb Without Preserving Mirrors

Question

How do you create/restore a mksysb, either locally or using NIM, without preserving mirrors?

Answer

This document gives the procedures to be taken to create or restore a mksysb without preserving mirrors either on a standalone system or in a NIM environment. The procedures in this document are valid for AIX 5.x and 6.1

WARNING: This procedure is valid ONLY with a mksysb image and will not work with a Sysback 6000 system backup.
____________________________________________________________________________

Contents of the note:

-How to restore an image.data file from a tape
-How to restore an image.data file from an existing mksysb backup file
-How to edit an image.data file to break a mirror
-Creating a mksysb with an edited image.data file to tape or file
-Creating an 'image_data' resource without preserving mirrors for use with NIM
-Using the 'image_data' resource to restore a mksysb without preserving mirrors using NIM
____________________________________________________________________________

How to restore an image.data file from a tape 

1. Change the block size of the tape device to 512:
# chdev –l rmt0 –a block_size=512
2. Check to make sure the block size of the tape drive has been changed:
# tctl –f /dev/rmt0 status
*You will receive output similar to this:
rmt0 Available 10-60-00-1,0 4.0 GB 4mm Tape Drive
attribute value description user_settable

block_size 512 BLOCK size (0=variable length) True
compress yes Use data COMPRESSION True
mode yes Use DEVICE BUFFERS during writes True
ret_error no RETURN error on tape change or reset True

3. 'cd' to the /tmp directory (or a directory where you would like to store the /image.data file from the mksysb image) and restore the /image.data file from the tape:
# cd /tmp
# restore –s2 -xqvf /dev/rmt0.1 ./image.data
*The image.data file from the tape will be restored to the /tmp directory

____________________________________________________________________________

How to restore an image.data file from an existing mksysb backup file 


1. ‘cd’ to the /tmp directory (or a directory where you would like to store the /image.data file from the mksysb image) and restore the /image.data file from the mksysb:
# cd /tmp
# restore -xqvf
./image.data ***The image.data file from the mksysb image will be restored to the /tmp directory

____________________________________________________________________________

How to edit an image.data file to break a mirror 

1. Create a new image.data file by running the following command:
# cd /
# mkszfile
2. vi the image.data file to break the mirror, by running the following command:
# vi /image.data
3. What you are looking for are the “lv_data” stanzas. There will be one for every logical volume associated with rootvg.

4. The following is an example of an lv_data stanza from an image.data file of a mirrored rootvg. The lines that need changing are marked with an --->, will be bold, and a slightly larger font:
lv_data:
VOLUME_GROUP= rootvg
--> LV_SOURCE_DISK_LIST= hdisk0 hdisk1
LV_IDENTIFIER= 000693da00004c00000001203de2aa29.14
LOGICAL_VOLUME= fslv01
VG_STAT= active/complete
TYPE= jfs2
MAX_LPS= 512
---> COPIES= 2
LPs= 20
STALE_PPs= 0
INTER_POLICY= minimum
INTRA_POLICY= middle
MOUNT_POINT= /chris
MIRROR_WRITE_CONSISTENCY= on/ACTIVE
LV_SEPARATE_PV= yes
PERMISSION= read/write
LV_STATE= opened/syncd
WRITE_VERIFY= off
PP_SIZE= 256
SCHED_POLICY= parallel
--> PP= 40
BB_POLICY= relocatable
RELOCATABLE= yes
UPPER_BOUND= 32
LABEL= /chris
MAPFILE=
LV_MIN_LPS= 1
STRIPE_WIDTH=
STRIPE_SIZE=
SERIALIZE_IO= no
FS_TAG= vfs=jfs2:log=/dev/hd8:mount=true:options=rw:account=false
DEV_SUBTYP=
*** Note: There are two disks in the 'LV_SOURCE_DISK_LIST', THE 'COPIES' value reflects two copies, and the 'PP' value is double that of the 'LPs' value.

4. The following is an example of the same lv_data stanza after manually breaking the mirror. The lines that have been changed are marked with a --->, will be bold, and a slightly larger font. Edit each 'lv_data' stanza in the /image.data.mksysb file as shown below to break the mirrors:
lv_data:
VOLUME_GROUP= rootvg
---> LV_SOURCE_DISK_LIST= hdisk0
LV_IDENTIFIER= 000693da00004c00000001203de2aa29.14
LOGICAL_VOLUME= fslv01
VG_STAT= active/complete
TYPE= jfs2
MAX_LPS= 512
---> COPIES= 1
LPs= 20
STALE_PPs= 0
INTER_POLICY= minimum
INTRA_POLICY= middle
MOUNT_POINT= /chris
MIRROR_WRITE_CONSISTENCY= on/ACTIVE
LV_SEPARATE_PV= yes
PERMISSION= read/write
LV_STATE= opened/syncd
WRITE_VERIFY= off
PP_SIZE= 256
SCHED_POLICY= parallel
---> PP= 20
BB_POLICY= relocatable
RELOCATABLE= yes
UPPER_BOUND= 32
LABEL= /chris
MAPFILE=
LV_MIN_LPS= 1
STRIPE_WIDTH=
STRIPE_SIZE=
SERIALIZE_IO= no
FS_TAG= vfs=jfs2:log=/dev/hd8:mount=true:options=rw:account=false
DEV_SUBTYP=
*** Note: The 'LV_SOURCE_DISK_LIST' has been reduced to one disk, the 'COPIES' value has been changed to reflect one copy, and the 'PP' value has been changed so that it is equal to the 'LPs' value.

5. Save the edited /image.data file with the following command:
*Hit the "Esc" button to exit 'input' mode, then type the following:
:wq!
Press to save and exit the file 

***Aside from the values specified in the documentation above, no other values in the /image.data file should be edited ***

6. At this point you can use the edited image.data file to do one of the following:
You can now use your newly edited image.data file to create a new mksysb to file, tape, or DVD..
Example :
To file or tape : place the edited image.data file in the / (root) directory and rerun your mksysb command without using the “-i” flag. If running the backup through SMIT, make sure you set the option “Generate new /image.data file?” to 'no'. (By default it is set to 'yes')

To DVD : Use the -i flag and specify the
of the edited image.data file. If running through SMIT specify the edited image.data file location in the “User supplied image.data file” field.
Within NIM you would create an 'image_data' resource for use with NIM to restore a mksysb without preserving mirrors.

____________________________________________________________________________

Creating a mksysb with an edited image.data file to tape or file 

1. Create a new /image.data file with the following command:
# cd /
# mkszfile
2. Break the mirror in the /image.data file as shown in the steps above

3. Move the edited image.data file to the root (/) directory

# mv /tmp/edited.image.data /image.data

3. Use the mksysb command to create a new mksysb with the /image.data file that has the broken mirror.

From command line:
To tape:
# mksysb /dev/rmt0
To file:
# mksysb /location/of/mksysb/file
***NOTE: DO NOT use the '-i' or '-m' flags. These flags will create a new /image.data file based upon the systems current configuration. This means that the mirrors will still be in tact in the mksysb. All other mksysb flags can be used.

- OR -

Using smit:

Use smit to create a mksysb:
# smit mksysb Back Up the System

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

[Entry Fields]
WARNING: Execution of the mksysb command will
result in the loss of all material
previously stored on the selected
output medium. This command backs
up only rootvg volume group.
* Backup DEVICE or FILE [/dev/rmt0] +/
Create MAP files? no +
EXCLUDE files? no +
List files as they are backed up? no +
Verify readability if tape device? no +
Generate new /image.data file? no + <--- nbsp="" p="">EXPAND /tmp if needed? no +
Disable software packing of backup? no +
Backup extended attributes? yes +
Number of BLOCKS to write in a single output [] #
(Leave blank to use a system default)
Location of existing mksysb image [] /
File system to use for temporary work space [] /
(If blank, /tmp will be used.)
Back up encrypted files? yes +
Back up DMAPI filesystem files? yes +
***NOTE: By default, the 'Generate new /image.data file?' selection is set to 'yes'. You must make sure to change this selection to 'no', as displayed in the example above.

____________________________________________________________________________

Creating an 'image_data' resource without preserving mirrors for use with NIM 

1. Transfer the /image.data file to the NIM master and store it in the location you desire. It is a good idea to place the file, or any NIM resource for that matter, in a descriptive manor.
Ex : /export/nim/image_data
This will ensure you can easily identify your "image_data" NIM resource file locations, should you have the need for multiple "image_data" resources.
Make sure your image.data filenames are descriptive also. A common way to name the file would be in relation to your clientname.
Ex : ClientA.imagedata

2. Run the nim command, or use smitty and the fast path ‘nim_mkres’ to define the file that you have edited using the steps above:

From command line on the NIM master:
# nim -o define -t image_data -a server=master -a location=/export/nim/image_data/ClientA.imagedata -a comments="image.data file with broken mirror for testlpar" mksysb_image_data
***NOTE: "mksysb_image_data" is the name I am giving the 'image_data' resource

Using smit on the NIM master:
# smit nim_mkres
--> select 'image_data' as the Resource Type
Define a Resource

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

[Entry Fields]
* Resource Name [mksysb_image_data]
* Resource Type image_data
* Server of Resource [master] +
* Location of Resource [/export/nim/image_data/ClientA.imagedata /
NFS Client Security Method [] +
NFS Version Access [] +
Comments [image.data file with broken mirror for testlpar]
Source for Replication [] +
3. Run the following command to make sure the 'image_data' resource was created:
# lsnim -t image_data

**The command will give output similar to the following:
mksysb_image_data resources image_data
4. Run the following command to get information about the 'image_data' resource:
# lsnim -l mksysb_image_data

**The command will give output similar to the following:
mksysb_image_data:
class = resources
type = image_data
comments = image.data file with broken mirror for testlpar
Rstate = ready for use
prev_state = unavailable for use
location = /export/nim/image_data/ClientA.imagedata
alloc_count = 0
server = master
____________________________________________________________________________

Using the 'image_data' resource to restore a mksysb without preserving mirrors using NIM 

1. Specify using the 'image_data' resource when running the 'bosinst' command from the NIM master:
From command line on the NIM master:
# nim -o bos_inst -a source=mksysb -a lpp_source= -a spot= -a mksysb= -a image_data= mksysb_image_data -a accept_licenses=yes ClientB 

- OR -

Using smit on the NIM master:

# smit nim_bosinst
>select the client to install
>select 'mksysb' as the type of install
>select a SPOT at the same level as the mksysb you are installing
>select an lpp_source at the same level than the mksysb you are installing
*NOTE: It is recommended to use an lpp_source at the same AIX Technology Level, but if using an lpp_source at a higher level than the mksysb, the system will be updated to the level of the lpp_source during installation. This will only update Technology Levels
Example:
You are using an AIX 5300-08 mksysb, you cannot use a 6.x lpp_source
This will not migrate the Version of AIX you are running to a higher Version
Example:
You are using an AIX 5300-08 mksysb and allocate a 5300-09 lpp_source – this will update your target system to 5300-09

>See below for example:

Install the Base Operating System on Standalone Clients

Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[TOP] [Entry Fields]
* Installation Target lucidbso
* Installation Type mksysb
* SPOT 5300_09_00_spot
LPP_SOURCE [5300_09_00_lpp] +
MKSYSB lucid_mksysb
BOSINST_DATA to use during installation [] +
IMAGE_DATA to use during installation [mksysb_image_data] + <--- nbsp="" p="">RESOLV_CONF to use for network configuration [] +
Customization SCRIPT to run after installation [] +
Customization FB Script to run at first reboot [] +
ACCEPT new license agreements? [yes] + <--- nbsp="" p="">Remain NIM client after install? [yes] +
Preserve NIM definitions for resources on [yes] +
this target?

FORCE PUSH the installation? [no] +

Initiate reboot and installation now? [no] +
-OR-
Set bootlist for installation at the [no] +
next reboot?

0 blogger-disqus:

Post a Comment