This resource is a file containing the image of the root volume group (generated with the AIX mksysb command) of a machine. It is used to restore a machine, or to install it from scratch (also known as “cloning” a client).
creating mksysb from a nim client:
nim -o define -t mksysb -a server=master -a source=LPAR5 -a mk_image=yes -a location=/export/images/mksysb.lpar5 mksysb_lpar5
-o define Specifies the operation (defining the object).
-t mksysb Specifies that the object type is mksysb.
-a server=master Specifies that the server to hold this object (the mksysb image file) is the NIM master itself.
-a source=LPAR5 Specifies the NIM client to be used as the source the mksysb image, in this case, LPAR5.
-a mk_image=yes Specifies that the mksysb image file should be created.
-a location=/export/images/mksysb.lpar5 Specifies the path and filename for the mksysb image file.
mksysb_lpar5 Specifies the NIM object name for this mksysb image.
-a verbose=2 it will show more detailed progress view
-a size_preview=yes shows the size
-a mksysb_flags=T specifies mksysb options described in the mksysb man page. (lsnim -Pa mksysb_flags)
Here: [-T] use jfs2 filesystem snapshots.
checking the size of an mksysb before creating it:
nim -o define -t mksysb -a server=master -a source=LPAR5 -a size_preview=yes -a mk_image=yes -a location=/nim/mksysb.lpar5 mksysb_lpar5
mkszfile and image.data:
The image.data file, being responsible for rebuilding the system structure during mksysb restore. If you added somme new filesystems to the system, but image.data has not been updated, then it has no knowledge of the added filesystems. What will happen during an mksysb resore, is all of that extra data will be put into your / (root) filesystem. It will likely fill up to 100%, and your mksysb restore will fail.
If you create your mksysb backups in smit, the default option is already set to run mkszfile command so your image.data file will be updated. When running a mksysb from command line you use the '-i' flag to make sure the /image.data file gets updated. Alternately you can execute it manually (mkszfile)
remove an mksysb image smitty nim --> Perform NIM Admin. --> Manage resources --> Remove a resource (remove mksysb image: yes)
nim -o remove aix40 remove a resource (it won't do any mksysbs about that system in the future)
(smitty nim-> manage machines ->change show machines ->remove machine)
lsmksysb -l -f /path/to/nim_file verifying an mksysb (or smitty nim_verify_res )
listvgbackup lists or restores the content (or a file) of an mksysb
(listvgbackup -lf <mksysbname>, is the same as lsmksysb -lf <mksysbname>)
extracting a file from an mksysb:
cd /tmp <--the file will be extracted here
restore -xvqf /nim/mksysb/mksysb_aix21.1224 ./bosinst.data <--bosinst.data file will be extracted from mksysb_aix21...
with other command:
listvgbackup -f /nim/mksysb/m_aix10_5200-08_110412 -r -s -d /tmp/bb ./sbin/rc.d <--copy from mksysb the directory /sbin/rc.d to /tmp/bb
Excluding files from mksysb:
If you want to exclude certain files from the backup, create the /etc/exclude.rootvg file on the client and enter the patterns of file names that you do not want included in your system backup image.
^./tmp/ it will backup /tmp, but not the content of it (at restore an empty /tmp will be created)
(exclude the contents of /tmp and avoid excluding any other directories which have /tmp in the pathname)
^./tmp it won't backup /tmp at all (at restore an empty /tmp won't be created)
/temp/ exclude the contents of every /temp/ directory on the system ("^." makes the exclude start from / and look for your path)
old$ $ indicates that the search should end at the end of the line
or on the master:
1. edit exclude file (on master):
root@aixnim1: /nim/lppsource # vi exclude.aix31
"exclude_aix31" [New file]
(in this way the empty filesystems will be backed up, just the files under it will not be backed up)
(the file should be created in a dir which is exported, so client can mount it)
2. creating the exclude_files NIM object
nim -o define -a verbose=2 -t exclude_files -a server=master -a location=/nim/lppsource/exclude.aix31 exclude_aix31
3. using exclude_files when creating mksysb image
nim -o define -t mksysb -a server=master -a source=aix31 -a mk_image=yes -a location=/nim/mksysb/mksysb_aix31_test -a exclude_files=exclude_aix31 mksysb_aix31_test
0042-304 m_mkbosi: Unable to obtain the space allocation lock...
This type of error usually occurs when a NIM define operation has been halted abruptly such as with a control-C.
In my case mksysb creation has been halted abruptly, and after I killed the stucked mksysb processes the lock was cleared automatically and I was able to do a new mksysb.
I have found this on the net:
"When NIM defines objects such as a mksysb, SPOT, or LPP, NIM puts a lock in /var/adm/nim/.
To fix, on the NIM master, make sure there are no NIM operations running other than nimesis.
Run lsnim -a locked to see which NIM object has the locks.
Remove lock in /var/adm/nim and run /usr/lpp/bos.sysmgt/nim/methods/m_chattr -a locked="" <NIM object> to clean up the NIM db entry."
0042-207 m_mkbosi: Unable to allocate the exclude_nim resource to machine
Always check the following:
# lsnim -l [machine]
if you see already allocated resources like spot or mksysb image, then you must [reset] the machine and remove the resources if those are not currently used:
# nim -F -o reset [machine]
# nim -o deallocate -a exclude_files=exclude_nim [machine] <--with the correct resource
If that does not help check the following things:
- rsh connection from NIM master to client (in case of errors check [.rhosts] [/etc/hosts.allow] [/etc/hosts.deny] files)
- can the client reach the exported NIM master NFS directory
- on the client: does the NIM master defined correctly in /etc/hosts?
- check route settings on NIM master
- in case you have multiple LPARs and only one produce this error, compare the failed node to the others.
0042-274 m_mkbosi: The '-e' flag in the mksysb_flags attribute and the exclude_files attribute cannot be specified together.
Specify the '-e' flag with the mksysb_flags attribute to
exclude the files in /etc/exclude.rootvg on aix41 from
the backup, or specify an exclude_files attribute.
Always check the following:
# lsnim -l [machine]
if you see already allocated exclude_files resource, then you must [reset] the machine and remove the resource if that is not currently used.
# nim -F -o reset [machine]
# nim -o deallocate -a exclude_files=exclude_nim [machine]
mksysb restore from VIO server with use of image.data
We want to change PP size of rootvg, and for this we will create an image.data file and mksysb what will be restored.
1. create image.data file and change PPSIZE line:
root@bb_lpar: / # mkszfile
root@bb_lpar: / # vi /image.data
(it was PPSIZE= 64, whaat we changed to 128)
2. create an mksysb (and use the updated image.data)
root@bb_lpar: / # mksysb /bb/bb_lpar.mksysb
Creating list of files to back up.
Backing up 76740 files.............................
0512-003 mksysb may not have been able to archive some files.
The messages displayed on the Standard Error contained additional
(if you omit the -i parameter with mksysb it will use our updated image.data and won't create a new one)
(I have recieved this output, but it did not cause any problem for me; you can check mksysb with lsmksysb command)
3. creating iso image from mksysb:
root@bb_lpar: /bb # mkcd -L -S -I /bb/image -m /bb/bb_lpar.mksysb
Initializing mkcd log: /var/adm/ras/mkcd.log...
Verifying command parameters...
Creating temporary file system: /mkcd/cd_fs...
Populating the CD or DVD file system...
Building chrp boot image...
Copying backup to the CD or DVD file system...
-L creates DVD sized images (up to 4.38 GB).
-S stops mkcd before writing to DVD without removing the created images
-I specifies the directory where to create the image
-m specifies a previously created mksysb image (-m will not create a new mksysb file)
Other useful flags:
-M specifies the target dir for the new mskysb file when not using -m
-T use jfs2 external filesystem snapshot to create the mksysb
4. renamig the image to a more meaningful name and copying it to the VIOS virtual media library
root@bb_lpar: /bb/image # mv cd_image_8323206 bb_lpar_mksysb.iso
root@bb_lpar: /bb/image # scp bb_lpar_mksysb.iso aix-vios1:/var/vio/VMLibrary
5. (creating virtual optical device if needed) and loding the iso image to it
padmin@aix-vios1 : /home/padmin # loadopt -vtd vtopt0 -disk bb_lpar_mksysb.iso
After rebooting the AIX server, from this mksysb iso image system can be restored.