20 mins read

Tip & Tricks Sun Solaris

Quelques trucs et astuces pour Sun Solaris

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

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:
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 1280×1024
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


Installing an Ethernet Card

To install an additional Ethernet interface (let's call it le1):

1) Put the card in and from the ok> prompt do a boot -r

1) create /etc/hostname.le1 that contains the host name

2) make the interface known to the system:

ifconfig le1 plumb

3) configure the interface:

ifconfig le1 up netmask + broadcast +

4) test the connection

Sun Network Interface Duplex

Checking and setting the link parameters of Sun hme network interfaces requires the use of the ndd command. The procedure for qfe interfaces is similar, except that the instance must be specified. For example, the Sun QuadFast Ethernet card would have instances 0-3: qfe0, qfe1, qfe2, qfe3.

Checking the current running speed(s):

Choose the interface instance:

# ndd -set /dev/qfe instance 0

That selects the first instance: qfe0. Note that the default instance is 0.

Check the status, speed & mode:

# ndd -get /dev/qfe link_status

1 = up

0 = down

# ndd -get /dev/qfe link_speed

1 = 100 Mb

0 = 10 Mb

# ndd -get /dev/qfe link_mode

1 = Full Duplex (FDX)

0 = Half Duplex (HDX)

Hot to configure individual interfaces via ndd commands:

These commands are usually placed in a startup script such as /etc/rc2.d/S99qfe.

Hot to force 100Mbs Full Duplex (FDX) on qfe1:

ndd -set /dev/qfe instance 1

ndd -set /dev/qfe adv_100T4_cap 0

ndd -set /dev/qfe adv_100fdx_cap 1

ndd -set /dev/qfe adv_100hdx_cap 0

ndd -set /dev/qfe adv_10fdx_cap 0

ndd -set /dev/qfe adv_10hdx_cap 0

ndd -set /dev/qfe adv_autoneg_cap 0

It is important to run these commands in the above order. The link will be renegotiated when the final command is run.

Tape Control -the mt Command:

This assume that the device is at the 0 address.

Shows whether device is valid, whether tape is loaded, and status of tape

mt -f /dev/rmt/0 status:

Rewinds tape to start

mt -f /dev/rmt/0 rewind:

Shows table of contents of archive. If tar tvf produces an error, then there are no more records on the tape.

tar tvf /dev/rmt/0:

Advanced to the next archive on the tape.

mt -f /dev/rmt/0 fsf:

Moves the tape to the end of the last archive that it can detect.

mt -f /dev/rmt/0 eom:

Erases the tape. Use with care.

mt -f /dev/rmt/0 erase:

Ejects the tape, if the device supports that option.

mt -f /dev/rmt/0 offline:

To extract lengthy archives even if you plan to log out, use the nohup command as follows:

nohup tar xvf /dev/rmt/0 &

Solstice Disksuite is a free RAID volume manager from Sun Microsystems.

This article describes the method of mirroring a boot drive using Solstice Disksuite via the command line.

Solstice Disksuite comes bundled with the Solaris 8 operating system.

Install Solstice Disksuite 4.2.1 on Solaris 8

Insert 2 of 2 software for Solaris 8

 

# CD /cdrom/sol_8_1000_sparc_2/Solaris_8/EA/products/DiskSuite_4.2.1/sparc/Packages

I usually install all the packages even though I do not use the GUI.

 

# pkgadd -d .

The following packages are available:

  1  SUNWlvma     Solaris Volume Management API's
