Solaris Tips and Tricks

De Le Wiki de Bibiche Solaris Sun Sparc Veritas San Nas Svm Sds Vxfs Vxvm Vmware Zone LiveUpgrade Cfengine OcsInventory Flar Pool Jumpstart Zfs
Aller à : navigation, rechercher

Rename SOlaris 10 server and desactivate DHCP :

-bash-3.2# cat /etc/nodename

slave

-bash-3.2# cat /etc/hostname

slave

-bash-3.2# cat /etc/hostname.e1000g0

slave

-bash-3.2# ls /etc/dh*

/etc/dh_cp.e1000g0

-bash-3.2# cat /etc/inet/hosts  

1             localhost


127.0.0.1       localhost

192.168.0.119   master

192.168.0.139   slave

-bash-3.2# cat /etc/defaultrouter
192.168.0.111

Unknown hostname and DHCP

Actually, there's one snag: most (if not all) cable modem DHCP servers don't provide you with a hostname (even if they did, odds are it won't be one you want anyway!). This wouldn't be a problem, except that the boot scripts (/etc/init.d/rootusr in particular) try to be clever, and set your hostname to "unknown" in this case, which is not at all useful!

The trick is to change your hostname back to the right one, preferably without changing any of the supplied start-up scripts, which are liable to be being stomped on when you upgrade or install a patch. You've also got to do it early enough in the boot process, so that rpcbindsendmail and friends don't get confused by using the wrong hostname. To solve this problem, put this little script in to /etc/init.d/set_hostname, with a symbolic link to it from /etc/rc2.d/S70set_hostname.

#!/sbin/sh

HOSTNAME=`cat /etc/nodename`

echo "Setting hostname to $HOSTNAME... \c"

uname -S $HOSTNAME

echo "Done."

Starting with Solaris 10, the preceding paragraph can be ignored. Instead, just make sure that the hostname you want to use is in /etc/nodename; the contents of that file will then be used to set the hostname. (Note that it is essential that the hostname you put into /etc/nodename is terminated with a carriage return. Breakage will happen if this is not the case.) Also, from Solaris 8 it is possible to tell the DHCP software not to request a hostname from the DHCP server. To do this, remove the token 12 from the PARAM_REQUEST_LIST line in /etc/default/dhcpagent. (/etc/default/dhcpagent describes what the default tokens are; 12 is the hostname, 3 is the default router, 6 is the DNS server, and so on.)


For DHCP : 

1) Create an empty /etc/hostname.hme0 and /etc/dhcp.hme0

2) # ifconfig hme0 plumb
# ifconfig hme0 dhcp start

Network Service on Solaris 10 :

Create a new file called /etc/hostname.eri1 and the only thing to be in this file, is the hostname you determined above (server123i).

# cat /etc/hostname.eri1 server123

Add a new entry to /etc/hosts mapping your new hostname, to it's IP.

# grep server123 /etc/hosts 192.168.1.11 server123

Add a new entry to /etc/netmasks to store the correct netmask for this IP address range.

# grep -v '^#' /etc/netmasks 10.0.1.0 255.255.255.0 192.168.1.0 255.255.255.0

Restart the networking service to have Solaris reload the settings for the interface.

# svcadm restart network/physical

If all went well, you will now have your interface, eri1 configured with the IP you specified, and in the UP state.

# ifconfig eri1 eri1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3 inet 192.168.1.11 netmask ffffff00 broadcast 192.168.1.255 ether 0:f:4d:a4:c4:9e

Connaitre la description d'un service solaris 10:

for i in `svcs -a | awk ' { print $3 } ' | grep svc: `; do echo $i; svcs -l $i|grep name; done

Connaitre l'ID d'un process en fonction d'un port:

for i in `ptree -a | grep -v ptree | awk '{print $1};'` do echo "$i\n";pfiles $i | grep "port: <NO PORT>" done

OU

