Sunday, May 4, 2008

AIX how to mirror rootdisk

server1:/ # lspv more
hdisk0 0024b7fafa266f89 old_rootvg
hdisk1 0024b7fafa266fbf rootvg active
hdisk2 0024b7fa1937be52 user128vg active
hdisk3 0024b7fa1937c5de user128vg active
server1:/ # alt_rootvg_op -X old_rootvg
server1:/ # extendvg rootvg hdisk0
0516-1398 extendvg: The physical volume hdisk0, appears to belong to another volume group. Use the force option to add this physical volume to a volume group.
0516-792 extendvg: Unable to extend volume group.
server1:/ # lspv more
hdisk0 0024b7fafa266f89 None
hdisk1 0024b7fafa266fbf rootvg active
hdisk2 0024b7fa1937be52 user128vg active
hdisk3 0024b7fa1937c5de user128vg active
server1:/ # extendvg -f rootvg hdisk0
server1:/ # lspv more
hdisk0 0024b7fafa266f89 rootvg active
hdisk1 0024b7fafa266fbf rootvg active
hdisk2 0024b7fa1937be52 user128vg active
hdisk3 0024b7fa1937c5de user128vg active
server1:/ #
server1:/ # mirrorvg rootvg hdisk0
0516-1804 chvg: The quorum change takes effect immediately.
0516-1126 mirrorvg: rootvg successfully mirrored, user should perform bosboot of system to initialize boot records. Then, user must modify bootlist to include: hdisk0 hdisk1.
server1:/ #
server1:/ # syncvg -v rootvg
server1:/ # bosboot -ad /dev/hdisk0
bosboot: Boot image is 35429 512 byte blocks.
server1:/ # bootlist -m normal hdisk0 hdisk1
server1:/ # lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 2 2 closed/syncd N/A
hd6 paging 26 52 2 open/syncd N/A
hd8 jfslog 1 2 2 open/syncd N/A
hd4 jfs 2 4 2 open/syncd /
hd2 jfs 16 32 2 open/syncd /usr
hd9var jfs 15 30 2 open/syncd /var
hd3 jfs 2 4 2 open/syncd /tmp
hd1 jfs 2 4 2 open/syncd /home
usr_local jfs 40 80 2 open/syncd /usr/local
candlelv jfs 1 2 2 open/syncd /usr/candle
httpserver jfs 1 2 2 open/syncd /usr/HTTPServer
apps_apl jfs 1 2 2 open/syncd /apps/apl
hd10opt jfs 1 2 2 open/syncd /opt
apps jfs 2 4 2 open/syncd /apps
hd7 sysdump 3 3 1 open/syncd N/A
ca_uni jfs 2 4 2 open/syncd /ca_uni
syswork jfs 1 2 2 open/syncd /syswork
usr_ai_lv jfs 1 2 2 open/syncd /usr/ai
server1:/ # lsvg -p rootvg
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk1 active 546 428 106..35..69..109..109
hdisk0 active 546 431 109..35..69..109..109
server1:/ #shutdown -Fr

Solaris vxvm unencapsulate rootdisk

If your system partitions (/, swap, /usr, /var) are located on more than one physical disk, you will have to manually "unencapsulate" your root disk instead of using Veritas' vxunroot command below.

1. Modify /etc/vfstab to reference the cxtxdxsx devices instead of the VxVM devices. There should be a file vfstab.prevm, use this one if it is there

2. Comment out the lines in /etc/system between:

* vxvm_START (do not remove)
* vxvm_END (do not remove)

3. Run the following command to prevent VxVM from starting up after reboot:

touch /etc/vx/reconfig.d/state.d/install-db

4. Reboot the system. After the reboot, you may uninstall VxVM if needed.


System partitions on boot disk
The Veritas vxunroot command is used to unencapsulate a root disk that contains all your system partitions. However, if the root disk is mirrored, you have to remove the mirror plexes.

Example:

# /etc/vx/bin/vxunroot

