Raw vs JFS Logical Volumes I/O


Does Virtual Memory Manager (VMM) work with raw logical updates, and if so, how?
If raw logical volumes do not use block I/O buffer cache, does sync update raw logical volumes or does VMM?


When an application directly accesses a raw logical volume, the VMM is not involved. The VMM is involved when accessing the Journaled File System (JFS).
sync only updates JFS, so neither sync nor VMM updates raw logical volumes. All writes to raw logical volumes are synchronous, which means that the writes do not return until the data has made it to disk and therefore does not require a sync.


How to reduce the filesystem in aix

The following steps reduce the size of the /var or /tmp file system in all supported releases of AIX Versions 4 and 5. If either file system on your machine is 8192KB in size or smaller, you probably should not reduce it. The default size of the /var file system (on installation) is 4096KB, which fills up rather quickly. If you can afford the space, it is better to have /var be 8192KB total. The default size of the /tmp file system (upon installation) is 8192KB.

NOTE: Back up the data before proceeding. If you have a tape drive connected to your system, this can be achieved by executing the following sequence of commands on either /var or /tmp:

cd /
tar -cvf /dev/rmt0 /var

/dev/rmt0 can be replaced with /dev/fd0 or the full path of a directory NOT in the same file system.

Boot your system into a limited function maintenance shell (Service or Maintenance mode) from bootable AIX media.

Please refer to your system’s user’s or installation and service guide for specific IPL procedures related to the type and model of your system. Additionally, the document titled “Booting in Service Mode”, has specific procedures for most types of systems. The document is available at this location:


With bootable media of the same version and level as the system, boot the system into Service mode.
The bootable media can be any ONE of the following:

Bootable CD-ROM
NON_AUTOINSTALL, bootable mksysb
Bootable Install Tape
Follow the screen prompts or icons to the Welcome to Base OS menu.

Choose Start Maintenance Mode for System Recovery (Option 3). The next screen displays prompts for the Maintenance menu.

Choose Access a Root Volume Group (Option 1).
The next screen displays a warning that indicates you will not be able to return to the Base OS menu without rebooting.

Choose 0 continue.
The next screen displays information about all volume groups on the system.

Select the root volume group by number. The logical volumes in rootvg will be displayed with two options.

Choose Access this volume group and start a shell. (Option 1).
If you get errors from the preceding option, do not continue with this procedure. Correct the problem causing the error. If you need assistance correcting the problem causing the error, contact one of the following:

Local branch office
Your point of sale
Your AIX support center
If no errors occur, proceed with the following steps.

Unmount the file system. (The following examples use /var. If you intend to reduce the /tmp file system, substitute /tmp for /var in the commands.) Execute:
umount /var

Remove the file system by executing:
rmfs /var

Determine the physical partition (PP) size of your rootvg volume group with the command:
lsvg rootvg

Create the logical volume with one of these commands:
mklv -y hd9var rootvg [x]     (for /var)
mklv -y hd3 rootvg [x]           (for /tmp)

where x is the number of logical partitions you want to allocate. If your rootvg volume group has a PP size of 4MB, and you want the total size of the /var file system to be 8MB, then x would be 2. For example:

mklv -y hd9var rootvg 2

This command makes a logical volume hd9var of size 8MB (two 4MB partitions) in the rootvg volume group.

NOTE:The logical volume name used for the /tmp file system is hd3, and hd9var is the logical volume name used for /var. These names must be used if you wish to maintain your AIX system in an IBM supported state.

Create the file system with the following command:
crfs -v jfs -d hd9var -m /var -a check=false -a free=false -a vol=/var

NOTE: Substitute hd3 for hd9var and /tmp for /var if needed. Refer to the section Example of /etc/filesystems for the different attributes required for these filesystems.

Mount the file system:
mount /var        (OR    mount /tmp)

If you are recreating /var, now create the /var/tmp directory for the vi editor. Execute:
mkdir /var/tmp

Set your TERM variable and export it. If you are using a megapel display, try setting TERM=hft. If you are using an ASCII terminal such as an IBM 3151, set your TERM to the appropriate terminal type. For example:
export TERM

Edit /etc/filesystems. If you have been recreating /tmp, invoke the vi editor by executing the following command:
vi -c “set dir=/” /etc/filesystems

If you have not been recreating /tmp, execute:

vi /etc/filesystems

Skip down to the stanza for either /var or /tmp. Within that stanza, go to the line that says mount = false and change the word false to automatic. Save the file.