#!/usr/bin/ksh # # # If you have a Solaris 8, 9 or 10 box and you can't # install lsof, try this. It maps PIDS to ports and vice versa. # It also shows you which peers are connected on which port. # Wildcards are accepted for -p and -P options. # if [ $# -lt 1 ] then echo >&2 "usage: $0 [-p PORT] [-P PID] [-a ALL ] (Wildcards OK)" exit 1 fi while getopts :p:P:a opt do case "${opt}" in p ) port=${OPTARG};; P ) pid=${OPTARG};; a ) all=all;; [?]) # unknown flag echo >&2 "usage: $0 [-p PORT] [-P PID] [-a ALL ] (Wildcards OK) " exit 1;; esac done shift `expr $OPTIND - 1` if [ $port ] then # Enter the port number, get the PID # port=${OPTARG} echo "PID\tProcess Name and Port" echo "_________________________________________________________" for proc in `ptree -a | grep -v ptree | awk '{print $1};'` do result=`pfiles $proc 2> /dev/null| grep "port: $port"` if [ ! -z "$result" ] then program=`ps -fo comm -p $proc | tail -1` echo "$proc\t$program\t$port\n$result" echo "_________________________________________________________" fi done elif [ $pid ] then # Enter the PID, get the port # pid=$OPTARG # Print out the information echo "PID\tProcess Name and Port" echo "_________________________________________________________" for proc in `ptree -a | grep -v ptree | grep $pid| awk '{print $1};'` do result=`pfiles $proc 2> /dev/null| grep port:` if [ ! -z "$result" ] then program=`ps -fo comm -p $pid | tail -1` echo "$proc\t$program\n$result" echo "_________________________________________________________" fi done elif [ $all ] then # Show all PIDs, Ports and Peers # echo "PID\tProcess Name and Port" echo "_________________________________________________________" for pid in `ptree -a | grep -v ptree |sort -n | awk '{print $1};'` do out=`pfiles $pid 2>/dev/null| grep "port:"` if [ ! -z "$out" ] then name=`ps -fo comm -p $pid | tail -1` echo "$pid\t$name\n$out" echo "_________________________________________________________" fi done fi exit 0

Prtdiag :

/usr/platform/`uname -i`/sbin/prtdiag -v | more

''Problème de lancement de service infini au boot :

Reset-all dans l'OBP !!!! oui c'est dingue .... sous solaris10

Fonction raid sur nouveaux serveur solaris : raid hardware :

# raidctl Controller: 0 Volume:c0t0d0 Disk: 0.0.0 Disk: 0.1.0 # raidctl -h raidctl [-f] -C "<disks>" [-r <raid_level>] [-z <capacity>] [-s <stripe_size>] <controller> raidctl [-f] -d <volume> raidctl [-f] -F <filename> <controller1> [<controller2> ...] raidctl [-f] -p "<param>=<value>" <volume> raidctl [-f] -c [-r <raid_level>] <disk1> <disk2> [<disk3> ...] raidctl [-l] raidctl -l -g <disk> <controller> raidctl -l <volume> raidctl -l <controller1> [<controller2> ...] raidctl -a {set | unset} -g <disk> {<volume> | <controller>} raidctl -S [<volume> | <controller>] raidctl -S -g <disk> <controller> raidctl -h

Changer les lcoales localeadm :

bash-3.00# localeadm -a weu -d /packages/solaris_10_0508_x86/ bash-3.00# localeadm -a ceu -d /packages/solaris_10_0508_x86/ bash-3.00# localeadm -a en_US -d /packages/solaris_10_0508_x86/

Prtdiag :

/usr/platform/`uname -i`/sbin/prtdiag -v | more

Monter une image ISO sous solaris :

Given an ISO image in /export/temp/software.iso, a loopback file device (/dev/lofi/1) is created with the following command:

lofiadm -a /export/temp/software.iso /dev/lofi/1 The lofi device creates a block device version of a file. This block device can be mounted to /mnt with the following command:
mount -F hsfs -o ro /dev/lofi/1 /mnt

These commands can be combined into a single command:

mount -F hsfs -o ro `lofiadm -a /export/temp/software.iso` /mnt

Sites Web SUN :
http://www.adminschoice.com/
http://sysunconfig.net/unixtips/solaris.html
http://opensolaris.org/os/community/dtrace/
http://www.tech-recipes.com/solaris.html
http://www.kempston.net/solaris/
http://www.solaris4you.dk/sunsolaris.html

 http://www.gombadi.com/solaris.html