This operation will convert the following file systems from
volumes to regular partitions: root swap usr var opt home

ERROR: There are 2 plexes associated with volume rootvol
The vxunroot operation cannot proceed.

Listing of all volumes in rootdg:

# vxprint -v -g rootdg
TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0
v opt gen ENABLED 4198392 - ACTIVE - -
v rootvol root ENABLED 1050776 - ACTIVE - -
v swapvol swap ENABLED 4198392 - ACTIVE - -
v usr gen ENABLED 4198392 - ACTIVE - -
v var gen ENABLED 4198392 - ACTIVE - -

Here we see that rootdg contains volumes opt, rootvol, swapvol, usr, and var. Let's see if the volumes consist of more than one plex.

# vxprint opt rootvol swapvol usr var
Disk group: rootdg

TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0
v opt gen ENABLED 4198392 - ACTIVE - -
pl opt-01 opt ENABLED 4198392 - ACTIVE - -
sd rootdisk-04 opt-01 ENABLED 4198392 0 - - -
pl opt-02 opt ENABLED 4198392 - ACTIVE - -
sd rootdisk-mirror-01 opt-02 ENABLED 4198392 0 - - -

v rootvol root ENABLED 1050776 - ACTIVE - -
pl rootvol-01 rootvol ENABLED 1050776 - ACTIVE - -
sd rootdisk-B0 rootvol-01 ENABLED 1 0 - - Block0
pl rootvol-02 rootvol ENABLED 1050776 - ACTIVE - -
sd rootdisk-02 rootvol-01 ENABLED 1050775 1 - - -

v swapvol swap ENABLED 4198392 - ACTIVE - -
pl swapvol-01 swapvol ENABLED 4198392 - ACTIVE - -
sd rootdisk-01 swapvol-01 ENABLED 4198392 0 - - -
pl swapvol-02 swapvol ENABLED 4198392 - ACTIVE - -
sd rootdisk-mirror-03 swapvol-02 ENABLED 4198392 0 - - -

v usr gen ENABLED 4198392 - ACTIVE - -
pl usr-01 usr ENABLED 4198392 - ACTIVE - -
sd rootdisk-03 usr-01 ENABLED 4198392 0 - - -
pl usr-02 usr ENABLED 4198392 - ACTIVE - -
sd rootdisk-mirror-04 usr-02 ENABLED 4198392 0 - - -

v var gen ENABLED 4198392 - ACTIVE - -
pl var-01 var ENABLED 4198392 - ACTIVE - -
sd rootdisk-05 var-01 ENABLED 4198392 0 - - -
pl var-02 var ENABLED 4198392 - ACTIVE - -
sd rootdisk-mirror-05 var-02 ENABLED 4198392 0 - - -

VM disk rootdisk-mirror contains mirror plexes for volumes opt,rootvol, swapvol, usr, and var. We have to remove the plexes before proceeding with vxunroot.

# vxplex -o rm dis opt-02 rootvol-02 swapvol-02 usr-02 var-02

# vxprint opt rootvol swapvol usr var
Disk group: rootdg

TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0
v opt gen ENABLED 4198392 - ACTIVE - -
pl opt-01 opt ENABLED 4198392 - ACTIVE - -
sd rootdisk-04 opt-01 ENABLED 4198392 0 - - -

v rootvol root ENABLED 1050776 - ACTIVE - -
pl rootvol-01 rootvol ENABLED 1050776 - ACTIVE - -
sd rootdisk-B0 rootvol-01 ENABLED 1 0 - - Block0
sd rootdisk-02 rootvol-01 ENABLED 1050775 1 - - -

v swapvol swap ENABLED 4198392 - ACTIVE - -
pl swapvol-01 swapvol ENABLED 4198392 - ACTIVE - -
sd rootdisk-01 swapvol-01 ENABLED 4198392 0 - - -

v usr gen ENABLED 4198392 - ACTIVE - -
pl usr-01 usr ENABLED 4198392 - ACTIVE - -
sd rootdisk-03 usr-01 ENABLED 4198392 0 - - -

