728x90

Question

This document describes a few methods that can be used to find files opened by a process. This information can be useful when debugging processes that open too many files, or have a file leak.

Answer


Introduction

A system administrator might find it necessary to obtain information about all files that are currently opened by a process. A process might have a defect that causes it to continuously create files without closing them, or it might open files, read and write to those files, but fail to close the files afterwards. In such cases it is useful to obtain as much information as possible about the files that have been opened by a process to help pinpoint the cause of the problem. AIX has a virtual file system mounted at /proc that provides information about running processes, including the files opened by those processes. AIX also includes a number of commands that can be used to obtain information about files opened by processes. Open Source commands such as lsof can also be used.

/proc File System

The /proc file system is a virtual file system, meaning it does not contain actual files residing on a disk or in RAM. But the /proc file system contains virtual files that can be manipulated just like real files. These virtual files provide information about processes currently running on a system, using standard UNIX commands and methods for accessing files. Under /proc there are virtual directories named with the process IDs (PIDs) of all processes currently running on the system. Inside of each of these directories are more subdirectories. These subdirectories organize all of the available information about running processes. One of the subdirectories is named fd, an abbreviation for file descriptor. Inside fd is a list of virtual files with numbers for file names. These numbers are the file descriptor numbers assigned by the operating system to the real files that have been opened by the process. In the following example, we find that the process with PID 184422 has only one opened file with file descriptor 4.

# cd /proc/184422/fd
# ls -l total 16 -r--r--r--   1 root system   4811 Jul 12 2004  4

procfiles Command

The AIX procfiles command lists all files opened by a process. For each file the command also provides the inode number for the file, and additional information such as the file size, and uid and gid. Here is an example of procfiles output for the same process with PID 184422 that we found in the /proc file system above.

# procfiles 184422

184422 : /usr/sbin/hostmibd
  Current rlimit: 2147483647 file descriptors
   4: S_IFREG mode:0444 dev:10,5 ino:13407 uid:0 gid:0 rdev:0,0
      O_RDONLY size:4811

Again we see that process 184422 has one opened file with file descriptor 4. File descriptor 4 has major,minor numbers of 10,5 and an inode number of 13407. We can use the following procedure to find the device where the file is located.

# cd /dev
# ls -l | grep "10, *5"
brw-rw----   1 root     system       10,  5 Oct 10 2005  hd2
crw-rw----   1 root     system       10,  5 Oct 10 2005  rhd2

So the device or logical volume that contains the file system in this example is /dev/hd2.

# lsfs | grep hd2
/dev/hd2        --         /usr           jfs2 3801088 yes no

This filesystem is mounted at /usr.

We can use the following command to obtain information about the file with file descriptor 4 and inode 13407.

# istat 13407 /usr
Inode 13407 on device 10/5
File Protection: rw-r--r--
Owner: 2(bin)           Group: 2(bin)
Link count:   1         Length 4811 bytes
Last updated:   Tue Aug 24 16:14:48 CDT 2004
Last modified:  Mon Jul 12 11:33:31 CDT 2004
Last accessed:  Wed Aug  9 09:16:28 CDT 2006
Block pointers (hexadecimal): 1892c

We can use find command to find all file names in the filesystem /usr with an inode of 13407.

# cd /usr
# find . -inum 13407 -exec ls -l {} \;
-rw-r--r--   1 bin      bin            4811 Jul 12 2004
./lib/nls/msg/en_US/hostmibd.cat

Notice the 1 just before the first bin. This indicates that there is only 1 hard link, meaning the file name hostmibd.cat is the only file name associated with this inode.

pstat Command

The AIX pstat command can be used to list all files opened by a process. Here is an example that finds all files currently opened by the cron process.

# ps -ef | grep cron
    root 323762      1   0   Oct 06      -  0:07 /usr/sbin/cron

The PID for cron is 323762, which is 0x4F0B2 in hex.

# pstat -a | grep -i 4F0B2
SLT ST    PID   PPID   PGRP   UID  EUID  TCNT  NAME
 79 a   4f0b2      1  4f0b2     0     0     1  cron

We can use the slot number to display the file system state info and the file descriptor table. In this example we see that cron has 13 opened files, numbered from 0 to 12.

# pstat -u 79 | grep FILE
FILE SYSTEM STATE
FILE DESCRIPTOR TABLE

# pstat -u 79 | grep -p "FILE DESCRIPTOR TABLE"
FILE DESCRIPTOR TABLE
    *ufd: 0xf00000002ff49e20
    fd 0:  fp = 0xf1000714500080e0   flags = 0x0080  count = 0x0000
    fd 1:  fp = 0xf100071450007fa0   flags = 0x0080  count = 0x0000
    fd 2:  fp = 0xf100071450007fa0   flags = 0x0080  count = 0x0000
    fd 3:  fp = 0xf100071450007780   flags = 0x0080  count = 0x0000
    fd 4:  fp = 0xf100071450007af0   flags = 0x0080  count = 0x0000
    fd 5:  fp = 0xf1000714500079b0   flags = 0x0080  count = 0x0000
    fd 6:  fp = 0xf1000714500066a0   flags = 0x0080  count = 0x0000
    fd 7:  fp = 0xf100071450008270   flags = 0x0080  count = 0x0000
    fd 8:  fp = 0xf1000714500081d0   flags = 0x0080  count = 0x0000
    fd 9:  fp = 0xf100071450008220   flags = 0x0080  count = 0x0000
    fd 10:  fp = 0xf100071450008180   flags = 0x0080  count = 0x0000
    fd 11:  fp = 0xf1000714500082c0   flags = 0x0080  count = 0x0001
    fd 12:  fp = 0xf100071450008130   flags = 0x0081  count = 0x0000

