informatique:nix:hp:hpux_tips

Timestamps dans historique

Dans .bash_profile et .profile :

trap 'date "+# %c" | read -s' debug

Activer noms de users longs

/sbin/init.d/pwgr stop
lugadmin -e
/sbin/init.d/pwgr start

Purger wtmps

  • Méthode bourrin
cat /dev/null > /var/adm/wtmps

Console texte sur les ILO2

Au prompt :

</>hpiLO->

Taper textcons.

Pour configurer en clavier français :

textcons xlt 5
textcons xlt 8

can't rewrite terminal control entry

Le / est probablement plein sur la machine en question. Il faut essayer d'ouvrir un shell minimal à distance à partir d'une autre machine (si possible) avec la commande suivante, par exemple :

remsh nomdelamachine /usr/bin/ksh -i

Si ça ne passe pas on peut essayer de se logger en FTP et supprimer des fichiers mais dans ce cas la il faut avoir autorisé root à se logger en FTP et c'est pas top :-\ Ou alors si un reboot peut être envisagé on peut booter en mode single, au prompt :

BO PRI
hpux -is

Faire du ménage puis lancer un init 3

Une vPar ne boote pas

Parfois le boot ne passe pas bien. Il faut la démarrer en mode manuel. Ci-dessous la procédure :

  • A partir d'une autre vPar on désactive le boot :
vparmodify -p bugged_machine -B manual
  • On arrête la partition si elle est bloquée :
vparreset -p bugged_machine -h
  • On démarre en init 1 :
vparboot -p bugged_machine -o "-is"
  • Une fois au prompt on finit le boot à la main :
vgchange -a y vg00
mount -a (+ les fsck si on a fait le step 2 ;-) )
init 3

Récupérer les infos de modifications, accès, etc sur un fichier

machine:/# tusc -v ls /etc/passwd|tail|grep time
                         st_atime: Thu Jun 22 10:41:49 2006
                         st_mtime: Fri Jun 16 10:54:32 2006
                         st_ctime: Fri Jun 16 10:54:32 2006

Console/GSP sous HP-UX

  • breaker une console

Lien vers forums HP-UX

Utiliser <key>C-8</key> ou <key>C-\</key> ou <key>C-S-\</key> ou <key>C-S-8</key> ou <key>Backspace</key>

  • passer d'une console à l'autre (vPar / nPar)

Utiliser <key>C-a</key>

  • Pour sortir

Utiliser <key>C-b</key>

Blocage du boot

Il se peut que le boot bloque juste avant le démarrage de l'OS (HP-UX start up) avec ces messages sur la console :

/sbin/auto_parms: DHCP access is disabled (see /etc/auto_parms.log)

stty: : Not a typewriter
stty: : Not a typewriter
stty: : Not a typewriter

A ce stade on passe en init 3 et les scripts du répertoire /sbin/rc3.d sont lancés. HP-UX scanne les paramètres de ces scripts et cherche le paramètre start_msg. Si un script ne contient pas ce paramètre le boot est bloqué et plus rien n'avance. En général il peut s'agir de quelqu'un qui a créé un script avec seulement les paramètres classiques : start, stop , restart et status.

Dans ce cas il faut booter en init 2 par exemple et trouver le script qui pose problème. Un grep -w start_msg dans /sbin/rc3.d avec une boucle suffit à déterminer le script qui pose problème. Ou bien breaker la console (voir plus haut.)

Boot is Blocked (BIB)

Après avoir resetté une vPar ou une cell, on peut se retrouver face à cette situation (sur le VFP) :

  #  Partition state               Activity
  -  ---------------               --------
  0  Cell(s) Booting:                                                7156 Logs

  #  Cell state                    Activity
  -  ----------                    --------
  0  Boot is blocked (BIB)         BOOT_MONARCH_DONE_CHECKING_SLAVE  2269 Logs
  2  Boot is blocked (BIB)         BOOT_MONARCH_DONE_CHECKING_SLAVE  2277 Logs

En gros rien ne se passe. Dans ce cas il faut booter la partition qui pose problème :

[GSP0] MP> CM


                Enter HE to get a list of available commands



[GSP0] MP:CM> BO