(sparc) 1.0,REV=2001.07.25.13.05
2 SUNWlvmg Solaris Volume Management Application
(sparc) 1.0,REV=2001.07.25.13.05
3 SUNWlvmr Solaris Volume Management (root)
(sparc) 1.0,REV=2001.07.25.13.05
4 SUNWmdg Solstice DiskSuite Tool
(sparc) 4.2.1,REV=1999.11.04.18.29
5 SUNWmdja Solstice DiskSuite Japanese localization
(sparc) 4.2.1,REV=1999.12.09.15.37
6 SUNWmdnr Solstice DiskSuite Log Daemon Configuration Files
(sparc) 4.2.1,REV=1999.11.04.18.29
7 SUNWmdnu Solstice DiskSuite Log Daemon
(sparc) 4.2.1,REV=1999.11.04.18.29
8 SUNWmdr Solstice DiskSuite Drivers
(sparc) 4.2.1,REV=1999.12.03.10.00
9 SUNWmdu Solstice DiskSuite Commands
(sparc) 4.2.1,REV=1999.11.04.18.29
10 SUNWmdx Solstice DiskSuite Drivers(64-bit)
(sparc) 4.2.1,REV=1999.11.04.18.29

Select package(s) you wish to process (or 'all' to process all packages). (default: all) [?,??,q]: all

Reboot the server after the successful installation.

 

# init 6

Prepare the drives for SDS

SDS uses metadevice state databases to store information on disk about the state of your DiskSuite configuration. The metadevice state database records and tracks changes made to your configuration. These databases must reside on a dedicated slice(in the case of a boot drive). I typically leave about 10MB of unused space on the boot drive when installing Solaris for these databases.

Disksuite has the following rules with respect to the use of database replicas:

The system will not boot unless more than half of the replicas are available The system will panic if more than half of the replicas are corrupt.

If one of your drives fail, and the system is rebooted for any reason it will not automatically boot in a two disk mirror configuration. You can disable the feature by setting the following system parameter:

 

# echo "set md:mirrored_root_flag=1" >> /etc/system

The output from format of my boot disk looks like the following.

Total disk cylinders available: 24620 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 root wm 0 - 283 400.62MB (284/0/0) 820476
1 var wm 284 - 1701 1.95GB (1418/0/0) 4096602
2 backup wm 0 - 24619 33.92GB (24620/0/0) 71127180
3 swap wu 1702 - 3136 1.98GB (1435/0/0) 4145715
4 unassigned wm 3137 - 3144 11.29MB (8/0/0) 23112
5 unassigned wm 3145 - 5271 2.93GB (2127/0/0) 6144903
6 usr wm 5272 - 11652 8.79GB (6381/0/0) 18434709
7 home wm 11653 - 24619 17.86GB (12967/0/0) 37461663

The partition table of the mirrored drive should be identical to the boot drive. Copy the partition table of the boot drive to its mirror.

 

# prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s – /dev/rdsk/c0t1d0s2

fmthard: New volume table of contents now in place

In this case c0t0d0s2 is the boot drive and c0t1d0s2 is the mirror.

 

# metadb -a -f -c2 /dev/dsk/c0t0d0s4 /dev/dsk/c0t1d0s4

Create the mirror for / filesystem

# metainit -f d10 1 1 c0t0d0s0
d10: Concat/Stripe is setup
# metainit d20 1 1 c0t1d0s0
d20: Concat/Stripe is setup
# metainit d30 -m d10
d30: Mirror is setup
# metaroot d30

Create the mirror for all other filesystems

/var filesystem:
# metainit -f d11 1 1 c0t0d0s1
# metainit d21 1 1 c0t1d0s1
# metainit d31 -m d11

Swap filesystem:
# metainit -f d13 1 1 c0t0d0s3
# metainit d23 1 1 c0t1d0s3
# metainit d33 -m d13

/opt filesystem:
# metainit -f d15 1 1 c0t0d0s5
# metainit d25 1 1 c0t1d0s5
# metainit d35 -m d15

/usr filesystem:
# metainit -f d16 1 1 c0t0d0s6
# metainit d26 1 1 c0t1d0s6
# metainit d36 -m d16

/export/home filesystem:
# metainit -f d17 1 1 c0t0d0s7
# metainit d27 1 1 c0t1d0s7
# metainit d37 -m d17