Change the ownership and permissions to the proper values, as follows:
chmod g-s /var
chmod 755 /var
chown bin.bin /var



> chmod g-s /tmp
chmod 1777 /tmp
chown bin.bin /tmp

Restore the files from your backup. If you used the backup method given earlier in this document, execute:
cd /
tar -xvf /dev/rmt0

Remove the bootable media if you have not already done so.

If your system has a mode select key, switch it to the Normal position.

Reboot the system into Normal mode with the following:


aix disks that are currently not being used

Lists SSA disks that are currently not being used by either the OS or other  applications.  Lists what size the disk is and which enclosure and slot the disk is located in.


printf “Please wait, this could take a while… nn”

for pdisk in `lsdev -Cc pdisk | awk ‘/SSA/{print $1}’`
hdisk=`ssaxlate -l ${pdisk}`
if [ “${hdisk}” ]
vg=`lspv |grep ${hdisk}| awk ‘{print $3}’| head -1`
vgstatus=`lsvg -o | grep “${vg}”`
if [ “${vgstatus}” = “${vg}” ]
diskinfo=`lspv -l ${hdisk}`

if [ ! “${diskinfo}” ]
size=`lsattr -El ${pdisk} | awk ‘/size_in_mb/{print $2}’`
slot=`lsdev -Cc pdisk | grep ${pdisk} | awk -F”-” ‘{print $3,$4}’ | head -1`
echo “${hdisk}: size=${size}”
echo “Location: ${slot}”

cron job tricks

A few weeks back, a user asked me about running an automated task
every other week. Though most of us use cron as needed to run those nice little tasks that clean up core files and evaluate the contents of log files in the middle of the night, running a task every other week or every other day presents a bit of a challenge. The cron command doesn’t have any way to express odd or even weeks.

The general “trick” that I use for tasks such as these is to ask cron to
run the task every week or every day and then insert logic into the
script itself to determine whether the week is odd or even.

Using this strategy, a cron entry that looked something like this:

8 8 * * 3 /usr/local/bin/send_msg

that would be executed every Wednesday might be calling a script that examines the date and continues only when it’s running on an odd or even week.

A shell (/bin/sh) script to send a message on even weeks might look
something like this:


WK=`date +%W`
ON_WK=`expr $WK % 2`

if [ $ON_WK = 1 ]; then
cat /opt/stats/msgs | mailx -s “stats report” someone@someplace.org