SDS :
http://www.adminschoice.com/docs/solstice_disksuite.htm
http://colin.bitterfield.com/Articles/disksuitemirrors.html
http://www.ncell.com/~russj/DiskSuite-mirror-root.html
http://sunportal.sunmanagers.org/pipermail/summaries/2003-March/003336.html
http://sunportal.sunmanagers.org/pipermail/summaries/2003-March/003336.html
metastat : visu totale sds
metastat -p : seulement les disques
metattach d0 d2
metattach d10 d12
metattach d20 d22
metattach d30 d32
* metadb -i
* metadb -d : suppr
* ajouter metadb : metadb -a -c Nbr cxtxdxsx
*metaoffline pour chq ss miroir
*metastat
SUNWmdx
SUNWmdu
SUNWmdr

Changer HOSTNAME :
/etc/hosts /etc/nodename
/etc/hostname.xxn (xxn = network interface, such as hme0)
/etc/net/ticlts/hosts /etc/net/ticots/hosts
/etc/net/ticotsord/hosts
/etc/inet/ipnodes

Liste Fichiers des packages SUN :
/var/sadm/install/contents

Network Configuration card NDD :
http://www.brandonhutchinson.com/Solaris_NIC_speed_and_duplex_settings.html
ndd /dev/hme ?
ndd /dev/tcp ?
forcer 100 Mo
/usr/sbin/ndd -set /dev/qfe instance 0
/usr/sbin/ndd -set /dev/qfe adv_autoneg_cap 0

JUMPSTART :
http://www.manucomp.com/solaris_tips/jumpstart_preparation_steps.html
http://www.amorin.org/professional/jumpstart.php
http://hvdkooij.xs4all.nl/docs-inst-sol-net.cms
http://www.docbert.org/Solaris/Jumpstart/
http://www.docbert.org/Solaris/Jumpstart/linux.html
http://www.docbert.org/Solaris/
http://www.adminschoice.com/docs/jumpstart_solaris.htm
http://www.manucomp.com/solaris_tips/jumpstart_client_setup.html
http://eradman.com/app/article?code=jumpstart1
http://www.amorin.org/professional/jumpstart.php
http://www.manucomp.com/solaris_tips/jumpstart.html
http://eradman.com/app/printarticle?code=jumpstart1
http://www.transposed.org/techstuff/linux-jumpstart.html
http://www.znark.com/tech/solarisinstall.html
http://www.znark.com/tech/netbootsparc.html
http://www.adminschoice.com/docs/jumpstart_solaris.htm
http://www.bu.edu/systems-support/admin/network/sol/bootserver.html

VERITAS VOLUME MANAGER :
http://www.manucomp.com/solaris_tips/veritas_volume_manager.html

SOLARIS EXPLORER :
http://sunsolve.sun.com/pub-cgi/show.pl?target=explorer/explorer

PACKAGES SUN - PATCHES:

Patch 124672-06 failed to install due to a failure produced by pkgadd.
1. Setting execute permission for all on /var/spool/patch so that the user nobody can read all patch files and execute a pwd in the patch directory hierarchy.
2. Add an account "install" to the system
useradd -u 0 -o -g 1 -c "Install user" -d / -s /bin/true install


http://ftp.ximian.com/pub/ximian-gnome/solaris-9-sun4/
ftp://rpm.rutgers.edu/
http://www.sunfreeware.com/pkgadd.html
http://www.die.net/doc/linux/HOWTO/RPM-for-Unix-HOWTO-9.html
http://www.sunfreeware.com/pkgadd.html
http://www.blastwave.org/pkg-get.php
http://www.tech-recipes.com/solaris_system_administration_tips132.html
pkginfo -l package
pkgadd -d . Rep_pack
Sol6 : 106292-14 pkgadd pb
Sol8 : 110380-06 // 110934-24 // 108989-02 pkgadd pb

SUN CLUSTER PATCH :
http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/patch-access
showrev -p : liste des patches

TEST INTERFACE RESEAU :
netstat -rn -I qfe0 -i 5

NAGIOS :
configurer check_nrpe --disable-ssl sur le serveur nagios
et pareil sur le client solaris

VMWARE :
http://www.samag.com/documents/s=9338/sam0410j/0410j.htm
http://www.tools.de/solaris/xf86/
http://www.vmware.com/support/guestnotes/doc/guestos_solaris10.html
http://chitchat.at.infoseek.co.jp/vmware/soltips.html
kmdconfig : Xorg
Monitor 1280x1024
50-90 Hz
VESA GENERIC VESA
choix 7 : 16

SOLARIS 10 :
ftp://sunfreeware.scarlet.be/pub/freeware/intel/10/
http://mirrors.xmission.com/sunfreeware/intel/10/
http://www.sunfreeware.com/indexintel10.html