This command boots the selected partition.


  Part#  Name
  -----  ----
     0)  machine1
     1)  machine2

    Select a partition number: 0

    Do you want to boot partition number 0? (Y/[N]) Y

    -> The selected partition will be booted.

Extraire un max d'infos

Lancer la commande /var/PSS/hpux_config qui génère un fichier texte et un fichier html qui contient un paquet d'infos.

Delocker root sur hp-ux trusted edition

Pour locker :

passwd -l <username>

Pour délocker :

/usr/lbin/modprpw -l -k <username>

Retirer le prompt "TERM = (hp)"

Commenter la ligne dans .login :

eval `tset -s -Q -m ':?hp'

Manipulations générales

Scanner les devices

ioscan -funC disk

Installer les devices

insf

Ajouter un device de swap

lvcreate -C y -L 4096 -n lvol1 /dev/vg00
swapon -p 0 /dev/vg00/lvol1
echo "/dev/vg00/lvol1 ... swap pri=0 0 0" >> /etc/fstab

Guidelines for Assigning Swap Priority
http://docs.hp.com/en/B2355-90950/ch06s03.html#gdpri

When you add swap areas, you can assign a priority to each. Priorities range from 0 (the highest) to 10 (the lowest). The system uses the swap areas with higher priority first. The system gives device swap priority over file system swap when each has the same priority. Here are the guidelines you should use:

  • Given multiple swap devices with identical performance, assign each an identical priority. By so doing, you will allow the system to use each of them on an interleaved basis which enhances performance.
  • Assign higher priorities to the swap areas that have faster performance and lower priorities to areas that are slower.
  • Give device swap areas priority over file system swap areas.
  • Give lower use file systems priority over higher use file systems.

The primary swap area has priority 1. Device and file system swap areas set dynamically default to a priority of 1 if no priority is specified.

Retrouver ses disques après la perte d'une baie + reboot serveur

ioscan -fnCdisk
vgchange -a y <le vg>

Ou si le vg est associé à un package

vgchange -a e -q n -s

Recréer les alternate en masse

  • Ménage des anciens dev
ioscan -funC disk | awk '/NO_HW/ { print $3 }' | xargs -t -i rmsf -H {}
  • Récupération de la liste des VGs
liste=`lsvg <VG>|egrep PV|awk '{print $3}'`
  • Recréation des VGs
for dsk in $liste
do
echo $dsk
alterdsk=`echo $dsk|awk '{gsub("c5t","c15t",$1);print $1}'`
echo $alterdsk
vgextend /dev/<VG> $alterdsk
done

Warnings sur disques

vgdisplay: Warning: couldn't query physical volume “/dev/dsk/c9t0d0”: The specified path does not correspond to physical volume attached to this volume group

mv /etc/lvmtab /etc/lvmtab.SAV4
vgscan -avp (pour contrôler)
vgscan -av
vgchange -a y

Lancer un vgsync derrière au cas où.

Activer les IO asynchrones

Dans notre cas nous voulons activer les IO asynchrones pour Sybase. Ci-dessous les étapes nécessaires :

  • Modification des droits sur /dev/async :
chown sybase:bin /dev/async
  • Mettre à les jours privilèges spécifiques pour Sybase (ou le groupe rattaché, ici DBA) :
setprivgrp DBA RTPRIO MLOCK CHOWN

On peut lister les privilèges avec la commande getprivgrp.

  • Vérifier si le kernel prend en charge le driver :
    • HP-UX 11.11
root@SomeMachine:/ kmsystem |head -1;kmsystem |grep sync
Module              Configured          Loadable
asyncdsk            Y                   -
asyncdsk_included   N                   -
  • HP-UX 11.23
SomeMachine:/#kcmodule |head -1;kcmodule|grep sync
Module              State   Cause     Notes
asyncdsk            static  explicit

Si c'est KO il faut ajouter ce module au kernel avec sam par exemple (et donc effectuer un reboot après la recompilation du nouveau kernel).

Mirroring vg00

Après changement de disque :

ioscan -fnC disk
vgcfgrestore -n vg00 /dev/rdsk/cXtYdZ
vgchange -a y vg00
vgsync vg00
lvlnboot –v
mkboot /dev/rdsk/cXtYdZ
mkboot -a "hpux -lq" /dev/rdsk/cXtYdZ
mkboot -b /usr/sbin/diag/lif/updatediaglif -p ISL -p HPUX -p LABEL -p AUTO /dev/rdsk/cXtYdZ
mkboot -b /usr/sbin/diag/lif/updatediaglif2 -p ISL -p HPUX -p LABEL -p AUTO /dev/rdsk/cXtYdZ

Si différent de ci-dessous :

  • setboot
Primary bootpath : 0/0/1/1.0.0
Alternate bootpath : 0/0/2/0.0.0
  • lvlnboot -v
Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
        /dev/dsk/c2t0d0 (0/0/2/0.0.0) -- Boot Disk
        /dev/dsk/c1t0d0 (0/0/1/1.0.0) -- Boot Disk
PV Name: lvol1  on:     /dev/dsk/c2t0d0
                        /dev/dsk/c1t0d0
Root: lvol3     on:     /dev/dsk/c2t0d0
                        /dev/dsk/c1t0d0
Swap: lvol2     on:     /dev/dsk/c2t0d0
                        /dev/dsk/c1t0d0
Dump: lvol2     on:     /dev/dsk/c2t0d0, 0
  • Refaire le lvlnboot
lvlnboot –b /dev/vg00/lvol1
lvlnboot –s /dev/vg00/lvol2
lvlnboot –d /dev/vg00/lvol2
lvlnboot –r /dev/vg00/lvol3
lvlnboot –R

Virer des disques

inq -nodots -sid -sym_wwn |grep -E "13C3|13C7|13CB|13B7|13BB|13BF"|while read a b c d
do
lssf $a|awk '{print "rmsf -H "$15}' |sh
done

Cur PV ≠ Act PV

vgreduce -f /dev/vg_toto
mv /etc/lvmtab /etc/lvmtab.old
vgscan -av

Espace vide sur certains PVs

On peut parfois se retrouver dans ce cas lors de suppressions ratées :

server022:/var/adm/syslog#pvdisplay -v /dev/dsk/c124t7d6 |grep "?" |tail
   06877 current  ???                                00490
   06878 current  ???                                00491
   06879 current  ???                                00492
   06880 current  ???                                00493
   06881 current  ???                                00494
   06882 current  ???                                00495
   06883 current  ???                                00496
   06884 current  ???                                00497
   06885 current  ???                                00498
   06886 current  ???                                00499

L'espace est réservé sur le disque mais n'est plus utilisable. En fait la suppression n'a pas été faite correctement. Il faut le recréer pour pourvoir le supprimer correctement. On récupère les infos sur le VG en question :

server022:/dev/vg_Package1#ls -l|sort -k 6
total 0
crw-rw-rw-   1 root       sys         64 0x020000 Nov 20 10:00 group
brw-r-----   1 root       sys         64 0x020001 Nov 20 10:00 lv_VAS3_sybdata31
crw-r-----   1 sybase     DBA         64 0x020001 Nov 20 10:00 rlv_VAS3_sybdata31
brw-r-----   1 root       sys         64 0x020002 Nov 20 10:00 lv_cftpkg1_23
crw-r-----   1 sybase     DBA         64 0x020002 Nov 20 10:00 rlv_cftpkg1_23
brw-r-----   1 root       sys         64 0x020003 Nov 20 10:00 lv_VAS3_sybdata07
crw-r-----   1 sybase     DBA         64 0x020003 Nov 20 10:00 rlv_VAS3_sybdata07
brw-r-----   1 root       sys         64 0x020004 Nov 20 10:00 lv_VAS3_sybtempdbdat2
crw-r-----   1 sybase     DBA         64 0x020004 Nov 20 10:00 rlv_VAS3_sybtempdbdat2
brw-r-----   1 root       sys         64 0x020005 Nov 20 10:00 lv_VAS3_sybdata08
crw-r-----   1 sybase     DBA         64 0x020005 Nov 20 10:00 rlv_VAS3_sybdata08

brw-r-----   1 root       sys         64 0x020007 Nov 20 10:00 lv_esycomore
crw-r-----   1 sybase     DBA         64 0x020007 Nov 20 10:00 rlv_esycomore
brw-r-----   1 root       sys         64 0x020008 Feb  2 10:38 lv_VAS3_sybtempdblog4
crw-r-----   1 sybase     DBA         64 0x020008 Feb  2 10:38 rlv_VAS3_sybtempdblog4
brw-r-----   1 root       sys         64 0x02000b Nov 20 10:00 lv_VAS3_sybmaster

On trie sur les minors pour trouver celui qui manque dans le VG :

0x020005

0x020007

:!: on peut aussi retrouver ces infos en restaurant le device avec TSM.

Puis on recréé le device avec un nom bidon :

server022:/dev/vg_Package1#mknod rtoto c 64 0x020006
server022:/dev/vg_Package1#mknod toto b 64 0x020006
server022:/dev/vg_Package1#ls -l *toto
crw-r--r--   1 root       sys         64 0x020006 Feb  2 14:36 rtoto
brw-r--r--   1 root       sys         64 0x020006 Feb  2 14:36 toto

On vérifie :

server022:/dev/vg_Package1#pvdisplay -v /dev/dsk/c124t7d6 |grep -c "?"h
0
server022:/dev/vg_Package1#lvdisplay /dev/vg_Package1/toto |head -5
--- Logical volumes ---
LV Name                     /dev/vg_Package1/toto
VG Name                     /dev/vg_Package1
LV Permission               read/write
LV Status                   available/syncd

On peut enfin supprimer le LV avec lvremove. Sur un cluster ne pas oublier de synchroniser les maps.

Bravo root.

Renommer un disque au nom désagréable

server502:/appli# ls -l
total 48
drwxr-xr-x  16 root       sys           8192 Aug  7  2009 Package1
drwxr-xr-x   6 root       sys             96 Oct 26 11:12 Package2
drwxr-xr-x  11 root       sys           8192 Jul 17  2006 Package3
drwxr-xr-x   8 root       sys           8192 Sep 28  2005 Package4
drwxr-xr-x   3 root       sys             96 Oct 26 10:40 Package2

ls -lb   (-b   List nonprinting characters in the octal \ddd notation.)

total 48
drwxr-xr-x  16 root       sys           8192 Aug  7  2009 Package1
drwxr-xr-x   6 root       sys             96 Oct 26 11:12 Package2
drwxr-xr-x  11 root       sys           8192 Jul 17  2006 Package3
drwxr-xr-x   8 root       sys           8192 Sep 28  2005 Package4
drwxr-xr-x   3 root       sys             96 Oct 26 10:40 Packgae2\010\010\010\010age2
  • Les directory ont bien un nom differents avec des caracteres speciaux, on recupère l'inode de la directory (l'inode est unique par FS)
ls -lib /appli
total 48
  3784 drwxr-xr-x  16 root       sys           8192 Aug  7  2009 Package1
  3774 drwxr-xr-x   6 root       sys             96 Oct 26 11:12 Package2
  3780 drwxr-xr-x  11 root       sys           8192 Jul 17  2006 Package3
  3785 drwxr-xr-x   8 root       sys           8192 Sep 28  2005 Package4
 10869 drwxr-xr-x   3 root       sys             96 Oct 26 10:40 Packgae2\010\010\010\010age2
  • On check
 
find /appli/ -xdev -inum 10869
/appli/Package2

find /appli/ -xdev -inum 10869 -exec ls -libd {} \;
 10869 drwxr-xr-x   3 root       sys             96 Oct 26 10:40 /appli/Packgae2\010\010\010\010age2
  • On renomme la directory foireuse en toto
find /appli/ -xdev -inum 10869 -exec mv {} toto \;
ll

total 48
drwxr-xr-x  16 root       sys           8192 Aug  7  2009 Package1
drwxr-xr-x   6 root       sys             96 Oct 26 11:12 Package2
drwxr-xr-x  11 root       sys           8192 Jul 17  2006 Package3
drwxr-xr-x   8 root       sys           8192 Sep 28  2005 Package4
drwxr-xr-x   3 root       sys             96 Oct 26 10:40 toto

Autre technique plus amusante :

printf %b "Packgae2\010\010\010\010age2 toto\n"|xargs -n2 mv
  • informatique/nix/hp/hpux_tips.txt
  • Dernière modification : 2017/06/23 09:58
  • de 127.0.0.1