This same strategy can be used for tasks that need to be performed every other hour, every third week, every seven minutes or almost any other interval that you might want to work with. For intervals that align nicely with cron’s timing fields (minutes after the hour, hour, day of the month, month and day of the week, there’s no good reason not to put all of your timing logic into the cron file. When your needs don’t align well with these columns, on the other hand, or when you want to avoid putting lines like these into the cron file:

0,4,8,12,16,20,24,28,32,36,40,44,48,52,56 * * * * /usr/local/bin/chk_log

constraining the time within the script itself is not such a bad idea.

The number 2 in the “ON_WK=`expr $WK % 2`” line of the scrip represents the modulo operation. For anyone who isn’t used to these, the result of an “expr <number> % <modulus>” operation is what you’d be left with if you removed the modulus as many times as you could. Because our modulus is 2, the result is 0 or 1. Were the modulus 5, we could get any value between 0 and 4.

The “WK=`date +%W`” command uses an argument to the date command to obtain the number of the current week. You’d expect these to run from 1 to 52 or thereabouts. So the combination gives us a 1 if the current week is odd and a 0 otherwise.

Other date command options that can be used with this kind of logic

%d – date within the month (e.g., 21)
%m – month number (1-12)
%H – hour (0-23)
%M – minute (0-59)
%S – second (0-59)

To run a script every other day, you couldn’t rely on the day of the
month. This would only work for a while. You’d soon find yourself moving from one odd day to another. This would happen any time you got to the end of a month with 31 days. Instead, you would use the value that represents the day of the year. You’d expect these to run from 1 to 365 except, of course, on leap years.  If the end-of-the-year problem concerns you, you could probably perform some much more complex calculation to be sure you’re still running every other day but, for most of us, an adjustment at the end of each calendar year is probably not too big an issue. We could always switch our running from odd to even days if the need for regularity was sufficiently important.

Boot the IBM Aix system into Service mode

This document describes how to boot the system into Service mode (also known as Maintenance mode) to install the machine, restore an operating system backup, or perform maintenance on the rootvg volume group.

The information in this document applies to AIX Versions 3.x, 4.x and 5.x.

Booting microchannel systems into Service mode Booting  PCI-based systems into Service mode PCI machine-specific information Accessing rootvg and mounting file systems
Related documentation


Booting microchannel systems into Service mode

To boot microchannel systems into Service mode, turn the key to the Maintenance  position and press the yellow reset button twice. You must boot from bootable  media, such as an installation CD-ROM, installation tape, or a bootable backup  tape made via the mksysb command or the Sysback product of the correct level for  this  machine.

For AIX Version 3.2, you may use bootable bosboot diskettes. To boot from these,  insert the first bosboot diskette into the diskette drive. When you see LED c07,  insert the next diskette, which is usually the display extensions diskette.  After this diskette is read, you should receive a menu prompting you for the  installation diskette.

For information on accessing your rootvg volume group, see the section entitled  “Accessing rootvg and mounting file systems”.

The preceding discussion assumes that the Service mode bootlist has not been  modified from the default bootlist. If the bootlist has been modified, it must  be reset such that one of the boot media types from the preceding selections is  before the standard boot media, such asthe hard disk.

If the machine is an SMP model (7012-Gxx, 7013-Jxx, and 7015-Rxx) and the  Autoservice IPL flag is disabled, then a menu like the following will display  when it is booting in Service mode:


You can boot these machines into Service mode or even Normal mode with the Fast  IPL Flag set. If you do not, the machine can take anywhere from 30 to 60 minutes  to boot up. There are a few ways to set the Fast IPL Flag for these machines.

NOTE: The console must be an ASCII type and connected to the S1 port of the  system. Graphic monitors will not work.

Use the following instructions to boot SMP machines into service with Fast IPL set.

Insert the bootable media of the same OS Level. Use the mksysb/cd-rom command.
Turn off the machine by pressing the white button on front.
Turn the key to the Wrench or Service position.
The LCD should read STAND-BY.
Press the Enter key on the console.
A greater-than prompt (>) should display on the monitor.
Type in sbb followed by the Enter key.
The menu Stand By Menu should now display.
Select 1 Set Flags. This will take you to another set of menus.
Select 6 Fast IPL. This should change to enable after it is selected.
Enter x to exit the second set of menus.
Enter x to exit the first menu.
At a blank screen, press the Enter key to obtain the greater-than prompt (>).
Type in the word power followed by the Enter key.
Turn the machine back on. It should start to boot up. A prompt may display asking
if you want to update the firmware. Do not respond; let it continue.
Now you may be at the Maintenance Menu with 10 options displayed, 0 through 9. If
that is the case, select option 6, System Boot. This will take you to another
menu. Select option 0, Boot from the list.
The Standard Maintenance Menu should display. System recovery and maintenance
can be completed from here.
After system recovery and maintenance has been performed, the system is ready to
be rebooted into Normal mode. Enter the command mpcfg -cf 11 1 at the command
line prompt, then press Enter. This will set the Fast IPL Flag. The system is
ready to reboot.
Turn the key back to the OK/Normal position.
Enter shutdown -Fr, followed by the Enter key.


Booting PCI-based systems into Service mode

When booting a PowerPC into Service mode, cd0 or rmt0 must be before the hdisk in the bootlist. If not, change the bootlist at boot time. On some models, you can set the machine to use a default bootlist that includes both cd0 and rmt0. If a bootable CD or tape is in the CD-ROM or tape drive, the machine will boot from this device.

For most of the newer PCI-based models, selecting the default bootlist, with a bootable tape or CD loaded in the machine, causes the system to automatically boot from that device. Generally, the next menu on the screen asks the administrator to define the system console.

For all machines discussed here, if you are using a graphical terminal, you will use a function key such as F5. If you are using an ASCII terminal, use an equivalent number key such as 5. Use the numbers across the top of the keyboard, not the numbers on the numeric keypad. On ASCII terminals, the icons may not be displayed on the screen; the number can be pressed between the second and third beeps, the second beep being a series of three clicks.


PCI machine-specific information
The following systems all use the F5 or 5 key to read from the default boot list, which is written into the system firmware:

MODEL       7017       7024       7025       7026       7043       7137
——-   ——-    ——-    ——-    ——-    ——-    ——-
TYPE      S70        E20        F30        H10        43P-140    F3L
S7A        E30        F40        H50        43P-150
S80                   F50        H70        43P-240
B80        43P-260

On these machines, use 5 (on the keyboard, not the keypad) if you are using an ASCII terminal. On a locally attached graphics console, use the F5 function key. The F5 or 5 key must be pressed just after the keyboard icon or message is displayed on the console. If you have either a 7026-M80, 7026-H80 or a 7025-F80, then the 5 key will be the default whether you have an ascii or graphics console.

The following systems use the F1 key to enter System Management Services mode (SMS):

MODEL       6040       7042       7247       7249
——-   ——-    ——-    ——-    ——-
TYPE        620        850        82x        860

You should be in an Easy-Setup menu. Select the Start Up menu. Clear the current bootlist settings and then select the CD-ROM for choice 1 and hdd (the hard disk) for choice 2. Select OK. Insert the CD-ROM and select the EXIT icon. The machine should now boot from the CD-ROM.

The following systems use the F2 key to enter SMS:

MODEL         6015       6050       6070       7020       7248
——-     ——-    ——-    ——-    ——-    ——-
TYPE          440        830        850        40P        43P

Select Select Boot Device from the initial menu on the screen, and then select Restore Default Settings from the list. Press the Esc key to exit all the menus, and then reboot the machine. The system should boot from your bootable media.

For information on accessing the rootvg volume group, see the next section in this document.


Accessing rootvg and mounting file systems
For AIX Version 3, choose the limited function maintenance shell (option 5 for AIX 3.1, option 4 for AIX 3.2).

If you only have one disk on the system, then hdisk0 will be used in the execution of the getrootfs or /etc/continue commands, which follow. If you have more than one disk, determine which disk contains the boot logical volume in this manner:

AIX 3.2.4 or AIX 3.2.5:

Run getrootfs; the output will indicate which disk contains the hd5 logical volume.

AIX 3.1 to AIX 3.2.3e:

Run lqueryvg -Ltp hdisk# for each hdisk. You can obtain a listing of these with the command lsdev -Cc disk. Repeat this command until you get output similar to the following:

00005264feb3631c.2  hd5  1

If more than one disk contains this output, use any disk when running getrootfs.
Now, access the rootvg volume group by running one of the following commands, using the disk you obtained in the preceding step:

AIX 3.1:                     /etc/continue hdisk#
AIX 3.2.0-3.2.3e:            getrootfs -f hdisk#
AIX 3.2.4-3.2.5:             getrootfs hdisk#

NOTE: If you want to leave the primary OS file systems (/, /usr, /tmp, and /var) unmounted after this command has completed, to run fsck, for instance, place a space and the letters sh after the hdisk in the preceding command. For example:

getrootfs hdisk0 sh

For AIX Versions 4 and 5, choose Start Maintenance Mode for System Recovery , option 3. The next screen will be called Maintenance; select option 1, Access a Root Volume Group. At the next screen, type 0 to continue, and select the appropriate volume group by typing the number next to it. A screen like the following will display.

Access a Root Volume Group

Type the number for a volume group to display the logical volume information and press Enter.

1)  Volume Group 0073656f2608e46a contains these disks:
hdisk0  2063 04-C0-00-4,0