CHANGE IP ADDRESS :
http://www.filibeto.org/pipermail/solaris-users/2003-June/000085.html
http://unix.ittoolbox.com/groups/groups.asp?v=SOLARIS-L&i=54052
http://www.dbaoncall.net/references/ht_change_ip_sun.html
http://docs.sun.com/app/docs/doc/816-4554/6maoq01n0?a=view

NETWORK MASKS :
http://docs.sun.com/app/docs/doc/816-4554/6maoq01lk?a=view
/etc/netmasks

CONSOLE :
configurer hyper terminal en liaison série
9600 bps, 8 bits
pas de parté
1 bit de stop
GO ?
rsc
watch-net all
show-nets
devalias
nvalias variable data
setenv local-mac-address? = false : pour le jumpstart

INFO SYSTEM :
prtdiag
inq : liste des disques presents
drvconfig : check des disques existants

ARCHITECTURE SOLARIS :
psrinfo -v
isainfo

PACKAGES :
http://www.geocities.com/arndike/creating_solaris_packages.html
http://bwachter.lart.info/solaris/solpackaging.html
http://www.brandonhutchinson.com/Creating_Solaris_packages.html
http://www.sunfreeware.com/pkgadd.html

DNS :
nscd : process dns a relancer en cas de pb de resolution

LIBRARY 32 et 64 Bits :
- crle -c /var/ld/ld.config -l /lib:/usr/lib:/usr/local/lib:/opt/alct/lib
- crle -64 -c /var/ld/64/ld.config -l /usr/lib/64:/opt/alct/lib/sparcv9

SCSI :
inquire : commande pour lister les periph scsi ...


EEPROM :
http://www.sunmanagers.org/archives/1998/1203.html
Changer param boot à partir du shell :
eeprom
prtconf -vp | grep disk
>>>boot-device=disk mirror
>>>nvramrc=devalias disk /pci@1f,0/pci@1,1/ide@3/disk@0,0
devalias mirror /pci@1f,0/pci@1,1/ide@3/disk@1,0
>>>diag-device=disk mirror

CLAVIER FRANCAIS :
# eeprom kbd-type=French
$­­­­­­­ loadkeys /usr/share/lib/keytables/type_6/france
$­­­­­­­ kbd -l
type=6
layout=8 (0x08)
delay(ms)=500
rate(ms)=40

Copier coller ds OBP : alias disks :
>>show-disks puis CTRL+Y
>>nvalias NOM CTRL+Y+(partition : @0,0 :a)
C0 t0 d0 c0

RECONFIGURE :
Now you\'ll want to reboot and have Solaris reconfigure /dev an /devices. To do this:
touch /reconfigure

AGRANDIR FS :
Growfs –M /rep1 /dev/md/rdsk/d0 : agrandir un montage /rep1 avec le raw device indiqué

ACCES DISQUES - PARTITION :
Iostat –xn 1 : tous les accès disk toutes les sec. // -xnP : par partitions // -xtncz
prtvtoc /dev/dsk/c0t0d0s2 | fmthard –s - /dev/rdsk/c3…s2 : recréer partitionnement

TEMPS D\'EXECUTION D\'UNE COMMANDE :
Ptime command : temps de la commande

CREER FICHIER :
mkfile -nv 100m Fic : créé fichier de 100 mb

DEBUTER avec ZFS :
http://www.opensolaris.org/os/community/zfs/


BOOTING SOLARIS FLASH ARCHIVES :

http://www.adminschoice.com/docs/booting__problems_in_solaris.htm
http://www.adminschoice.com/docs/jumpstart_solaris.htm
http://developers.sun.com/solaris/articles/64_bit_booting.html
http://docs.sun.com/app/docs/doc/819-5776/6n7r9js5c?a=view
http://www.unixgroups.com/showthread.php?p=287313
http://unix.derkeiler.com/Newsgroups/comp.unix.solaris/2005-08/0169.html
http://www.sun.com/bigadmin/content/submitted/flash_archive.html

ZONE SOLARIS :
http://www.blastwave.org/articles/DMC-0002/index.html

JUMPSTART :
http://docs.sun.com/app/docs/doc/817-5506

