Saturday, April 4, 2015

Backup to a remote tape device



The scenarios is as follows:

Machine A : We need to take an mksysb image on a tape. The tape should be bootable. The machine does not have access to a tape drive.

Machine B: Does have access to a tape drive and is connected to machine A via LAN.

Procedure:

A bootable tape as a result of mksysb contains 4 records (set of data).

Boot image - should contain all drivers from and for backed up server, so I reccomend to create own image for every backed up server (Doesnt take a lot of time anyway)
mkinsttape image - contains some install data and structure and mountpoints of rootvg
Dummy "Table of Content" record - not used, it is here only for some compatibility reasons
mksysb image - archive of rootvg files - the "core" part of tape
Steps: (our working directory on both servers will be /opt)

Machine A:

Create a bootable image on machine A:
Code:
bosboot -ad /dev/rmt0 -b /opt/1_bosboot.img

Mkinsttape image:
Code:
mkinsttape /opt/2_mkinsttape.img

create bosinst.data file
mkszfile

mksysb image:
Code:
mksysb -e -i -p /opt/4_mksysb.img #### with -e is for exluding files, it is optional only

Notice that the files are named in the order they will be written on the tape.
Copy the three resulting files: 1_bosboot.img, 2_mkinsttape.img, and 4_mksysb.img to machine B via FTP or SCP or whatever method.
Machine B:

Prepare the tape
Code:
chdev -l rmt0 -a extfm=yes

Rewind it
Code:
tctl -f /dev/rmt0 rewind

Change the block size to 512
Code:
chdev -l rmt0 -a block_size=512

Rewind it again
Code:
tctl -f /dev/rmt0 rewind

Write the first file
Code:
dd if=/opt/1_bosboot.img of=/dev/rmt0 bs=512 conv=sync

Rewind the tape
Code:
tctl -f /dev/rmt0 rewind

Position the writer to write after the first file:
Code:
tctl -f /dev/rmt0.1 fsf 1 ## Notice that we used the non-rewindable device rmt0.1 rather than the normal one rmt0

Write the second file:
Code:
dd if=/opt/2_mkinsttape.img of=/dev/rmt0.1 bs=512

Rewind
Code:
tctl -f /dev/rmt0 rewind

Position the writer to write after the second file:
Code:
tctl -f /dev/rmt0.1 fsf 2

Create and save the dummy TOC to tape (required by bootable tapes):
Code:
echo "Dummy tape TOC" | dd of=/dev/rmt0.1 bs=512 conv=sync

Rewind:
Code:
tctl -f /dev/rmt0 rewind

Position the writer to write after the third file:
Code:
tctl -f /dev/rmt0.1 fsf 3

Write the final file:
Code:
dd if=/opt/4_mksysb.img of=/dev/rmt0.1 bs=512

Eject the tape and you're done.

Tuesday, December 30, 2014

Breaking mirrors on an existing mksysb

To restore a mksysb without mirroring. the following procedure can be used