Once a volume group has been selected, information will be displayed about that volume group.


Volume Group Information
Volume Group ID 0073656f2608e46a includes the following logical volumes:
hd6         hd5         hd8         hd4         hd2      hd9var
hd3         hd1

Type the number of your choice and press Enter.

1) Access this Volume Group and start a shell
2) Access this Volume Group and start a shell before mounting filesystems
99) Previous Menu

If the logical volumes listed do not include logical volumes like hd4, hd2, hd3, and so on, you may have selected the wrong volume group. Press 99 to back up one screen and select again.

Now you may select one of two options: Access this volume group and start a shell , option 1, or Access this volume group and start a shell before mounting file systems , option 2. Option 2 allows you to perform file system maintenance on /, /usr, /tmp, and /var before mounting them.

NOTE: If you intend to use SMIT or vi, set your terminal type in preparation for editing the file. xx stands for a terminal type such as lft, ibm3151, or vt100.

export TERM

Errors from these steps may indicate failed or corrupt disks in rootvg. These problems should
be corrected. For additional assistance, contact your vendor, your local branch office, or your AIX support center.


Related documentation
For more in-depth coverage of this subject, the following IBM publication is recommended:
AIX Version 4.3 System Management Guide: Operating System and Devices
AIX Version 5.1 System Management Guide: Operating System and Devices

IBM documentation can also be accessed online through the following URL:

Similar documents can be accessed through the following URL:

Add a RAM File System in Aix

Create a RAM disk of 10 MB

# mkramdisk 10M


Create a JFS File System on this RAM disk

# mkfs -V jfs /dev/rramdisk0

