Topics: AIX, SAN, SDD, Storage
PVID trouble
To add a PVID to a disk, enter:
# chdev -l vpathxx -a pv=yesTo clear all reservations from a previously used SAN disk:
# chpv -C vpathxx
To mount:
- Build a logical volume (the size of an ISO image, better if a little bigger).
- Create an entry in /etc/filesystem using that logical volume (LV), but setting its Virtual File System (V'S) to be cdrfs.
- Create the mount point for this LV/ISO.
- Copy the ISO image to the LV using dd.
- Mount and work on it like a mounted CD-ROM.
To unmount:/IsoCD: dev = /dev/lv09 vfs = cdrfs mount = false options = ro account = false
- Unmount the file system.
- Destroy the logical volume.
Topics: AIX, Backup & restore, Storage, System Admin↑
JFS2 snapshots
JFS2 filesystems allow you to create file system snapshots. Creating a snapshot is actually creating a new file system, with a copy of the metadata of the original file system (the snapped FS). The snapshot (like a photograph) remains
unchanged, so it's possible to backup the snapshot, while the original data can be used (and changed!) by applications. When data on the original file system changes, while a snapshot exists, the original data is copied to the snapshot to keep the snapshot in a consistant state. For these changes, you'll need temporary space, thus you need to create a snapshot of a specific size to allow updates while the snapshot exists. Usually 10% is enough. Database file systems are usually not a very good subject for creating snapshots, because all database files change constantly when the database is active, causing a lot of copying of data from the original to the snapshot file system.
In order to have a snapshot you have to:
- Create and mount a JFS2 file system (source FS). You can find it in SMIT as "enhanced" file system.
- Create a snapshot of a size big enough to hold the changes of the source FS by issuing smitty crsnap. Once you have created this snapshot as a logical device or logical volume, there's a read-only copy of the data in source FS. You have to mount this device in order to work with this data.
- Mount your snapshot device by issuing smitty mntsnap. You have to provide a directory name over which AIX will mount the snapshot. Once mounted, this device will be read-only.
# snapshot -o snapfrom=$FILESYSTEM -o size=${SNAPSIZE}MWhere $FILESYSTEM is the mount point of your file system and $SNAPSIZE is the amount of megabytes to reserve for the snapshot.
Check if a file system holds a snapshot:
# snapshot -q $FILESYSTEMWhen the snapshot runs full, it is automatically deleted. Therefore, create it large enough to hold all changed data of the source FS.
Mounting the snapshot:
Create a directory:
# mkdir -p /snapshot$FILESYSTEMFind the logical device of the snapshot:
# SNAPDEVICE=`snapshot -q $FILESYSTEM | grep -v ^Snapshots | grep -v ^Current | awk '{print $2}'`Mount the snapshot:
# mount -v jfs2 -o snapshot $SNAPDEVICE /snapshot$FILESYSTEMNow you can backup your data from the mountpoint you've just mounted.
When you're finished with the snapshot:
Unmount the snapshot filesystem:
# unmount /snapshot$FILESYSTEMRemove the snapshot:
# snapshot -d $SNAPDEVICERemove the mount point:
# rm -rf /snapshot$FILESYSTEMWhen you restore data from a snapshot, be aware that the backup of the snapshot is actually a different file system in your backup system, so you have to specify a restore destination to restore the data to.
Topics: AIX, Security, System Admin↑
Portmir
A very nice command to use when you either want to show someone remotely how to do something on AIX, or to allow a non-root user to have root access, is portmir.
First of all, you need 2 users logged into the system, you and someone else. Ask the other person to run the tty command in his/her telnet session and to tell you the result. For example:
user$ ttyNext, start the portmirror in your own telnet session:
/dev/pts/1
root# portmir -t /dev/pts/1(Of course, fill in the correct number of your system; it won't be /dev/pts/1 all the time everywhere!)
Now every command on screen 1 is repeated on screen 2, and vice versa. You can both run commands on 1 screen.
You can stop it by running:
# portmir -oIf you're the root user and the other person temporarily requires root access to do something (and you can't solve it by giving the other user sudo access, hint, hint!), then you can su - to root in the portmir session, allowing the other person to have root access, while you can see what he/she is doing.
You may run into issues when you resize a screen, or if you use different types of terminals. Make sure you both have the same $TERM setting, i.e.: xterm. If you resize the screen, and the other doesn't, you may need to run the tset and/or the resize commands.
IBM License Use Management (LUM) is the IBM product for technical software license management deployed by most IBM use-based priced software products, such as the C Compiler.
More info on:
License Use Management
License Use Management - Library
If you wish to put AIX files on a CD, you *COULD* use Windows. But, Windows files have certain restrictions on file length and permissions. Also, Windows can't handle files that begin with a dot, like ".toc", which is a very
important file if you wish to burn installable filesets on a CD.
How do you solve this problem?
- Put all files you wish to store on a CD in a separate directory, like: /tmp/cd
- Create an ISO file of this directory. You'll need mkisofs to accomplish this. This is part of the AIX Toolbox for Linux. You can find it in /opt/freeware/bin.
# mkisofs -o /path/to/file.iso -r /tmp/cd
- This will create a file called file.iso. Make sure you have enough storage space.
- Transfer this file to a PC with a CD-writer in it.
- Burn this ISO file to CD using Easy CD Creator or Nero.
- The CD will be usable in any AIX CD-ROM drive.
Topics: AIX, System Admin↑
Printing to a file
To create a printer queue that dumps it contents to /dev/null:
# /usr/lib/lpd/pio/etc/piomkpq -A 'file' -p 'generic' -d '/dev/null' -D asc -q 'qnull'This command will create a queue named "qnull", which dumps its output to /dev/null.
To print to a file, do exactly the same, except, change /dev/null to the /complete/path/to/your/filename you like to print to. Make sure the file you're printing to exists and has the proper access rights.
Now you can print to this file queue:
# lpr -Pqfile /etc/motdand the contents of your print will be written to a file.
Let's say you wish to calculate with dates within a Korn Shell script, for example "current date minus 7 days". How do you do it? There's a tiny C program that can do this for you, called ctimed. You can download it here: ctimed.tar.
Executable ctimed uses the UNIX Epoch time to calculate. UNIX counts the number of seconds passed since Januari 1, 1970, 00:00.
So, how many seconds have passed since 1970?
# current=`./ctimed now`This should give you a number well over 1 billion.
How many seconds is 1 week? (7 days, 24 hours a day, 60 minutes an hour, 60 seconds an hour):
# let week=7*24*60*60# let aweekago="$current-$week" Convert this into human readable format:
# ./ctimed $aweekagoYou should get something like: Sat Sep 17 13:50:26 2005
Topics: AIX, System Admin↑
Determining microcodes
A very usefull command to list microcodes is lsmcode:
# lsmcode -c
An AIX system should have a single default gateway defined. However, sometimes, it does occur that a system has multiple default gateways. Here's information to detect multiple default gateways and how to get rid of them:
First, obtain how many gateways there are:
# odmget -q "attribute=route" CuAt
CuAt:
name = "inet0"
attribute = "route"
value = "net,-hopcount,0,,0,192.168.0.1"
type = "R"
generic = "DU"
rep = "s"
nls_index = 0
CuAt:
name = "inet0"
attribute = "route"
value = "net,-hopcount,0,,0,192.168.0.2"
type = "R"
generic = "DU"
rep = "s"
nls_index = 0
If there are more than one, you need to remove the excess route. For example, to remove the default route to 192.168.0.2:
# chdev -l inet0 -a delroute="net,-hopcount,0,,0,192.168.0.2"
Method error (/usr/lib/methods/chginet):
0514-068 Cause not known.
0821-279 writing to routing socket: The process does not exist.
route: not in table or multiple matches
0821-207 chginet: Cannot add route record to CuAt.
Then verify again:
# odmget -q "attribute=route" CuAt
CuAt:
name = "inet0"
attribute = "route"
value = "net,-hopcount,0,,0,192.168.0.1"
type = "R"
generic = "DU"
rep = "s"
nls_index = 0


