Introducing SMIT

The powerful AIX System Management Interface Tool

Get an introduction to SMIT and how it's used. The System Management Interface Tool (SMIT) is an interactive application that simplifies virtually every aspect of AIX® system administration. By the end of this article, you'll agree that SMIT is the AIX systems administrator's best friend.

Sandor Sklar (ssklar@gmail.com), Freelance writer, Author

Sandor W. Sklar works as a UNIX Systems Administrator at Stanford University, in Palo Alto, California. He has been supporting AIX, Linux, and Solaris servers for eight years. You can contact him at ssklar@gmail.com.



26 September 2006

Also available in Chinese

What is SMIT?

The System Management Interface Tool (more commonly known as SMIT) is an interactive tool bundled with AIX®. Virtually any system administration-related task can be completed using a SMIT screen; the screens are logically grouped in a hierarchal manner for easy navigation. Fast paths associated with every function can be used to go directly to the relevant screen.

One of the best features of SMIT is that you can see exactly what commands it performs either before or after it runs those commands. SMIT doesn't use any special hooks into the operating system. Everything it does, it does through standard AIX commands and Korn shell functions. This feature is especially useful when you need to automate a repetitive task; you can have SMIT create the proper command-line sequence, and you can then use those commands in your own script.


Basic usage

SMIT is part of the base operating system; the actual /usr/bin/smit command is in the bos.sysmgt.smit fileset. There are actually two versions of SMIT: a full-screen text-mode version and a graphical X Windows® client. If the DISPLAY variable is set, AIX automatically runs the GUI version. To use the text-mode version -- even if your DISPLAY variable is set -- run the smitty command , or you can run smit -a.

When SMIT is started without a fast path specified, the main menu is displayed. In all SMIT screens, the arrow keys are used to move up and down through the choices displayed. The Return key selects the currently highlighted item. To go back one level, press F3 or Esc + 3.


The four screen types

There are four types of screens that SMIT uses to interact with and display information to the user: menus, dialogs, selectors, and command status screens.

Menus

A menu screen displays a list of tasks, only one of which can be selected. When no fast path exists at SMIT startup, the main menu is displayed (see Listing 1 for the text-mode version).

Listing 1. The main System Management screen, as seen in the text-mode version of SMIT
                               System Management

Move cursor to desired item and press Enter.

  Software Installation and Maintenance
  Software License Management
  Devices
  System Storage Management (Physical & Logical Storage)
  Security & Users
  Communications Applications and Services
  Print Spooling
  Problem Determination
  Performance & Resource Scheduling
  System Environments
  Processes & Subsystems
  Applications
  Installation Assistant
  Using SMIT (information only)
            
F1=Help             F2=Refresh          F3=Cancel           F8=Image
F9=Shell            F10=Exit            Enter=Do

Figure 1 shows SMIT's main menu in the GUI version of the tool.

Figure 1. The main System Management screen, as seen in the GUI version of SMIT
The main System Management screen, as seen in the GUI version of SMIT

Dialogs

A dialog screen results from the selection of a specific task. Various symbols indicate the type of information entry that each field accepts. The data that you enter into those fields are used to form the command that SMIT executes.

Listing 2. A SMIT dialog screen. Specifically, the Change/Show Characteristics of a User screen
               Change / Show Characteristics of a User

Type or select values in entry fields.
Press Enter AFTER making all desired changes.
  