mkfs:destroy /dev/rramdisk0 (yes) ? y

Create Mountpoint

# mkdir /ramdisk

Mount  RAM File System

# mount -V jfs -o nointegrity /dev/ramdisk0 /ramdisk

The purpose of the mkramdisk command is to create file systems directly in memory. This is useful for applications that make many temporary files. Use ramdisk only for data that can be lost. After each reboot the ramdisk file system is destroyed and must be rebuilt.

Journaled file systems structure



Superblock : File System size and indentification, Free list, fragment size, nbpi.

Inodes: File size, ownership, permissions, pointers to data blocks.

Blocks: Data blocks contain data and Indirect block contain pointers to data blocks.

Journaled file systems are built within logical volumes. Because journaled file systems exist within logical volumes, the size of the file system always multiples of the logical partition size for that logical volume (for example, 4 MB). An individual file within a file system will by default have units allocated to it in blocks of  4096 bytes. (This may change if you have implemented fragmentation or large files – to be discussed later.)
Some unix commands often report file sizes in units of 512 bytes to remain compatible with other UNIX file systems. This is independent of the actual unit of allocation. The first addressable logical block on the file system is the superblock. The superblock contains information such as the file system name, size, number of inodes, date/time of creation.
The superblock is critical to the file system and if corrupted, prevents the file system from mounting. For this reason a backup copy of the superblock is always written in block 31. Uempty Immediately following the superblock are inodes which contain identifying information for files such as the file type, size, permissions, user/group/owner, create/modification and last
access dates. They also contain pointers to the data block for fragment addresses which hold the data. For larger files the system creates sets of indirect blocks filled with data block addresses to point to the data block or fragments which hold the data.

Find and remove Files in Unix older than the specified number of days

For finding the files older than 31 days

find . -name “filename.ext” -mtime +no_of_days -exec ls -ltr {} ; e.g   find . -name “*req” -mtime +31 -exec ls -ltr {} ;

Verify the timestamp of all the files.They must be older than 5 weeks For Deleting files older that 31 days :

find . -name “*req” -mtime +31 -exec rm {} ;

Verify after execution of the above.

Execute:  find . -name “*req” -mtime +31 -exec ls -ltr {} ;

Fibre Channel Topologies

Fibre Channel Topologies



Point-to-Point: In this topology, devices are connected directly to each other. This topology allows the devices to communicate using the full bandwidth of the link.

Arbitrated Loop (FC-AL): In this topology, devices are attached to a shared “loop”. FC-AL is analogous to the token ring topology. Each device has to contend for performing I/O on the loop by a process called  “arbitration” and, at any given time, only one device can “own” the I/O on the loop. This results in a shared bandwidth environment. Private Arbitrated loops restrict the number of devices to 126 (plus the initiator).
Each device has a unique id called ALPA (Arbitrated Loop Physical Address) by which it is identified on the loop. In a loop environment, each time the topology changes (i.e. when devices are added or removed) the loop has to be re-initialized by a process known as a LIP (Loop initialization protocol) reset. This results in a momentary pause in I/O. It is for this reason that arbitrated loop environments don’t scale well and are limited to a few devices only. Most implementations of arbitrated loop provide a star topology to a loop by implementing a device called a hub. Hubs have won wide acceptance in JBOD (Just a Bunch of Disks) environments, because just as JBOD costs less than enterprise storage, hubs cost less than switches.

Switched Fabric (FC-SW): In this topology, each device has a unique dedicated I/O path to another device. This is accomplished by implementing a device known as a fabric switch. A fabric switch is analogous to an IP switch. When a device is physically connected to a switch port, it establishes a point-to-point connection with the port and logs into the fabric by a process called a fabric logon (defined in the FC2 layer) and registers itself with the fabric name server, which is a virtual database to keep track of devices connected to the switch. Thus in essence, it establishes a point-to-point connection with a port on the switch. It then sends a request to access another device which is connected to the same switch. In most cases, this is either a storage array or a tape drive. Once this request is granted, the switch makes a note of this connection and a dedicated path is established. This path is now totally independent of any topology changes to the switch (i.e. devices being
added or removed) and results in dedicated bandwidth. Switched fabric environments use a 24-bit addressing scheme to identify devices and hence can accommodate up to 15 million devices. The reason why switched fabric provides higher performance than arbitrated loop is because a switch based fabric provides full bandwidth between the nodes in the fabric. At any given time there can be n/2 full bandwidth connections between nodes in the fabric (one connection for the initiator and one connection for the target).