dropdown menu

MKSYSB:

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.

additional attributes:
-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.

for example:
^./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]
    ^./usr/local/stat/

    (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
PPSIZE= 128

(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
information.

(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.

------------------

38 comments:

  1. Thanks for finally writing about > Untitled < Liked it!
    my web site :: find out

    ReplyDelete
  2. after inserting volume 2 -> "Please insert the product media and press the ENTER key" what to do?.. I did not prepared such media...

    ReplyDelete
    Replies
    1. I have found this:
      "Please remove the mksysb media from the drive, insert the product media and press the ENTER key."

      At this point, with real media, you would eject the mksysb DVD (or CD) and insert the AIX installation DVD (or CD) number 1.

      Delete
  3. Hi , i am little confused between mksysb file name given at last in the location and object name , can you please differentiate.


    ReplyDelete
    Replies
    1. Hi, what I did, I created a usual mksysb. After that with "mkcd" command I converted that mksysb to an iso image format, so it can be loaded to a CD/DVD device. With this we can restore an AIX system from CD :-)

      Delete
  4. Hello ,WHen i have used mkcd to create the iso it is asking mount volume althoug im using only one mksysb please help

    ReplyDelete
    Replies
    1. what is the exact output? (When creating iso image, it will create a temporary fs, /mkcd...as far as I know)

      Delete
  5. Hi,

    After taking mksysb backup I am getting the below error on the SMIT screen,

    "0512-003 mksysb may not have been able to
    The messages displayed on the Standard Er archive some files.
    information. ror contained additional"

    But the status is OK, means these are any warnig message.
    Shall I use this mksysb backup image to restore the O.S.
    Can you suggest how to check the consistency of the mksysb backup after completing the backup, means whether the image is restorable or not??
    Can you please suggest.

    Thanks.

    ReplyDelete
    Replies
    1. Hi,
      If it is not written there which files are missing, you should check the log file of the mksysb, which files are missing. (If some temporary or log files, it usually not a problem, but if other it can be a problem.) An mksysb can be checked with "lsmksysb -lf " command, and you can restore some files from mksysb to check if it is workable (restore command example can be seen above.)

      Delete
  6. Hi Balaz
    how to find good mksysb or not ? (i have few mksysb backup's , how can i finalize which one has good mksysb image )

    ReplyDelete
    Replies
    1. Hi, please check my reply just above your question (May 11, 2013...)

      Delete
  7. Hello Balazs,

    first of all, thanks for running this amazing blog on aix .. way to go ..

    my query is .. i am trying to take rootvg backup in my testing environment not on a tape drive but on a file in hdisk. i used hdisk1 to create lv and created file system on top of it and mounted a directory named test.

    when i run the command mksysb -i -v /test/bakp

    the command runs but gives the following error:

    backup: 0511-432 A write error occurred: A file cannot be larger than the value set by ulimit.
    backup: 0511-079 The backup media may be damaged.
    Use a different disk to run the backup.
    0512-005 mksysb: Backup Completed.
    The backup command completed with errors.
    The messages displayed on Standard Error contained additional
    information.


    i changed ulimit to unlimited but still the problem persists...

    kindly advice ..

    thanks a ton in advance
    regards
    rahul

    ReplyDelete
    Replies
    1. Hello Rahul,

      Did you try logout and login again (new settings will be reloaded when you login.)
      If problem still exist, try to look around at the filesystem. If it is a JFS there probably are some limitations, try to use JFS2, or try to creata a large file by yourself, if it is work.

      Hope this helps,
      Balazs

      Delete
    2. Thanks Balazs,

      it worked.

      changing ulimits, logout .. login and changing file system to jfs2 worked in creating the backup on file.

      thanks a ton.

      regards
      rahul

      Delete
    3. Hi Rahul or Moderator.

      Im bit late in reply ...actually just going thru your comments about the mksysb backups.. i dont suggest changing the Ulimits while taking the mksysb backups. instead create a large enabled journal filesystem and type is jfs2 .. for mksysb backups. as it is recommended by IBM for files/images which are more than 2GB of size. also in most the environments you see mksysb backups will be automated to save a copy everyday. in that case we cannot keep on changing the ulimits as it is going to be a performance issue.

      Delete
  8. Hi ,

    your blog is great .. well i am experiencing error in mksysb

    Backing up 139478 files..............................
    6974 of 139478 files backed up (5%)..............................
    32484 of 139478 files backed up (23%)...................lseek: Illegal seek
    An internal packing error occurred: incorrect size
    ./var/adm/cron/log will not be backed up.

    like this can u help me out

    ReplyDelete
    Replies
    1. Hi, there is some problem with that /var/adm/cron/log file. Check it out if everything is OK with it (if you can read that file), or you can reduce its size to 0 with "> /var/adm/cron/log". Hope this helps.

      Delete
    2. i tried it ...actually mksysb will not work for file which have running logs ...for example during the time of mksysb /log is keep on increasing due to application ..so mksysb will not take backup for tht file log ...i skipped it file and run it again it worked

      Delete
  9. Hello,
    I am trying to take MKDVD on a filesystem. I dont have enough pp in rootvg so I have created a file system /mksysb/tsmmksysb (25GB)on otherVG(which comes from SAN) and I mentioned this file system name in smitty mkdvd

    File system to store final DVD images [/mksysb/tsmmksysb]
    (If blank, the file system
    will be created for you.)

    df output:
    Filesystem GB blocks Free %Used Iused %Iused Mounted on
    /dev/hd4 0.38 0.30 20% 3703 5% /
    /dev/hd2 7.00 3.20 55% 53222 7% /usr
    /dev/hd9var 0.38 0.19 50% 3369 7% /var
    /dev/hd3 2.00 1.14 43% 1401 1% /tmp
    /dev/fwdump 0.12 0.12 1% 4 1% /var/adm/ras/platform
    /dev/hd1 2.12 1.71 20% 403 1% /home
    /proc - - - - - /proc
    /dev/hd10opt 4.00 0.52 88% 45564 25% /opt
    /dev/fslv01 44.00 2.53 95% 22 1% /tsm
    /dev/hd11admin 0.12 0.12 1% 5 1% /admin
    /dev/livedump 0.25 0.25 1% 4 1% /var/adm/ras/livedump
    /dev/fslv02 1.00 1.00 1% 47 1% /audit
    /dev/fslv03 5.50 0.48 92% 9 1% /tsmdbbk

    LSVG ROOTVG
    lsvg -l rootvg
    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 56 56 1 open/syncd /usr
    hd9var jfs2 3 3 1 open/syncd /var
    hd3 jfs2 16 16 1 open/syncd /tmp
    hd1 jfs2 17 17 1 open/syncd /home
    hd10opt jfs2 32 32 1 open/syncd /opt
    fwdump jfs2 1 1 1 open/syncd /var/adm/ras/platform
    fslv01 jfs2 352 352 1 open/syncd /tsm
    hd11admin jfs2 1 1 1 open/syncd /admin
    livedump jfs2 2 2 1 open/syncd /var/adm/ras/livedump
    fslv02 jfs2 8 8 1 open/syncd /audit
    fslv03 jfs2 44 44 1 open/syncd /tsmdbbk



    but when I execute its gving me below error. kindly suggest


    Command: failed stdout: yes stderr: no

    Before command completion, additional instructions may appear below.

    Initializing mkcd log: /var/adm/ras/mkcd.log...
    Verifying command parameters...
    Creating image.data file...

    0512-329 mkcd: User specified CD or DVD file system: /mksysb/tsmmksysb/
    needs an additional 42136858504 bytes.
    Cleaning up...

    ReplyDelete
    Replies
    1. Hi, it says you don't have enough space in /mksysb/tsmmksysb/. Please check manual of mkdvd command, because it says, the whole rootvg will be backed up, not just 1 filesystem.

      Delete
  10. Great articles, but I have few questions for mksysb restore, for example, I have hdisk1 and 2 for rootvg and hdisk3 and 4 for datavg and my system crash and I need to restore the server from mksysb, when I allocate the resources(mksysb and spot) on nimserver and the restoration start, it will restore over hdisk1 and 2 which was my rootvg or is there any risk to it overwritten datavg? mksysb restore is intelligent to know in which disks the image must be restored?
    Other question if my mksysb image is invalid and I want to use a mksysb image from other server and the vg structure is different, the mksysb restore will be able to restore over correct rootvg disks or do I need to perform any additional configuration?

    ReplyDelete
    Replies
    1. Hi, it is intelligent enough, but at the beginning of the restore you have a possibility to choose which disks to use, if system cannot decide properly. If you use mksysb of an other system, it should work...but in this case you can think of a clean new install as well.

      Delete
    2. I am little late to reply to this post. I just want to add or know If you use the mksysb of another system, don't you have to change the IP address and stuff after the installation, because it will bring the /etc from a different server . NO?

      Delete
  11. Hello,

    Thank you for your website.

    I have a question about a MKSYSB and SPOT.

    So firstly i create my MKSYSB. DONE

    Next, I create my SPOT on my resource MKSYSB with this command :

    #nim –o define –t spot –a source=MKSYSB-host –a server=master –a location=/spot spot61

    Now all it's OK. I have my MKSYSB and my SPOT. I'm happy ;).

    So my problem begin at the moment where i want recreate a new mksysb.

    The script who create the new mksysb begin by to delete the old resource mksysb and this return

    "0042-367 m_rmbosi : This mksys...cannot be removed beacause ... the following extracted SPOT is associated...."

    So, i can't create my new MKSYSB.

    Can i detach my SPOT from my MKSYSB ? Do you have a solution ?

    Thanks by advance.

    SAB



    ReplyDelete
    Replies
    1. Hello, I don't know how to detach, but first would be good to know why are you creating spot from an mksysb. What is your purpose with that? That spot can be used only with that mksysb, so if you would like to delete mksysb your spot will be useless. You should create a spot from an lpp_source which can be used generally.

      Delete
    2. Thank you so much for your response. I will follow your procedure. Your are right, it is more logical to create a spot from lpp_source.

      Delete
  12. Hi, I created a mksysb and spot from it, when tried to restore the image got LED 608. After running the debug on SPOT found error tftp/udp is not a known service. I checked the client LPAR and added tftp in it's /etc/services file, recreated mksysb and spot off of it and this time it went through. My question is that is it possible to edit existing mksysb images so that to add tftp info in their /etc/services file? Thank you.

    ReplyDelete
    Replies
    1. Hi, I think it is not possible....you can extract files from mksysb but I don't know any methods of loading those back. Other solution is if you set which customization script to run after restore.

      Delete
  13. Hi,
    Thank You for your detailed explanation.

    I have one question regarding mksysb, when i try to create mksysb image i am getting below error. please help me.

    root@viwser:/> mksysb -i -e /nimbak/viwldcog2.rootvg.20Aug13

    Creating information file (/image.data) for rootvg.

    Creating list of files to back up.lsfs: 0506-915 No record matching /var/perf/pm was found in /etc/filesystems.


    Backing up 108131 files.........................backup: 0511-449 An error occurred accessing ./opt/Tivoli/lcf/dat/1/LCFNEW/Tmw2k/Unix/data/ITMLogger/dblogger_cloud/log/log38013.dat: A file or directory in the path name does not exist.
    .....
    27731 of 108131 files (25%).............

    0512-003 mksysb may not have been able to archive some files.
    The messages displayed on the Standard Error contained additional
    information.
    root@viwser:/>

    ReplyDelete
    Replies
    1. Hi,

      probably in the mentioned directory there was a temporary file which is not there anymore or it is locked. Try mksysb again if same error (with same path), then put in exclude list mentioned directory (or file).

      Delete
  14. Hello

    first of all thanks for the great blog...I have aquestion I ran this command:

    chuser nofiles_hard=-1 user1

    I restart system, checked /etc/security/limits file and I see taht user1 has nofiles_hard=-1

    but when Iget in with user1 I try ulimit -n I get 1024 if I try to change it to ulimint -n unlimited I get

    The specified value is outside the user's allow

    any ideas?

    thanks in advance

    ReplyDelete
  15. How to find old mksysb image is 100% successful or fine image to restore

    ReplyDelete
  16. Good morning,
    We are using IBM p5 and p6 servers. For mksysb backup, the system is taking almost 24 hrs to 30 hrs time.
    Why this much time is taking....
    If we are operating remote servers, then any network failure causes to restart fresh backup again....

    Thanks for great support through this site.

    ReplyDelete
  17. What a nice website. With good information and nice people.

    ReplyDelete
  18. NIM LED Errorcode 608 is crazy, anyone can solve it?

    ReplyDelete
    Replies
    1. 608 says: Attempting to retrieve the client.info file with tftp. I would check if everything is OK with my tftp connection.
      http://aix4admins.blogspot.hu/2013/07/bootpd-this-is-initial-communication.html ("These could be checked regarding TFTP on NIM master" section.)

      Delete