lsof Command

The lsof command is an open source command available for free on the internet. lsof is a very powerful command with many options so we only list a few uses for lsof in this document.

# lsof -u account | wc -l
Displays the total number of open file handles in the specified account.

# lsof -u account | grep pid | wc -l
or
# lsof -p pid
Displays the total number of open files in the specified account name for the specified pid.

lsof indicates if the file descriptor is associated with an open socket or an open file.

Conclusion

The /proc virtual file system and the AIX commands procfiles and pstat can be used to list information about files that are currently opened by a process. This information can be used to investigate processes that are having certain types of problems with files. The open source lsof command is also useful for providing information about files opened by processes, and files opened under specific user accounts.

 

 

 

728x90
728x90

wget을 사용해서 파일을 받을 때 Unsupported scheme 메시지와 함께 다운로드가 되지 않는 경우가 있습니다.

linux용 wget에서는 대체로 잘 수행되지만 AIX의 wget에서는 아래와 같이 안되는 경우가 종종 있더군요.

$ wget https://www14.software.ibm.com/Xa.2/Xb.MmElDw8T-Q4b_Y2ZOEI-RVGo_wnxPDp2a3NpUEtBRUQ/Xc.v-next//Xd./Xf.LPr.D1vk/Xg.9028828/Xi.swerpdb2-vnext-3/XY.regsrvs/XZ.LMrtl2Qj25YLhOs7ld5HNwvm8f0/db2vnext_aese_aix64.tar.gz
https://www14.software.ibm.com/Xa.2/Xb.MmElDw8T-Q4b_Y2ZOEI-RVGo_wnxPDp2a3NpUEtBRUQ/Xc.v-next//Xd./Xf.LPr.D1vk/Xg.9028828/Xi.swerpdb2-vnext-3/XY.regsrvs/XZ.LMrtl2Qj25YLhOs7ld5HNwvm8f0/db2vnext_aese_aix64.tar.gz: Unsupported scheme.

위와 같은 오류는 SSL 연결을 사용할 때 발생하는 것으로 보입니다. AIX의 wget에는 SSL 연결 옵션이 보이지 않네요. 대체 유틸리티로 curl을 사용해보았습니다.

-O 옵션은 대상 파일명과 동일하게 저장하겠다는 뜻이고, -k는 insecure 모드로 접속하는 옵션입니다.

아래와 같이 잘 수행되네요.

$ curl -O -k https://www14.software.ibm.com/Xa.2/Xb.MmElDw8T-Q4b_Y2ZOEI-RVGo_wnxPDp2a3NpUEtBRUQ/Xc.v-next//Xd./Xf.LPr.D1vk/Xg.9028828/Xi.swerpdb2-vnext-3/XY.regsrvs/XZ.LMrtl2Qj25YLhOs7ld5HNwvm8f0/db2vnext_aese_aix64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0 1788M    0 12.0M    0     0   312k      0  1:37:32  0:00:39  1:36:53  34
728x90
728x90

쉘스크립트에서 명령 수행결과를 변수 값에 저장한 후, 변수 값을 출력할 때 개행문자가 사라지는 경우가 있습니다.

아래와 같은 단순히 df 결과를 변수 값에 저장한 후 출력하는 쉘 스크립트 입니다.

기본 df의 출력 결과는 아래와 같습니다.


Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on

/dev/hd4          5242880    301996   95%    11523    13% /

/dev/hd2         10485760   5480656   48%    83421     7% /usr

/dev/hd9var       5242880   4765576   10%     3980     1% /var

/dev/hd3         10485760   6717992   36%     5338     1% /tmp

/dev/fwdump        786432    785984    1%        4     1% /var/adm/ras/platform

/dev/hd1         10485760   1381160   87%    31150     9% /home

/dev/hd11admin    20971520   6628444   69%     3349     1% /admin

/proc                   -         -    -         -     -  /proc

/dev/hd10opt     10485760    528340   95%    52455    27% /opt

/dev/livedump      262144    261776    1%        4     1% /var/adm/ras/livedump

/dev/work1lv    131072000  74206256   44%    93462     1% /work1

/dev/work2lv    131072000  37407272   72%   234216     3% /work2

/dev/testkim      5242880   5241752    1%        4     1% /testkim

/dev/fslv00       5242880   5227048    1%       30     1% /nmon


쉘 스크립트를 실행하면 위의 내용이 한줄로 나타납니다.


#!/bin/bash

a=`df`

echo $a


<실행결과>