Edit the /etc/vfstab to mount the new mirrors on boot.

Before :

#device         device          mount           FS      fsck    mount   mount
#to mount to fsck point type pass at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c0t0d0s3 - - swap - no -
/dev/md/dsk/d30 /dev/md/rdsk/d30 / ufs 1 no -
/dev/dsk/c0t0d0s6 /dev/rdsk/c0t0d0s6 /usr ufs 1 no -
/dev/dsk/c0t0d0s1 /dev/rdsk/c0t0d0s1 /var ufs 1 no -
/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs 2 yes -
/dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s5 /opt ufs 2 yes -
swap - /tmp tmpfs - yes -

After :

#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr          ufs     1       yes     -
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/md/dsk/d33 - - swap - no -
/dev/md/dsk/d30 /dev/md/rdsk/d30 / ufs 1 no -
/dev/md/dsk/d36 /dev/md/rdsk/d36 /usr ufs 1 no -
/dev/md/dsk/d31 /dev/md/rdsk/d31 /var ufs 1 no -
/dev/md/dsk/d37 /dev/md/rdsk/d37 /export/home ufs 2 yes -
/dev/md/dsk/d35 /dev/md/rdsk/d35 /opt ufs 2 yes -
swap - /tmp tmpfs - yes -

Suppress warning messages

# metainit hsp001

Attach the second submirror to the mirror. This will cause the data from the boot disk to be synchronized with the mirrored drive.

# metattach d30 d20
# metattach d31 d21
# metattach d33 d23
# metattach d35 d25
# metattach d36 d26
# metattach d37 d27

you will hear alot of disk thrashing at this point and your i/o will go through the roof.

Use metastat to track progress

 

# metastat

I like to use this one when i'm watching though. it looks more impressive

# metastat | grep %

Enable the mirror disk to be bootable:

# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t1d0s0

# ls -l /dev/rdsk/c0t1d0s0

lrwxrwxrwx 1 root root 45 Sep 8 11:25 /dev/rdsk/c0t1d0s0 -> ../../devices/pci@1f,4000/scsi@3/sd@1,0:a,raw

This is the device path that you will use to define the alternate boot device at the hardware level.

ok nvalias mirror /pci@1f,4000/scsi@3/sd@1,0:a,raw

Issue a "show-disks" at the ok prompt to verify the correct path to the disk. Use "devalias" at the ok prompt to also give clues as to which device path to use.

In case of primary boot disk failure, boot from the alternate disk

 

ok boot mirror

Recréer liens lecteurs de bandes:
If you remove or add a device on Solaris then the devices files must be recreated, either with boot -rv or devfsadm. For example to renumber the logical tape drive devices do the following: Tape drives were numbered beginning with /dev/rmt/3 instead of /dev/rmt/0. The physical devices pointed to by the logical /dev/rmt/[012] devices no longer existed, and we wanted to renumber the valid devices beginning at /dev/rmt/0.
1. Cleanup non-existent tape drive devices with devfsadm.

# devfsadm -C -c tape -v
2. Remove all /dev/rmt logical links.
# rm -f /dev/rmt/*
3. Recreate all /dev/rmt logical links with devfsadm
# devfsadm -c tape -v

Démarrage service réseau en single

/etc/init.d/inetinit start
/etc/init.d/inetsvc start

script pour monter une image iso
#!/bin/ksh
if [ $# -eq 0 ] ; then
lofiadm
else
ISOREP=$PWD
ISOIMG=$1
lofiadm | grep « lofi » > /dev/null
if [ $? -eq 0 ] ; then
echo « Suppression de l ancien point de montage… »
umount /cdrom > /dev/null
lofiadm -d /dev/lofi/1
fi
lofiadm -a ${ISOREP}/${ISOIMG} /dev/lofi/1
mount -F hsfs -o ro /dev/lofi/1 /cdrom
fi

Laisser un commentaire