CONSOLE :
http://blogs.sun.com/salkeld/date/200503
http://www.compsci.wm.edu/SciClone/documentation/hardware/Sun/280R/280R_OG/diags6.htm
http://www.sun.com/products-n-solutions/hardware/docs/html/819-1892-12/post.html
http://www.abix.fr/xxdisplayproduct.asp?ccode=137000&id=6
http://www.gentoo.org/doc/fr/gentoo-sparc-faq.xml
http://www.abix.fr/xxdisplayproduct.asp?ccode=136010&id=6
http://www.sunwizard.net/html/articles/jsp001.html
http://www.openbsd.org/faq/fr/faq7.html
# Les ports sur un SPARC sont appelés ttya, ttyb, etc.
# A la différence des autres plates-formes, il n\'est pas nécessaire de
faire des changements à /etc/ttys pour utiliser une console série.
# Les systèmes SPARC/UltraSPARC interprètent le signal BREAK sur le port
série de la même manière que la commande STOP-A, et renvoient le système
à l\'invite "Forth", stoppant toute application et le système lui même à
ce point. Cela est intéressant lorsque souhaité, mais malheureusement,
quelques terminaux série lors de l\'arrêt et quelques matériels de switch
RS-232 envoient quelques codes à l\'ordinateur que celui-ci interprète
comme un signal BREAK, arrêtant la machine. Testez cela avant de passer
la machine en production.
# Si vous avez un clavier et une souris connectés, vous pouvez toujours
forcer l\'utilisation de la console série en utilisant les commandes
suivantes à l\'invite ok :
ok setenv input-device ttya
ok setenv output-device ttya
ok reset
http://www.freebsdwiki.net/index.php/Sparc_-_Terminal_Emulation
http://www.softpanorama.org/Solaris/Startup_and_shutdown/serial_console_on_solaris.shtml
http://www.help.perle.com/index.asp?a=4&q=89
> >>> CTRL + BREAK sur le port série.
http://www.gentoo.org/doc/en/gentoo-sparc-obpreference.xml


CHANGE NAME HOST :

http://forum.sun.com/jive/thread.jspa?threadID=94568&messageID=325248

GLOBAL SOLARIS TIPS TRICKS :
http://sysunconfig.net/unixtips/solaris.html#accounts

ULTRA 5-10 OBP :
UPDATE : last obp sun 5/10 : sun 106121-18
http://sunsolve.sun.com/search/advsearch.do?collection=PATCH&type=collections&queryKey5=106121&toDocument=yes

Solaris Error messages :
http://www.adminschoice.com/docs/Solaris_Error_Messages_ABCD.htm

Solaris patches :
http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/patch-access

Solaris performance/monotirong :
iostat , vmstat & netstat
http://www.adminschoice.com/docs/iostat_vmstat_netstat.htm

Solaris network :
http://adminschoice.com/docs/solaris_network_configuration.html
http://www.scit.wlv.ac.uk/cgi-bin/mansec?1M+ifconfig
ifconfig le0:1 down unplumb

Solaris security :
http://www.adminschoice.com/docs/securing_solaris.htm

Solaris ex-SDS SVM :
http://www.adminschoice.com/docs/solstice_disksuite.htm

Solaris - Veritas VM :
http://www.adminschoice.com/docs/vxvm.htm
http://www.adminschoice.com/docs/vxassist.htm
http://www.sun.com/products-n-solutions/hardware/docs/Software/Storage_Software/VERITAS_Volume_Manager/index.html

No more Inodes FREE

'''''''''''''''''''''''''''''''''''''''''


  1. df -h

<o:p></o:p>

Filesystem             size   used  avail capacity  Mounted on<o:p></o:p>

/dev/dsk/c1t0d0s0      5.9G   4.9G   926M    85%    /<o:p></o:p>

  1. df -F ufs -o i

Filesystem             iused   ifree  %iused  Mounted on<o:p></o:p>

/dev/dsk/c1t0d0s0     745472       0   100%   /<o:p></o:p>

Et la ca va plus du tout !!!!<o:p></o:p>

On recherché les inodes dans  /var/spool/mqueues

find . -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n<o:p></o:p>

et la,  cata !!!!

on a détruit tout la-dedans et nous revoila bien !!!

#df -F ufs -o i<o:p></o:p>

Filesystem             iused   ifree  %iused  Mounted on<o:p></o:p>

/dev/dsk/c1t0d0s0     191936  553536    26%   /


'''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''