Filesystem 512-blocks Free %Used Iused %Iused Mounted on /dev/hd4 10485760 603992 95% 11523 13% / /dev/hd2 20971520 10961312 48% 83421 7% /usr /dev/hd9var 10485760 9531136 10% 3980 1% /var /dev/hd3 20971520 13435984 36% 5338 1% /tmp /dev/fwdump 1572864 1571968 1% 4 1% /var/adm/ras/platform /dev/hd1 20971520 2762312 87% 31150 9% /home /dev/hd11admin 41943040 13256888 69% 3349 1% /admin /proc - - - - - /proc /dev/hd10opt 20971520 1056680 95% 52455 27% /opt /dev/livedump 524288 523552 1% 4 1% /var/adm/ras/livedump /dev/work1lv 262144000 148412512 44% 93462 1% /work1 /dev/work2lv 262144000 74814544 72% 234216 3% /work2 /dev/testkim 10485760 10483504 1% 4 1% /testkim /dev/fslv00 10485760 10454096 1% 30 1% /nmon


이렇게 되면 출력물을 가공하기 어려워집니다.

이런 경우에는 echo에서 변수값을 쌍따옴표(")로 묶어줍니다.


#!/bin/bash

a=`df`

echo "$a"


<실행결과>

Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on

/dev/hd4        10485760    603976   95%    11523    13% /

/dev/hd2        20971520  10961312   48%    83421     7% /usr

/dev/hd9var     10485760   9531072   10%     3980     1% /var

/dev/hd3        20971520  13435984   36%     5338     1% /tmp

/dev/fwdump      1572864   1571968    1%        4     1% /var/adm/ras/platform

/dev/hd1        20971520   2362280   89%    31150    11% /home

/dev/hd11admin   41943040  13256888   69%     3349     1% /admin

/proc                  -         -    -         -     -  /proc

/dev/hd10opt    20971520   1056680   95%    52455    27% /opt

/dev/livedump     524288    523552    1%        4     1% /var/adm/ras/livedump

/dev/work1lv   262144000 148412496   44%    93462     1% /work1

/dev/work2lv   262144000  74814544   72%   234216     3% /work2

/dev/testkim    10485760  10483504    1%        4     1% /testkim

/dev/fslv00     10485760  10454096    1%       30     1% /nmon



728x90

'*nix' 카테고리의 다른 글

How to List Files Opened By a Process  (0) 2022.12.12
wget vs curl  (0) 2017.02.28
Updating to a new Technology Level or Service Pack  (0) 2014.09.02
Tape Device Names for Specific UNIX Platforms  (0) 2013.12.23
Reducing Paging Space %Used  (0) 2013.06.19
728x90

Technote (FAQ)


Question

What is the recommended process for upgrading to a new Technology Level or Service Pack in AIX ?

Answer

-- Updating to a New Technology Level or Service Pack --


Update_All in 5.3, 6.1, and AIX 7

This document describes the recommended preparation and process when considering updating your system to a new technology level or adding a service pack to an existing technology level. In all we will review some key words and terminology, run through recommended pre-checks, discuss the update_all process using both SMIT and command line, and finally post-checks & FAQ. 

Key Words / Terminology : 
V.R.M.F(Version, Release, Maintenance Level, Fix Level) 
This represents your operating system level and is mentioned because of the change made in the 5300-07 technology level update. Previous to 5300-07 updates are recognized by their last numerical level entry only. 
Ex. 
bos.rte.install 5.3.0.60 

Beginning with 5300-07 the 3rd number, or “Maintenance Level” number will also be included and will represent the Technology level of the fileset, followed by the “Fix Level”. 
Ex. 
bos.rte.install 5.3.7.0 
*Note that the “Fix Level” entry does not necessarily represent the “Service Pack” level. Any similarity is simply coincidental. 

Oslevel 
You will also notice a change to how the operating system level reads. With the introduction of 5300-06 you will notice more information provided when running the ‘oslevel’ command. 

# oslevel -s 
6100-06-06-1140 

The addition of the last four digits simply represents the year (11) and week (40) of the release of your technology level/service pack (-06-06). 

Update_all 
This is the recommended method of installation when upgrading your technology level or service pack level only. This installation method should not be used when attempting to upgrade the version or release level of your operating system. 
Ex. 
5300-0x to 6100-0x - do NOT use update_all 
6100-0x to 7100-0x - do NOT use update_all 



Recommended Pre-Checks : 
1. The back-out 
It is recommended to have at least one back-out method available to you in case a restore is required. Recommended back out methods include : mksysb restore, sysback restore, altinst_rootvg clone, and multibos. More information on any of these back-out methods can be found at the publib documentation site by using this link to click through to the appropriate infocenter and search features found here : 

http://publib16.boulder.ibm.com/pseries/ 

2. Boot Image Verification 
The hd5 logical volume holds your boot image. There are a few checks to make against your boot image before starting your update_all process. 
First, find out which disk contains your hd5 logical volume. 

# lslv -m hd5 
hd5:N/A 
LP PP1 PV1 
0001 0001 hdisk0 

The listing under the “PV1” column indicates on which disk hd5 is located. Any other entries under “PV2”..etc, simply represent mirrored copies. 

Next, verify your boot image can be successfully recreated using the hdisk# from above and by using /dev/ipldevice. 

# bosboot -ad /dev/hdisk0 
bosboot: Boot image is 35795 512 byte blocks. 

# bosboot -ad /dev/ipldevice 
bosboot: Boot image is 35795 512 byte blocks. 

If either of these two commands fail for any reason, please call the support center for resolution before proceeding. 

Finally, with the continual introduction of new devices and hardware the boot images are growing larger. You will want to make sure your hd5 logical volume has enough free and contiguous space to hold the boot image. Currently the recommended allocated space to have for hd5 is 32meg. This is of concern in environments with smaller disk sizes, and should be checked before running an update. 

# lsvg -l rootvg |grep hd5 
hd5 boot 1 1 closed/syncd N/A 

# lsvg rootvg |grep SIZE 
VG STATE: active PP SIZE: 32 megabyte(s) 

The single partition (in bold (1)) is 32meg in size. This should be enough to contain the boot image. Smaller partition sizes will require more partitions to be allocated. 

Your hd5 partitions also need to be contiguous partitions. Check this by running the following command : 
# lspv -M hdisk0 |grep hd5 
hdisk0:1 hd5:1 
hdisk0:2 hd5:2 
hdisk0:3 hd5:3 

You can see in this example that the hd5 logical volume covers the first 3 partitions on the disk and they are all contiguous. If your partitions are not contiguous, or are not covered on the first partitions of the disk please call the software support line for assistance with correcting this. 
Again, you may only have 1 partition that is large enough to handle the boot image, or you may have multiple smaller partitions. Either is fine. 

3. Firmware 
Firmware should be kept up to date and be checked whenever a technology level update is considered. In general firmware updates should be applied before software updates, but that is not a rule set in stone. You should always refer to the firmware download site installation information and follow those instructions. 
You can access the firmware download site here : 
http://www-933.ibm.com/support/fixcentral/ 

If there are any questions concerning the firmware update, installation instructions, or if there are software considerations please contact the hardware support center first. 

4. Fileset Consistency 
You should run the following command to check fileset consistency : 
# lppchk -v 

Ideally this should return to the command line with no output. If you do receive output and are unfamiliar with how to resolve it, please call the support center for assistance before running your upgrade. 

5. Space 
In order to see if you have enough space for your update you can run the update_all operation in preview mode. This will provide you with an estimated system resources listing of the necessary space. In order to do this you will first have to install the fileset “bos.rte.install”. Following are two examples of how to update this fileset first, so a preview update_all can be executed. The example below shows initially “committing” the bos.rte.install update. If you would feel more comfortable using the “apply” feature in this case, feel free to do so. Note that if you do “Apply” you will need to “Commit” before continuing with the actual update_all process. 

From an unmounted cdrom device (cd0). 
# installp -acd /dev/cd0 bos.rte.install 

From a download directory (/fixes/6100-06) 
# installp -acd /fixes/6100-06 bos.rte.install 

Using SMITTY 
# smitty install_all 
* INPUT device / directory for software /dev/cd0 
* SOFTWARE to install [bos.rte.install] 
PREVIEW only? (install operation will NOT occur) no 

Once the installation is complete you will then be able to run the preview operation on the remaining filesets to get an estimate of the required space for your update. 

# smitty update_all 
* INPUT device / directory for software /dev/cd0 
* SOFTWARE to update _update_all 
PREVIEW only? (update operation will NOT occur) yes 


The preview will show something similar to this in regards to the space requirements : 
RESOURCES 
--------------- 
Estimated system resource requirements for filesets being installed: 
(All sizes are in 512-byte blocks) 


Filesystem
Needed Space
Free Space
/
402
239312
/usr
94352
165440
/var
1
237384
/tmp
52304
259240
/opt
6648
158576
Total
153707
1059952

Running the update using SMIT or command line : 
This section will cover the update_all process. In all cases the “input device” (location of the software) will be referred to as being a local cdrom drive (/dev/cd0). You can always use a download directory or nfs mount point, simply substitute the input device as necessary. This process is also executed presuming you are logged in as root (as opposed to using ‘sudo’). 

1. SMITTY : 
By menu selection options you would take the following path : 
# smitty 
Software Installation and Maintenance 
Install and Update Software 
Update Installed Software to Latest Level (Update All) 

-or use the fastpath- 

# smitty update_all 

INPUT device / directory for software /dev/cd0 
SOFTWARE to update _update_all 
PREVIEW only? (update operation will NOT occur) no 
COMMIT software updates? yes 
SAVE replaced files? no 
AUTOMATICALLY install requisite software? yes 
EXTEND file systems if space needed? yes 
VERIFY install and check file sizes? no 
DETAILED output? no 
Process multiple volumes? yes 
ACCEPT new license agreements? yes
Preview new LICENSE agreements? No 

The only required change would be the option for “ACCEPT new license agreements”. All other given defaults should remain as they are. Pressing <Enter> here will bring up a confirmation dialog box to which you press <Enter> again. The only other interaction you may have is if you need to switch out a volume of the media package. When complete, the upper left corner “Command:” field will have one of two outcomes : 

OK : Your installation has completed without error. You can either scroll down or exit out and view the /smit.log file for the log of the installation. 

FAILED : one or more filesets failed for some reason. You can either scroll down or exit out and view the /smit.log file for the log of the installation. Corrective action should be taken before rebooting. 

2. Command line : 
You will use the ‘install_all_updates’ command if opting to run this from command line. 
This command does have a representative manpage so feel free to review the flags, however this command was intended to be easily executed so running a basic update will not be a very long command. 

# install_all_updates -Y -cd /dev/cd0 

Once complete you will find the log of the installation in /var/adm/ras/install_all_updates.log. By default the fileset updates will be installed in the “APPLIED” state. The "-c" flag has been added to the above command to specify that all filesets install in the “COMMITTED” state. See the FAQ at the end of this document for more information concerning “APPLIED” vs “COMMITTED”. 



Post checks : 
Presuming your update_all was successful you will want to check the following commands. If you receive unexpected output please contact the support center for assistance. 
* Please see FAQ statement 11 and 11a below regarding post-update_all issues. 

# oslevel -r 
This should return with the expected TL output 

# oslevel -s 
This should return with the expected TL and SP output. 

# lppchk -v 
This should come back ideally with no output. 


FAQ and Opinions
This section is contains the most commonly asked questions and a few recommendations concerning the update_all. Most answers will be kept short and to the point (as much as possible). 

1. Is it okay to install my Technology Level in the “APPLIED” state ? What if I want to reject the TL update if there is a problem ? 
With the introduction of Technology Levels and the “all or nothing” packaging format, these updates are bringing in on the upwards of 400+ fileset updates for each TL. Attempting to perform a “reject” process on so much code simply does not work well, and is not supported. Recommended back-out methods are discussed earlier in this document. 

1a. Does the same hold true for Service Packs ? 
The Service Pack updates are certainly much smaller groups of updates....typically numbering around 40-50 per update. While you certainly will have a better chance of successfully rejecting 40 filesets instead of 400, it would still be best to have one of the back-out methods mentioned earlier. 

2. Why does my update_all have problems when I use an NFS mounted cdrom ? 
When running an update_all over NFS, you create your own mount point for the cdrom drive. This does not allow it to recognize the fact that there are multiple volumes available that contain the correct requisite filesets. Multiple update_all operations may be needed on each volume when NFS mounting a cdrom drive. A better option may be to ‘bffcreate’ the contents of all CDs down to a directory, then NFS mount that directory. 

3. The update_all failed. What now ? 
Do not reboot. You can review the log to find out what failed and why. If you are comfortable and familiar with these situations you can correct the failures and re-update the filesets. If not, please call the helpdesk and open a PMR for assistance. Have the log available to email in if necessary. 

4. I need to run my update today but I may not be able to reboot until next week. Is that a problem ? 
Plans should be made to reboot as soon as the update is complete and checks have been made to ensure there were no failures. System files will have been replaced, but the corresponding kernel and library updates will not be loaded until boot time. You will likely encounter problems if you delay rebooting. 

5. Is it recommended to reboot before issuing a TL upgrade ? 
If this is possible, absolutely. There are systems out there that have not been rebooted in a year or more. Who is to say that something has not happened in that time that simply would not show up until a reboot. Rebooting the system first assures a good boot image, a stable system, and would isolate any problem that normally would not be caught until the post-update reboot as either a preexisting issue, or an issue directly related to the TL update itself. 

6. Some say to use base AIX install media when updating the TL, others say the TL fix downloads or CDs should be used. Which is right ? 
The recommendation is to use the TL fix downloads from FixCentral, or the TL CDs that can be ordered either online or from AIX SupportLine. You can also use the base AIX installation media, however without getting into a long answer, the recommendation is using the TL fix packages. 

7. How long will the update_all take ? 
This is a question that does not quite have a definite answer. The length of time required for the update_all depends on how many filesets are being updated as well as the available system resources such as processors and memory. 
Giving a ballpark figure however, going up one TL should only take about 30-60 minutes plus reboot time. Some admins prefer to be more on the conservative side and block a 2-3 hour downtime. Consideration should also be made to the amount of time it would take to restore, depending on the backup method selected. 

8. Is it okay to run the update_all while people are online ? 
Updating could affect running processes. As such, applications should be down and users offline as a general rule. 

9. Where can I download new service packs or technology levels ? 
TL and SP updates can be acquired from the FixCentral website located here : 
http://www-933.ibm.com/support/fixcentral/ 

10. Will product X at level Y.Z work with my new technology level ? 
Some products may only be certified up to a certain operating system level while other products may require an update. The best thing to do would be to contactproduct X's support center. If it is an IBM product feel free to contact our support center and open a PMR requesting to speak to the product X team. Any 3rd party products should be cleared by their support before upgrading. 

11. The 'oslevel -s' and/or 'oslevel -r' commands do not report what I expect after the udpate. How can I determine what is missing ? 
If your 'oslevel' commands do not report correctly after your update_all you can add the "-l" flag to determine which filesets still need to be updated in order to complete your upgrade. 
The syntax : 
# oslevel -rl <level> 
# oslevel -sl <level> 

Example : 
# oslevel -rl 6100-01 
-or- 
# oslevel -sl 6100-00-01-0748 

The filesets listed will show an "Actual Level" heading (your current level) and a "Maintenance Level" heading (the level you need to be at to satisfy the TL/SP). 

11a. Some filesets occasionally require multiple update_all operations. 
There are cases where a second update_all operations need to be executed to pick up the full TL update. This is not defective behavior. Please also take note that this tip is not intended to resolve a "FAILED" status of your update_all. If you notice that your TL update was successful, but some filesets did not get updated andare on your media or in your download location, you may need to run the update_all a second time to pick them up. 

12. What are other best practices with regards to keeping the AIX operating system updated? 
IBM maintains a best practices site for service and support for Power Systems. 
Visit http://www.ibm.com/support/customercare/sas/f/best for more information. 



http://www-01.ibm.com/support/docview.wss?uid=isg3T1010755

728x90
728x90


Question

Each variant of UNIX has its own method for naming tape devices. This document details how many different platforms define their tape devices.

Answer

Under UNIX, magnetic tape drives are given individual numbers, starting from zero. Tape drives are accessed by means of a device special file located in the /dev directory. These device special files appear to the user as normal files, which can be opened, read from and written to. All operations you would do on a normal file can be done on a special file. The only difference is that the data in the file resides on the tape loaded in the drive, not on the filesystem. In addition, because there are different ways of physically writing data to a tape (for example, low or high density), there are several different files that correspond to the same tape drive. Each variant of UNIX has its own naming convention for the tape drives. This document covers the Sun, HP, AIX, DEC, Linux, SGI, SCO, and Unixware operating systems. 
SUN
On Sun operating systems, the tape devices are defined in /dev/rmt. Device names begin with device number followed by a letter designating density and compression:

h = high
m = medium
l = low
c = compression
u = ultra-compression
n = for no-rewind

Run man st to see the man page on the SCSI tape interface. Also see the "FILES" section of the man pages for man mt.

Examples:
Device Name Description
/dev/rmt/0 Tape drive 0, auto-rewind
/dev/rmt/0n Tape drive 0, no auto-rewind
/dev/rmt/0cn Tape drive 0, compression, no auto-rewind

HP
On HP operating systems, the tape devices are defined in /dev/rmt. Device names begin with a device number followed by a letter designating density (h = high, m = medium, l = low), then have an optional "c" for compression and/or an "n" for no-rewind. Run man 7 mt to see the man page on the magnetic tape interface.

Examples:
Device Name Description
/dev/rmt/0 Tape drive 0, auto-rewind
/dev/rmt/0n Tape drive 0, no auto-rewind
/dev/rmt/0mn Tape drive 0, medium density, no auto-rewind

AIX
On IBM AIX operating systems, the tape devices are defined in /dev. Device names begin with "rmt", are followed by a device number followed by an optional period and a number suffix to indicate density and rewind options (See table for details):
Special File Name Rewind-on-Close Retension-on-Open Bytes per Inch
/dev/rmt* Yes No Density setting #1
/dev/rmt*.1 No No Density setting #1
/dev/rmt*.2 Yes Yes Density setting #1
/dev/rmt*.3 No Yes Density setting #1
/dev/rmt*.4 Yes No Density setting #2
/dev/rmt*.5 No No Density setting #2
/dev/rmt*.6 Yes Yes Density setting #2
/dev/rmt*.7 No Yes Density setting #2

Examples:
Device Name Description
/dev/rmt0 Tape drive 0, auto-rewind
/dev/rmt0.1 Tape drive 0, no auto-rewind

The values of density setting #1 and density setting #2 come from tape drive attributes that can be set using SMIT. Typically density setting #1 is set to the highest possible density for the tape drive while density setting #2 is set to a lower density. However, density settings are not required to follow this pattern. The density value (bytes per inch) is ignored when using a magnetic tape device that does not support multiple densities. For tape drives that do support multiple densities, the density value only applies when writing to the tape. When reading, the drive defaults to the density at which the tape is written. 

Run man rmt to see the man pages on the "rmt" interface.

LINUX
Tape devices under Linux the operating have different names depending on the type of tape involved. The most common sort of tape (SCSI Tape) will have a device name of 'st'. 
For example, the first SCSI tape has the following device special files:

Examples:
Device Name Description
/dev/st0 SCSI-tape 0, auto-rewind
/dev/nst0 SCSI-tape 0, no auto-rewind
/dev/rft0 Floppy tape 0, auto-rewind
/dev/nrft0 Floppy tape 0, no auto-rewind

One major difference with Linux devices and other operating systems is that the density code is not used on Linux. If you want to write a tape with a density other than the default (usually highest) density then you may need to use the mt command with the densities or set densities arguments to set the density of the device. Read operations usually do not need the density setting explicitly, as this will be automatically picked up. 

DEC
With DEC operating system tape devices, you cannot tell what the target number and SCSI bus number is for a tape device given just its name. The device name will also have other modifiers that determine things like whether the tape rewinds after use, and what density and compression settings are used on the tape. 

Tape device format:
/dev/{device type}{device number}{density/compression flag} 

{device type} rmt = Auto-rewind device, nrmt = Non-auto-rewind device
{device number} Tape device numbers start at 0. They only signify what order the device files were created in, not what SCSI bus they are attached to, or what their target id is.
{density/compression flag} Tape drives are capable of writing at multiple byte per inch densities, and some of them can use data compression hardware to compress the data before it is written to the tape. The following is a list of known flags:
h = high density / compressing device
m = medium density / compressing device
l = low density / compressing device
a = another density (QIC format drives only)

Examples:
Device Name Description
/dev/rmt0 Tape drive 0, auto-rewind
/dev/nrmt0 Tape drive 0, no auto-rewind
/dev/rmt0h Tape drive 0, auto-rewind, high density
/dev/nrmt0l Tape drive 0, no auto-rewind, low density
/dev/rmt0a Tape drive 0, auto-rewind, another density (QIC format drives only)

The density designation depends very much on the drive hardware. Running man tz gives the following information:

TLZ06: Single-density drive, compaction support.
rmt?a 61000 BPI
rmt?l 61000 BPI
rmt?m 61000 BPI, compaction turned on.
rmt?h 61000 BPI, compaction turned on.

SGI
On SGI operating systems, the tape devices are defined in /dev/rmt. Device names typically begin with an interface type, usually "tps" for tape-SCSI, followed by an interface number, a "d", a device number, and then a series of optional flags: 

nr = no-rewind
ns = no-byte-swap
v = variable record length

Run man tps to see the man pages on the SCSI tape interface.

Examples:
Device Name Description
/dev/rmt/tps0d3 SCSI-tape 0, device 3, auto-rewind
/dev/rmt/tps0d3nr SCSI-tape 0, device 3, without auto-rewind
/dev/rmt/tps0d2nrnsv SCSI-tape 0, device 2, non-rewind, no-byte-swap, variable record length

SCO
Examples:
Device Name Description
/dev/rct0 Tape drive 0, auto-rewind
/dev/nrct0 Tape drive 0, no auto-rewind

UNIXWARE
The tape drive device files are defined in /dev/rmt/*

Examples:
Device Name Description
/dev/rmt/ctape1 Tape drive 1, auto-rewind, non-retensioning
/dev/rmt/ntape1 Tape drive 1, no auto-rewind, non-retensioning
/dev/rmt/rtape1 Tape drive 1, auto-rewind, retensioning
/dev/rmt/nrtape1 Tape drive 1, auto-rewind, retensioning
/dev/rmt/utape1 Tape drive 1, unload on close


http://www-01.ibm.com/support/docview.wss?uid=swg21660675&myns=swgimgmt&mynp=OCSSGU8G&mync=E


728x90
728x90


Question
Reducing Paging Space %Used
 
Answer

This document provides some ways to reduce the '%Used' paging space. This information applies to AIX Version 5L.

This example starts with a single paging space of 45% used.

#lsps -a
Page Space  PV     VG      Size   %Used  Active  Auto  Type
hd6         hdisk0 rootvg  128MB   45    yes     yes   lv
  1. Create a second paging space of the same size by entering:
     #mkps -s 32 -n vg00 hdisk1
     paging00
    

  2. Now, you should have two paging spaces similar to the following:
     #lsps -a
     Page Space  PV     VG      Size   %Used  Active  Auto  Type
     paging00    hdisk1 vg00    128MB   1     yes     no    lv
     hd6         hdisk0 rootvg  128MB   45    yes     yes   lv
    

  3. Turn off the original paging space.
    #swapoff /dev/hd6
    

  4. Now, it is 0% used and Active=no.
    #lsps -a
    Page Space  PV     VG     Size   %Used  Active  Auto  Type
    paging00    hdisk1 vg00   128MB   2     yes     no     lv
    hd6         hdisk0 rootvg 128MB   0     no      yes    lv
    

  5. Turn the original paging space back on by entering:
    #swapon /dev/hd6
    

  6. The second paging space can be turned off and removed by entering:
    #swapoff /dev/paging00
    #rmps paging00
    

  7. You should now be back to your original paging space, but only 2% used.
    #lsps -a
    Page Space  PV     VG     Size   %Used  Active  Auto  Type
    hd6         hdisk0 rootvg 128MB   2     yes     yes    lv
    ---------
    

Why did this work?

When the /etc/swapoff command ran, it moves pages from the hd6paging space to the paging00 paging space. However, if a page on the hd6paging device was active in physical memory (it has been paged in), the command will not move that page to paging00.h


http://www-01.ibm.com/support/docview.wss?uid=isg3T1000585

728x90
728x90

tar를 사용하여 아카이브 할때 "아카이브하기에 너무 큽니다" 라는 메시지가 나오는 케이스를 발견했습니다.

솔라리스에서 8GB 가 넘는 백업 파일을 압축한 경우입니다. 정확하게 얘기하면 단일 파일이 8GB가 이상인 경우이고

전체 tar 파일은 파일시스템 제한이 허용하는 한도까지 만들어집니다.


영문으로는 "too large to archive" 라는 메시지가 출력됩니다.


조금 검색을 해보니 솔라리스 외에도 이런 경우가 발생하는 케이스가 보입니다.

아카이브를 할 때나 해제할 때 E옵션을 사용하는 것입니다.


tar의 manpage를 살펴보면 다음과 같습니다.


     E              Write a tarfile with extended headers.  (Used

                    with  c,  r,  or  u function letters. Ignored

                    with t or x function letters.) When a tarfile

                    is written with extended headers, the modifi-

                    cation time is maintained with a  granularity

                    of microseconds rather than seconds. In addi-

                    tion, filenames no longer than PATH_MAX char-

                    acters  that could not be archived without E,

                    and file sizes greater  than  8GB,  are  sup-

                    ported.  The  E flag is required whenever the

                    larger files and/or files with longer  names,

                    or  whose  UID/GID  exceed 2097151, are to be

                    archived,   or   if   time   granularity   of

                    microseconds is desired.


이런 현상은 플랫폼이 x86이나 sparc이든 동일합니다. 확인한 버전은 SunOS 5.10입니다. 



https://kr.forums.oracle.com/forums/thread.jspa?threadID=2316728

https://forums.oracle.com/forums/thread.jspa?threadID=1920265

https://forums.oracle.com/forums/thread.jspa?threadID=2162326


728x90
728x90

1. 압축

### tar cvf - [묶을 소스 파일] | gzip -c > 만들 파일 이름

 tar cvf - /etc | gzip -c > etc.tar.gz


2. 압축해제

gzip -dc xxx.tar.gz | tar xvf -

728x90
728x90

Problem(Abstract)

How to find the processor type in AIX OS.

Resolving the problem

STEPS

To determine the processor type under AIX, at the shell command prompt, type:

    prtconf | grep -i "Processor Type"

Depending upon the processor type and installation, the above command may give the following types of output: 

On a Power 4 type of processor:

    $ prtconf | grep -i "Processor Type"
    Processor Type: PowerPC_POWER4

On a non Power 4 type RISC based processor:

    $ prtconf | grep -i "Processor Type"
    Processor Type:  PowerPC_RS64-II

On AIX systems prtconf utility can be found in /usr/sbin and the grep utility can be found in/usr/bin directories.



https://www-304.ibm.com/support/docview.wss?uid=swg21163076

728x90
728x90

Problem(Abstract)

How to determine the number of network cards on a Digital Unix (OSF1) machine.

Resolving the problem

INTRODUCTION

You may need to find the IP address or addresses for your Digital Unix (OSF1) system, but may not know whether the system contains more than one Network Interface Card (NIC).


METHOD

On Digital Unix (OSF1) systems, the command ifconfig supports an option (-a) to list all of the interfaces on the machine. The output of ifconfig -a varies among operating systems, but should include the IP address of any Network Interface Card (NIC) on the machine.

The interface name will be a 3 to 4 character indicator like hme0, en0 or lc1. Each entry will always begin with the interface name and a colon. This will usually be followed by a set of flags. The flag LOOPBACK indicates that the interface is the local loop back interface and not an actual NIC. Somewhere in the entry for an NIC there is a keyword of inet followed by an IP address. This is the IP address of the interface.

Execute ifconfig -a and look for entries with IP addresses that are not 127.0.0.1. The IP addresses are preceded by inet. 

Note: Some systems that support IP version 6 (IPv6) will have two interfaces for each NIC, one for IPv6 and the other for IP version 4 (IPv4). The IPv6 interface will not have an inet parameter, instead it will have an inet6 parameter that will not look like an IP address. Instead of decimal numbers separated by periods an IPv6 address is made up of hexadecimal numbers separated by colons.


Examples:

Output from an Digital Unix (OSF1) machine:

The output is for a machine with only one Network Interface Card (NIC). Notice that even though there is only one NIC, there are 3 interfaces. The lo0 interface is for the local loop back. You can tell this by looking at the inet (IP address) of 127.0.0.1 and also by the LOOPBACK flag. 

The real NIC is tu0 and the IP address is given in the inet value (109.25.146.121). 

$ /usr/sbin/ifconfig -a
lo0: flags=100c89<UP,LOOPBACK,NOARP,MULTICAST,SIMPLEX,NOCHECKSUM>
     inet 127.0.0.1 netmask ff000000 ipmtu 4096

sl0: flags=10<POINTOPOINT>

tu0: flags=c63<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
     inet 109.25.146.121 netmask ffffff00 broadcast 109.25.146.255 ipmtu 1500


Finding ifconfig

The ifconfig command may not be in your default PATH. Look in the following directories:


You can still use it by simply including the full path to the ifconfig file on the command line. If you cannot find ifconfig, check the man page for ifconfig or use the find command.

For more information, check with your system administrator or the operating system documentation.



https://www-304.ibm.com/support/docview.wss?uid=swg21187826

728x90

+ Recent posts