v var gen ENABLED 4198392 - ACTIVE - -
pl var-01 var ENABLED 4198392 - ACTIVE - -
sd rootdisk-05 var-01 ENABLED 4198392 0 - - -

# /etc/vx/bin/vxunroot

This operation will convert the following file systems from
volumes to regular partitions: root swap usr var opt home

Replace volume rootvol with c0t0d0s0.

This operation will require a system reboot. If you choose to
continue with this operation, system configuration will be updated
to discontinue use of the volume manager for your root and swap
devices.

Do you wish to do this now [y,n,q,?] (default: y)

After a reboot, the root disk will be unencapsulated
.

Solaris printer administration

Configuring Print Clients
There are a couple of utilities you can use to create print clients:

Admintool -- to be used for Solaris 2.6 and Solaris 7
The printmgr utility in Solaris 8 (in /usr/sadm/admin/bin)
However, they both execute the same commands:

# lpadmin -p banana -s server!remote-queue
Note that:
# enable banana
# accept banana
banana is the queue you are creating to print to on the client.
server is the machine you are sending the print job to.
remote-queue is the name of the print queue on the machine you are sending the print job to.
If the remote-queue is the same as the queue you are creating on the client then you won't need the !remote-queue part of the command.

Saturday, May 3, 2008

AIX Print queue administration

To Check AIX Print Queue

root@XXXXX143 # date; qchk -q -P XXXXXP0P350

Sat Apr 22 08:21:27 DFT 2006

Queue Dev Status Job Files User PP % Blks Cp Rnk

________________________________________________

HOUOSP0 @houh READY

HOUOSP0P350:

HOUOSP0P350:

HOUOSP0P350:

HOUOSP0P350:

HOUOSP0P350:





PRINTERS / PRINT QUEUES

splp (device) Displays/changes printer driver settings
splp /dev/lp0

export $LPDEST="pqname" Set default printer queue for login session

lsvirprt Lists/changes virtual printer attributes.

lsallq Displays all queues

rmvirprt -q queuename -d queuedevice Removes a virtual printer

qpri -#(job No) -a(new priority) Change a queue job priority.

qhld -#(job No) Put a hold on hold
qhld -r #(job No) Release a held job

qchk -A Status of jobs in queues
lpstat
lpstat -p(queue) Status of jobs in a named queue

qcan -x (job No) Cancel a job from a queue
cancel (job No)

enq -U -P(queue) Enable a queue
enable (queue)

enq -D -P(queue) Disable a queue
disable (queue)

qmov -m(new queue) -#(job No) Move a job to another queue

startsrc -s qdaemon Start qdaemon sub-system
lssrc -s qdaemon List status of qdaemon sub-system
stop -s qdaemon Stop qdaemon sub-system

Friday, May 2, 2008

Solaris Vxvm vxdiskadm option 4 replacing failed rootdisk fail

Exact Error Message
"vxvm:vxdg: ERROR: associating disk-media rootdisk with c0t0d0s2: Disk public region is too small"

Details:
Sometimes the above vxdiskadm command will fail. If it does, try to ensure that the disk is replaced with a disk with the same geometry. Use the output from the format command to verify if this is the case:

AVAILABLE DISK SELECTIONS:
0. c0t0d0
/sbus@3,0/SUNW,fas@3,8800000/sd@0,0
1. c2t1d0
/sbus@3,0/SUNW,fas@0,8800000/sd@1,0

If needed, the "public" and "private" lines from an output from vxdisk list c#t#d# of each device can be compared to confirm that the size is the same, although the disk will have to be initialized before this will work. (vxdisk list c#t#d# shows the same private/public configuration). Now that the disks have been established to be the same, an attempt can be made to manually mirror the volumes rather than use vxdiskadm:


The following is an example output of "vxdisk list" command:

DEVICE TYPE DISK GROUP STATUS
c0t0d0s2 sliced - - online
c2t1d0s2 sliced disk01 rootdg online
- - rootdisk rootdg removed was:c0t0d0s2