NOTE: Access to another AIX system and an AIX formatted diskette is required to perform this procedure.

 All references to the tape device in the next section are as rmt0.

  • On another AIX system, place the mksysb tape in the tape drive. Change the block size of the tape drive to 512 by running:
  •            chdev -l  rmt0 -a block_size=512
     
    
  • Create a temporary directory in /tmp called newdata.
  •  
  •            mkdir /tmp/newdata 
    
  • Change to the /tmp/newdata directory. Enter:
  •  
  •            cd  /tmp/newdata 
     


  • Make sure that the tape is rewound. Enter:
  •            tctl -f /dev/rmt0 rewind 
     
  • Restore the image.data file from the second image of the mksysb tape. Enter:
  •            restore -s2 -xqvf  /dev/rmt0.1  ./image.data 
     
  • Edit the /tmp/newdata/image.data file and make changes to each of the lv_data stanzas as indicated in the examples that follow. The lines that need changes are marked by --> and are boldfaced. In Example 4, the changes are made to those lines.
  •   To view and edit the file, enter:
               vi  image.data 
    Example 1 
    
                       lv_data: 
                               VOLUME_GROUP= rootvg 
                               LV_SOURCE_DISK_LIST=  hdisk0 
                               LV_IDENTIFIER= 00000001113f3c62.5 
                               LOGICAL_VOLUME= hd4 
                               VG_STAT= active/complete 
                               TYPE= jfs 
                               MAX_LPS= 512 
                       -->     COPIES = 2   
                               LPs = 120   
                               STALE_PPs= 0 
                               INTER_POLICY= minimum 
                               INTRA_POLICY= center 
                               MOUNT_POINT= / 
                               MIRROR_WRITE_CONSISTENCY= on 
                               LV_SEPARATE_PV= yes 
                               PERMISSION= read/write 
                               LV_STATE= opened/syncd 
                               WRITE_VERIFY= off 
                               PP_SIZE= 4 
                               SCHED_POLICY= parallel 
                       -->     PP = 240   
                               BB_POLICY= relocatable 
                               RELOCATABLE= yes 
                               UPPER_BOUND= 32 
                               LABEL= / 
                               MAPFILE= 
                               LV_MIN_LPS= 68 
    
    Example 2
                       lv_data: 
                               VOLUME_GROUP= rootvg 
                               LV_SOURCE_DISK_LIST=  hdisk0 
                               LV_IDENTIFIER= 00000001113f3c62.5 
                               LOGICAL_VOLUME= hd4 
                               VG_STAT= active/complete 
                               TYPE= jfs 
                               MAX_LPS= 512 
                       -->     COPIES = 1   
                               LPs = 120   
                               STALE_PPs= 0 
                               INTER_POLICY= minimum 
                               INTRA_POLICY= center 
                               MOUNT_POINT= / 
                               MIRROR_WRITE_CONSISTENCY= on 
                               LV_SEPARATE_PV= yes 
                               PERMISSION= read/write 
                               LV_STATE= opened/syncd 
                               WRITE_VERIFY= off 
                               PP_SIZE= 4 
                               SCHED_POLICY= parallel 
                       -->     PP = 120   
                               BB_POLICY= relocatable 
                               RELOCATABLE= yes 
                               UPPER_BOUND= 32 
                               LABEL= / 
                               MAPFILE= 
                               LV_MIN_LPS= 120 
     
     In Example 2 the COPIES value has been changed to 1 and  
         the PP value is set equal to the LPs value. 
     Make these changes to each of the 
         lv_data stanzas in the image.data file. Once the changes are made, 
         save the file and exit.
    
    1. After making the changes to the image.data file, create a signature file. The signature file is required by the restore procedure.
    2.            echo data > signature 
       
    3. Format the diskette.
    4.            format /dev/rfd0 
       
    5. Back up the two files (image.data and signature) to the diskette drive.
    6.            find . -print |backup -iqvf /dev/rfd0 
       
    7. Verify that the two files were backed up and that the diskette can be read.
    8.            restore -Tqvf /dev/rfd0 
       
    9. Reboot the target system off of the mksysb tape with the diskette in the floppy drive and follow the normal mksysb restore procedures. The edited version of the image.data file will be used to recreate the logical volumes without mirroring.
     
    
    
  • Creating a mksysb without mirroring


    Creating a mksysb without mirroring

    If the ability to retrun the mksysb is available, the following procedure will allow you to create a mksysb without preserving mirroring.

     To create a new image.data file, run the following command:

     mkszfile

     Change into the / directory and vi the image.data file. Enter:

    cd /

    vi image.data

     The following examples show an lv_data stanza of an image.data file. The first example is with mirroring, while the second example shows the edited version without mirroring. The lines that need changes are marked by --> and are boldfaced. In the second example, the changes are made to those lines.

           To view and edit the file,enter:

     vi image.data

    Example 1

        lv_data:
                    VOLUME_GROUP= rootvg
                    LV_SOURCE_DISK_LIST= hdisk0
                    LV_IDENTIFIER= 00000001113f3c62.5
                    LOGICAL_VOLUME= hd2
                    VG_STAT= active/complete
                    TYPE= jfs
                    MAX_LPS= 512
            -->  COPIES = 2
                   LPs = 70
                   STALE_PPs= 0
                   INTER_POLICY= minimum
                   INTRA_POLICY= center
                   MOUNT_POINT= /usr
                   MIRROR_WRITE_CONSISTENCY= on
                   LV_SEPARATE_PV= yes
                   PERMISSION= read/write
                   LV_STATE= opened/syncd
                   WRITE_VERIFY= off
                   PP_SIZE= 4
                   SCHED_POLICY= parallel
            --> PP = 140
                  BB_POLICY= relocatable
                  RELOCATABLE= yes
                  UPPER_BOUND= 32
                  LABEL= /usr
                  MAPFILE=
                  LV_MIN_LPS= 68

    Example 2

     lv_data:
                  VOLUME_GROUP= rootvg
                   LV_SOURCE_DISK_LIST= hdisk0
                   LV_IDENTIFIER= 00000001113f3c62.5
                   LOGICAL_VOLUME= hd2
                  VG_STAT= active/complete
                  TYPE= jfs MAX_LPS= 512
           --> COPIES = 1 LPs = 70
                 STALE_PPs= 0
                 INTER_POLICY= minimum
                 INTRA_POLICY= center
                 MOUNT_POINT= /usr
                 MIRROR_WRITE_CONSISTENCY= on
                 LV_SEPARATE_PV= yes
                 PERMISSION= read/write
                 LV_STATE= opened/syncd
                 WRITE_VERIFY= off
                 PP_SIZE= 4
                 SCHED_POLICY= parallel
          --> PP = 70
                BB_POLICY= relocatable
                RELOCATABLE= yes
                UPPER_BOUND= 32
                LABEL= /usr
                MAPFILE=
                LV_MIN_LPS= 68

    In Example 2 the COPIES value has been changed to 1 and the PP value is set equal to the LPs value. Make these changes to each of the lv_data stanzas in the image.data file. Once the changes are made, save the file and exit.

    Run another mksysb from the command line that will utilize your edited image.data file. mksysb /dev/rmtX (where X is the number of your tape drive)

     WARNINGS:

    Do not run the mksysb in SMIT because this will update the image.data file and overwrite any changes made.

    Do not run the mksysb with the -i flag because this will update the image.data file as well.

    Thursday, June 26, 2014

    NTP Sync. Problem


    ntpdate[331858]: the NTP socket is in use, exiting Stop ntp daemon :> stopsrc -s xntpd Try to update again:> ntpdate pool.ntp.org Start ntp daemon :> startsrc -s xntpd

    Sunday, December 2, 2012

    Installing and configuring the storage agent (AIX)

    The storage agent must be installed on a client system that has connections to storage resources on the SAN.

    Before beginning this procedure:
    • Verify that your system meets the hardware and software requirements.
    • Be sure that you have the information recorded in the configuration-information work sheets.
    • Close all existing Tivoli® Storage Manager products prior to installing the storage agent. Installation will stop if an active Tivoli Storage Manager process is detected. If this occurs, close all active Tivoli Storage Manager products and retry installing the storage agent.
    The storage agent honors the Tivoli Storage Manager server environment variables DSMSERV_CONFIG.
    The instructions in this section are shown using the Software Management and Installation Tool (SMIT). You can also use the Install and Update Software Manager (installm). To reduce workload and processing time and to optimize LAN-free performance, do not install the storage agent and the Tivoli Storage Manager server on the same system.
    To install and configure the storage agent:
    1. Log in as the root user.
    2. Insert the storage agent CD into the selected drive. For example: /dev/cd0.
    3. From your desktop, access SMIT and make selections according to the level of your AIX® operating system:
      1. Enter smit install_update &
      2. Select:
        Install Software
          Install Software
    4. On the next window, select the device that you are using for the installation. You can enter the drive name in the window or click List to access the device list. If you click List, select the CD drive that you are using for the installation.
    5. Click OK.
    6. Locate the line Software to Install. Before proceeding, review the software listed in the table.
      Table 1. Package and fileset names for AIX 5.3 ML6 SP2
      Package and fileset names Description
      tivoli.tsm.StorageAgent Storage agent common functions, sample dsmsta.opt file
      tivoli.tsm.gsksa.rte Encryption and Secure Socket Layer (SSL) capabilities in the storage agent
      tivoli.tsm.devices SCSI-runtime device support
      tivoli.tsm.devices.msg.xx_XX SMIT windows
      tivoli.tsm.server.msg.xx_XX.server Message catalog and online help
      The variable xx_XX represents the country code for the language contents of the package.
      • To install all components in the table, continue at step 8.
      • To selectively install components, click List for the latest available software packages and select the components that you need. Required components are the storage agent and the message package to be used by the storage agent. The Tivoli Storage Manager device driver is only required if you are using a SCSI device that is not covered by an IBM® SCSI device driver. For a list of devices supported by the Tivoli Storage Manager SCSI device driver, refer to the Tivoli Storage Manager product support Web site.
    7. Click OK.
    8. Check the default settings for the options on this window.
    9. Click OK. SMIT responds:
      ARE YOU SURE?...
    10. Click OK. This installation can take several minutes.
    11. After the installation is complete, click Done , remove the CD, and exit SMIT.
    12. Ensure that the DEVCONFIG option is specified in the storage agent options file (dsmsta.opt). For example, for a device configuration file named devconfig.out located at /usr/tivoli/tsm/StorageAgent/bin, edit the dsmsta.opt file and enter the following line: DEVCONFIG devconfig.out
    13. Use the information that you collected in the configuration-information work sheets to issue the DSMSTA SETSTORAGESERVER command. For example:
      dsmsta setstorageserver myname=storagnt mypassword=fun4me
      myhladdress=agent.example.com
      servername=tsmsrver serverpassword=not4u
      hladdress=tsmsrver.example.com lladdress=1502
      The HLADDRESS must match the TCPSERVERADDRESS located in the dsm.sys file on the Tivoli Storage Manager client. When configuring the storage agent using the DSMSTA SETSTORAGESERVER command, use addresses that correspond to the communications method used by the backup-archive client. The backup-archive client supports either IPv4 (COMMMETHOD TCPIP) or IPv6 (COMMMETHOD V6TCPIP), but not both at the same time. The command generates the following lines in the device configuration file for the storage agent:
      set staname storagnt
      set stapassword xxxxxxx
      set stahladdress agent.example.com
      define server tsmsrver serverpassword=xxxxxxxxxxx
       hladdress=tsmsrver.example.com lladdress=1502
      The passwords (shown as xxxxxxxxxxx) are encrypted in the file.
      The command also generates the following line in the dsmsta.opt file: SERVERNAME tsmsrver
    The default installation directory is /opt/tivoli/tsm/StorageAgent/bin.

    Create/rebuild a new .Xauthority file

    <div dir="ltr" style="text-align: left;" trbidi="on">
    This document describes the procedure for rebuilding a /$HOME/.Xauthority file. The information in this document applies to AIX 5.1 and higher.


    If you get an MIT magic cookie error when trying to gain remote access the CDE or Xdm, you may be able to solve the problem by rebuilding the .Xauthority file in the home directory of the user trying to log in.

    Follow these steps to create a /$HOME/.Xauthority file.

    Log in as user and confirm that you are in the user's home directory.


    Rename the existing .Xauthority file by running the following command

    mv .Xauthority old.Xauthority


    Generate a new .Xauthority file by running the following command:

    xauth generate :0 . trusted


    At the command line, create a new magic-cookie key by entering the following:

    randomkey=`/usr/bin/ksh -c 'echo $(( $RANDOM * $RANDOM * 2 ))'`


    Add a new entry for another server by running the following command:

    xauth add ${HOST}:0 . $randomkey


    To view a listing of the .Xauthority file, enter the following

    xauth list
    </div>

    Friday, February 17, 2012

    Xmanger does not work

    when i was trying to login by Xmanger give the following error

    usr/bin/X11/xauth: 1356-361 Timeout
    in locking authority file /home/user-name/.Xauthority

    the solution

    log to the server by command line and run the following command

    $ xauth -b "Attempting to break locks on authority file /.Xauthority
    Using authority file /.Xauthority"
    exit
    to test run xclock