You may run into an issue with opening a virtual terminal window on an OLD HMC version (version 3.3.6). You can access the HMC through ssh, but opening a terminal window doesn't work. This ocurs when the HMC is in use for a full system partition on a frame:
At the fist attempt to login through ssh to the HMC and running vtmenu:
# ssh -l hscroot hmc
hscroot@hmc's password:
hscroot@lawhmc2:~> vtmenu
Retrieving name of managed system(s) . . .
----------------------------------------------------------
Managed Systems:
----------------------------------------------------------
1) 10XXXXX-XXXX
2) 10YYYYY-YYYY
3) 10ZZZZZ-ZZZZ
Enter Number of Managed System. (q to quit): 3
----------------------------------------------------------
Partitions On Managed System: 10ZZZZZ-ZZZZ
----------------------------------------------------------
Enter Number of Running Partition (q to quit):
Here's where you may get stuck.
Vtmenu allows you to select a frame, but won't show show any partition to start a virtual terminal window on. Seems obvious, because there aren't any partitions available (fullSystemPartition only).
The solution is to run:
mkvterm -m 10ZZZZZ-ZZZZ. This opens the virtual terminal window all right. When you're done, you can log out by using "~.". And if someone else is using the virtual terminal window, and you wish to close that virtual terminal window, run
rmvterm -m 10ZZZZZ-ZZZZ.
In case you're wondering, how to figure out the managed machine name to use with the mkvterm and rmvterm commands, simply run vtmenu first. It shows you a list of managed machines controlled by this HMC.
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$ tty
/dev/pts/1
Next, start the portmirror in your own telnet session:
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 -o
If 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.
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.
Creating a snapshot of a JFS2 file system:
# snapshot -o snapfrom=$FILESYSTEM -o size=${SNAPSIZE}M
Where $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 $FILESYSTEM
When 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$FILESYSTEM
Find 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$FILESYSTEM
Now 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$FILESYSTEM
Remove the snapshot:
# snapshot -d $SNAPDEVICE
Remove the mount point:
# rm -rf /snapshot$FILESYSTEM
When 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.
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.
The entry in /etc/filesystem should look like:
/IsoCD:
dev = /dev/lv09
vfs = cdrfs
mount = false
options = ro
account = false
To unmount:
- Unmount the file system.
- Destroy the logical volume.
To add a PVID to a disk, enter:
# chdev -l vpathxx -a pv=yes
To clear all reservations from a previously used SAN disk:
# chpv -C vpathxx
To monitor all lpars within 1 frame, use:
# topas -C
There are times that you would like to create some "load" on the system. A very, very easy way of keeping a processor very busy is:
# yes > /dev/null
The
yes command will continiously echo "yes" to
/dev/null. This is a single-threaded process, so it will put load on a single processor. If you wish to put load on multiple processors, why not run
yes a couple of times?
If you wish to clone a system with a mksysb, then you can do so, but you do not want your cloned system to come up with the same TCP/IP information. Just issue rmtcpip before creating the mksysb, and you have a perfect image for cloning to another system. Be sure to issue this command at a terminal, as you will lose your network connection!
If you get this error, you probably have one of the following things wrong:
- You've forgotten the slash and semicolon in the find command. Use find command like this:
# find /tmp -mtime +5 -type f -exec rm {} \;
- If you get this error from crontab, then you should add an extra slash to the slash and semicolon. Use the find command like this:
0 2 * * * find /tmp -mtime +5 -type f -exec rm {} \\;
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
Number of results found: 469.
Displaying results: 271 - 280.