[TOP]                                           [Entry Fields]
* User NAME                                    root
  User ID                                     [0]                     #
  ADMINISTRATIVE USER?                         true                   +
  Primary GROUP                               [system]                +
  Group SET                                   [system,bin,sys,securi> +
  ADMINISTRATIVE GROUPS                       []                      +
  ROLES                                       []                      +
  Another user can SU TO USER?                 true                   +
  SU GROUPS                                   [ALL]                   +
  HOME directory                              [/]
  Initial PROGRAM                             [/usr/bin/ksh]
  User INFORMATION                            [palatino root]
  EXPIRATION date (MMDDhhmmyy)                [0]
[MORE...37]

F1=Help             F2=Refresh          F3=Cancel           F4=List
F5=Reset            F6=Command          F7=Edit             F8=Image
F9=Shell            F10=Exit            Enter=Do

Selectors

A select screen requires the user to choose a target, usually a device that will be used in the subsequent dialog screen. Selectors usually appear as a pop-up window, overlaying the text from the previous screen.

Listing 3. A SMIT select screen, requesting the selection of a single Logical Volume
LOGICAL VOLUME name                            
                                                                          
 Move cursor to desired item and press Enter. Use arrow keys to scroll.   
                                                                          
 [TOP]                                                                    
   fslv00            jfs        64    128   2    open/syncd    /ora-dat 
   fslv01            jfs        64    128   2    open/syncd    /u06     
   fslv02            jfs        64    128   2    open/syncd    /u07     
   lv07              jfs        11    22    2    open/syncd    /SUL_ora 
   paging05          paging     32    32    1    open/syncd    N/A      
   fslv05            jfs        320   640   4    open/syncd    /u08     
   fslv06            jfs        24    48    2    open/syncd    /w01     
   fslv07            jfs        16    32    4    open/syncd    /local/a 
   lv11              jfs2       128   128   1    open/syncd    /mkcd/mk 
   fslv09            jfs        128   256   2    open/syncd    /u02     
 [MORE...51]                                                            
                                                                        
 F1=Help               F2=Refresh              F3=Cancel                
 Esc+8=Image           Esc+0=Exit              Enter=Do                 
 /=Find                n=Find Next

Command Status

The Command Status screen displays the output from the commands that SMIT executed. The top of the screen indicates the current status (Running, OK, or Failed), and it also shows whether there was anything written to STDOUT or STDERR.

Listing 4. A SMIT Command Status screen, displaying the output of the List Fileset Containing File
                           COMMAND STATUS

Command: OK            stdout: yes           stderr: no

Before command completion, additional instructions may appear below.

File                                  Fileset               Type
------------------------------------------------------------------
/usr/bin/smit                         bos.sysmgt.smit       File




F1=Help          F2=Refresh       F3=Cancel        Esc+6=Command
Esc+8=Image      Esc+9=Shell      Esc+0=Exit       /=Find 
n=Find Next

Navigation

Because of the hierarchal nature of SMIT's functions, it is fairly simple to drill down into the task you wish to accomplish. If you find that you've selected the wrong item from a menu, pressing F3 (or Esc + 3) brings you back to the previous screen.

Fast paths

Every menu and dialog screen in SMIT has a fast path that can be used to go directly to that screen. To determine the fast path for a particular screen, navigate to that screen, and then press F8 or Esc + 8. A pop-up window lists the fast path and puts a print of the current screen into the SMIT log file.

Listing 5. A SMIT select screen, requesting the selection of a single Logical Volume
             PRINT SCREEN                 

 Press Enter to save the screen image              
     in the log file.                                
 Press Cancel to return to the application.      

   Current fast path:                           
       "mkuser"                                   

F1=Help          F2=Refresh       F3=Cancel    
Esc+8=Image      Esc+0=Exit       Enter=Do

Shortcuts

SMIT has several key commands that can be used to quickly navigate through long, scrolling screens of output. While most useful in Command Status screens, these keystrokes work in all screens (see Table 1).

Table 1. Key command for navigation
KeystrokeAction
Down arrowScroll down one line
Up arrowScroll up one line
Control + V (or PageDown)Scroll down one page
Escape + V (or PageUp)Scroll up one page
Escape + > (or End)Jump to the bottom of the output or list
Escape + < (or Home)Jump to the top of the output or list

Logging

Every SMIT session records entries in two files: smit.log and smit.script. These files will be written to the directory specified by the value of the HOME environment variable (not to the actual home directory for the user as specified in /etc/passwd.)

SMIT never overwrites existing log files; it always tries to append to those files if they exist and can be written to by the current user. If SMIT cannot write to those files, it displays a warning, but it continues to function without logging.

Note that while any user can run the SMIT executable, many of the AIX commands it runs to perform the tasks requested of it do require root or other restricted privileges. If a non-authorized user attempts to complete one of these tasks, the task fails. Since SMIT is most commonly run by root, the SMIT log files should be monitored and cleaned up so that they don't grow unmanageably large and consume all available space in the / filesystem.

smit.log

The smit.log file contains detailed information about activity performed using SMIT. For each SMIT session, it logs the date and time SMIT started, a record of every menu screen visited (along with that screen's fast path), all commands executed by SMIT, and any output from those commands.

Monitoring smit.log might be useful in determining what changes have been made to the system and when those changes were made. That log file will not have any indication of changes made by running system commands directly, however.

smit.script

The smit.script file contains the actual AIX commands that SMIT runs in order to execute a task. The file is written in Korn shell syntax, so it can be executed as is; doing so repeats all of the tasks originally done through SMIT.

One common use of the smit.script is to duplicate a number of tasks across several systems. If SMIT is used to make all of the changes to one system, the smit.script can be copied to the other systems and executed, performing all of the system changes without writing a single line of code.


An example using a SMIT script

Let's now apply SMIT to a real-world AIX example. Imagine a situation in which you need to add a four gigabyte file system on ten, or one hundred, AIX systems. You could do this manually, though your hands would probably be tired at the end, and repetitive typing increases the chance of an error. You could put together the proper command, with all of the arguments and flags, and then run that on each system. Or, you could let SMIT write that command for you.

In the below example, use SMIT to create a four gigabyte Enhanced JFS (JFS2) filesystem to be automatically mounted at system restart on the mount point /fs01, using an inline JFS log. Then, copy the script that SMIT writes to the other systems, and run it to create the file systems there.

The first step is to start SMIT, using the command: smit -s /tmp/mknewfs.ksh crjfs2std. The -s flag tells SMIT to write its script output to the file /tmp/mknewfs.ksh, instead of the default file /smit.script. The activity will still be logged into /smit.log. By specifying the fast path crjfs2std, you jump directly to the Add an Enhanced Journaled File System dialog screen. Before that screen (shown in Listing 6) is displayed, you will be required to choose a Volume Group in which to create the new file system.

Listing 6. The Add an Enhanced Journaled File System SMIT dialog screen
Add an Enhanced Journaled File System

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

                                               [Entry Fields]
  Volume group name                          datavg
  SIZE of file system
          Unit Size                          Gigabytes    +
*         Number of units                   [4]           #
* MOUNT POINT                               [/fs01]
  Mount AUTOMATICALLY at system restart?     yes          +
  PERMISSIONS                                read/write   +
  Mount OPTIONS                             []            +
  Block Size (bytes)                         4096         +
  Inline Log?                                yes          +
  Inline Log size (MBytes)                  []            #
 
F1=Help          F2=Refresh       F3=Cancel      F4=List
F5=Reset         F6=Command       F7=Edit        F8=Image          
F9=Shell         F10=Exit         Enter=Do

After pressing Enter to have SMIT execute the commands above in Listing 6, the following script in Listing 7 will be written to the file /tmp/mknewfs.ksh.

Listing 7. /tmp/mknewfs.ksh.
#
#     [Sep 06 2006, 17:46:28]
#
x() {
LIST=
FLAG=0
for i in "$@"
do
        case "$i" in
        Megabytes)      FLAG=1;;
        Gigabytes)      FLAG=2;;
        512bytes)       ;;
        size=*) case "$FLAG" in
                1)      LIST="$LIST \"$i\"M"
                        FLAG=0;;
                2)      LIST="$LIST \"$i\"G"
                        FLAG=0;;
                0)      LIST="$LIST \"$i\""
                        ;;
                esac
                ;;
        *)      LIST="$LIST \"$i\""
                ;;
        esac