Run the following commands to completely remove the existence of the rootdisk in order to tidy up the configuration. This will involve disassociating plexes and removing the plexes with their associated subdisks:
Disassociate the plexes. This must be done with all plexes with a "STATE" of "DISABLED REMOVED". They must be done ONE AT A TIME. A plex can be located by looking for a "pl" in the far left column of information in the "vxprint -ht" output.
eg.
vxplex dis rootdiskvol-01
vxplex dis rootvol-01
vxplex dis swapvol-01


Run vxprint -ht to see that the plexes already disassociated
Remove the DISABLED REMOVED plexes and the rootdiskPriv subdisk.

eg.
vxedit -rf rm rootdiskvol-01
vxedit -rf rm rootvol-01
vxedit -rf rm swapvol-01

Remove the disk media name "rootdisk".
vxdg rmdisk rootdisk

Run a vxprint and make sure that all of the items from the "rootdisk" are removed (the original failed disk).

vxprint -htg rootdg


Once the vxprint shows that everything associated with the rootdisk has been removed, use vxdiskadm option 1 to initialize the new disk into rootdg (if not already done). DO NOT accept the default name. Instead, name it "rootdisk" (using the same diskname as previously). After the disk has been initialized, use vxdiskadm option 6 to mirror the volumes on a disk. This should automatically start the recovery process.

Solaris Replacing encapsulated root disk

[Replace the failed disk and boot the node:]

ok boot cdrom -s
...
[Use format and newfs to create partitions and file systems]
[Mount the root file system on a temporary mount point:]
# mount /dev/dsk/c0t0d0s0 /a
[Restore the root file system:]
# cd /a
# ufsrestore rvf /dev/rmt/0
# rm restoresymtable
[Create an empty install-db file:]
# touch /a/etc/vx/reconfig.d/state.d/install-db
[Edit /etc/system on the temporary file system and
remove or comment out the following entries:]
# rootdev:/pseudo/vxio@0:0
# set vxio:vol_rootdev_is_volume=1
[Edit /etc/vfstab on the temporary file system:]
Example:
Change from—
/dev/vx/dsk/rootdg/rootvol /dev/vx/rdsk/rootdg/rootvol / ufs 1 no-

Change to—
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no -
[Unmount the temporary file system, then check the file system:]
# cd /
# umount /a
# fsck /dev/rdsk/c0t0d0s0
[Install a new boot block:]
# /usr/sbin/installboot /usr/platform/`uname \
-i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0

[Reboot:]
# reboot
[Update the disk ID:]
# cldevice repair /dev/rdsk/c0t0d0
[Encapsulate the disk::]
# vxinstall
Choose to encapsulate the root disk.
[If a conflict in minor number occurs, reminor the rootdg disk group
:]
# umount /global/.devices/node@nodeid
# vxdg reminor rootdg 100
# shutdown -g0 -i6 -y

Solaris HPUX network command differences



Solaris
/usr/sbin/automount
/etc/inet/netmasks
/etc/defaultdomain
/etc/dfs/dfstab
/usr/sbin/share
/usr/sbin/shareall
/etc/resolv.conf
/usr/sbin/in.routed
/etc/defaultrouter
/usr/sbin/unshare
/usr/sbin/unshareall
HPUX 10.0/11.0
/usr/sbin/automount
/etc/rc.config.d/netconf
/etc/rc.config.d/namesvrs
/etc/exports
/usr/sbin/exportfss
/usr/sbin/exportfs -a
/etc/resolv.conf
/usr/sbin/gated
/etc/rc.confi.d/netconf
/usr/sbin/unshare
/usr/sbin/exportfs -au

UNIX: How to print column nicely using printf

[user@hostfwnms1-oam tmp]# cat b.sh printf "%-26s %-19s %-8s %-8s %-s %-s\n" HOSTNAME IP PING SNMPWALK 0-ok 1-fail for i in `cat n...