done
eval crfs -v jfs2 $LIST
}
x -g'datavg' 'Gigabytes' -a size='4' -m'/fs01' 
-A''`locale yesstr | awk -F: '{print $1}'`'' 
-p'rw' -a agblksize='4096' '-a logname=INLINE'

All that remains is to copy the above script to each of the remaining AIX systems, and to run it. There are numerous methods in which to do this. The simplest (though insecure) way to do this would be to loop through the systems, 'rcp'ing the script, and then use rsh to execute it (see Listing 8).

Listing 8. rcping the script and using rsh to execute it
For host in host1 host2 ... hostN; do \
rcp /tmp/mknewfs.ksh $host:/tmp/mknewfs.ksh ; \
rsh $host ksh /tmp/mknewfs.ksh ; \
done

This is just one example, but it illustrates the advantages and time savings of using SMIT as an AIX administrator.


Next steps

SMIT is a powerful tool for any AIX administrator. As with most tools, the best way to become familiar with its operation is to use it. It is important, though, to understand that SMIT does perform its actions on the live system, and there is no undo functionality. For some, but not all actions, SMIT issues a warning that it's going to permanently delete information, and it requires confirmation to continue.

A safer way to explore the SMIT application is by invoking it with the -x flag. When the -x flag is specified on the command line, SMIT appears to function normally, but it will not actually execute any commands. Instead, it writes to the smit.script file the commands it would have run under normal operation.

Many of the options and input fields on SMIT menu and dialog screens have a built-in help feature, accessible by using the arrow keys to highlight or select the item, and pressing F1 (or Esc + 1). If available, a detailed explanation of that item will be shown in a pop-up window.

Resources

Learn

Get products and technologies

  • IBM trial software: Build your next development project with software for download directly from developerWorks.

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into AIX and Unix on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=AIX and UNIX
ArticleID=163144
ArticleTitle=Introducing SMIT
publish-date=09262006