Showing posts with label Solaris. Show all posts
Showing posts with label Solaris. Show all posts

Sunday, March 8, 2015

Update the Boot Archive on a RAID 1 Volume

Check the current meta devices and mirror status before reboot
metastat -p
like d0 d10 d20

Go to fail safe mode:
ok boot -F failsafe or reboot -- "-F failsafe"

Mount primary submirror
mount /dev/dsk/c0t0d0s0 /a

Update vfstab
backup original cp /a/etc/vfstab /a/etc/vfstab.orig

Comment out / filesystem
#/dev/md/dsk/d0     /dev/md/rdsk/d10    /     ufs    1    no    -

Add sub-mirror disk as /
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0  /     ufs    1    no    -

Update system conf
Backup original cp /a/etc/system /a/etc/system.orig

Comment out rootdev
* Begin MDD root info (do not edit)
# rootdev:/pseudo/md@0:0,0,blk
* End MDD root info (do not edit)

Update boot archive
bootadm update-archive -R /a

Reboot
umount /a
shutdown -i 6

Detach faulty sub-mirror
metadetach d0 d20

Replace changed file
cp /etc/vfstab.orig /etc/vfstab
cp /etc/system.orig /etc/system

Reboot
shutdown -i 6

Attach sub-mirror
metattach d0 d20

Check resync
metastat

Meta Device in Single Mode

boot cdrom -s

mkdir /tmp/a

ls -lthr /dev/dsk

mount -o ro /dev/dsk/c0t5000CCA01535BEA8d0s0 /tmp/a

cp /tmp/a/kernel/drv/md.conf /kernel/drv/md.conf

umount /tmp/a

update_drv md

metastat /dev/md/dsk/d0

metastat

mount /dev/md/d0 /tmp/a

Wednesday, February 25, 2015

Restart Network Service

Solaris
svcadm restart physical

RedHat
service network restart

Ubunto
service networking restart


Saturday, September 21, 2013

TCL Expect Script Directory

These are expect parameter to work with command line options:

puts $argc     # number of argument passed to script
puts $argv    # array list of arguement, script name not included
puts $argv0  # the name of script include path of calling e.g. ./test.sh

set path [file dirname $argv0]    # obtain script directory
cd $path      # Change directory to script directory



# Find script path through links as well
set originalPath [pwd]
set scriptPath   $::argv0
set workingPath  [file dirname $::argv0]
while {![catch {file readlink $scriptPath} result]} {
    cd $workingPath
    set scriptPath  [file join [pwd] $result]
    set workingPath [file dirname $scriptPath]
}
cd [file dirname $scriptPath]
set scriptPath [pwd]
cd $originalPath

Wednesday, August 28, 2013

Read and Clear big wtmpx

Read
/usr/lib/acct/fwtmp < wtmpx


Clear
cd /var/adm
gzip -c wtmpx > wtmpx-2013.gz
> wtmpx

Saturday, June 8, 2013

Create Solaris 10 IPMP

Requirement:
2 connected interface
3 IP addresses (1 for active, 2 for interface tests)

It is probe based IPMP (testing destination IP)

Update /etc/hosts
10.132.174.144    hostaddress

10.132.174.146    host-testaddr0
10.132.174.146    host-testaddr1

ifconfig intf0 host-testaddr0 deprecated -failover netmask + broadcast + group host_g0 up
ifconfig intf0 addif hostaddress netmask + broadcast + up

ifconfig intf1 host-testaddr1 deprecated -failover netmask + broadcast + group host_g0 up

Make it permanent by /etc/hostname.intfx

Tuesday, May 28, 2013

Netra T2000 PCIEX Fault

After installing new Solaris (u11 01/13) I got hardware fault for PCIEX as follow:
  ID Time              FRU               Fault
   6 JAN 01 02:08:21   IOBD              Host detected fault, MSGID: PCIEX-8000-DJ  UUID: 598ad722-6e4c-4335-f86a-ec627b5c2b3c
   7 JAN 01 02:08:21   MB                Host detected fault, MSGID: PCIEX-8000-DJ  UUID: 598ad722-6e4c-4335-f86a-ec627b5c2b3c

Finally found in server product notes a trick for /etc/system to config system to fix it

/etc/system
set pcie:pcie_aer_ce_mask=0x1
set segkmem_lpsize=0x400000

Also found some other config that may relate to improve performance for other things

set ip:ip_soft_rings_cnt=0
set pcie:pcie_aer_ce_mask=0x1
forceload: sys/shmsys
forceload: sys/semsys
set semsys:seminfo_semmni=20
set semsys:seminfo_semmsl=100
set semsys:seminfo_semmns=2000
set semsys:seminfo_semmnu=2000
set shmsys:shminfo_shmmax=0x140000000

Solaris Fault Management

SC (ILOM/ALOM):
showfaults
showfaults -v

Clear faults

clearfault

OS
List faults with details
fmadm faulty

fmdump

TIME                 UUID                                 SUNW-MSG-ID
May 28 14:27:27.3993 247a4225-6ed7-ca23-c85f-c98c461ac7ec ZFS-8000-D3

Fault location and more details

#fmdump -vu

Clear faults

fmadm repair 
cd /var/fm/fmd
rm e* f* c*/eft/* r*/*
fmadm reset cpumem-diagnosis
fmadm reset cpumem-retire
fmadm reset eft
fmadm reset io-retire

-----------------------------------------------------------
iLom
show /SP/faultmgmt

start /SP/faultmgmt/shell

fmadm faulty

fmadm repaired 1feeeff2-5371-c970-c8c7-d82c50b42c6b

Monday, April 22, 2013

Prepare Used Disk for ZPool

Is the disk is already used, you may get can't attach EFI disk to root pool.

If it happens, use format to remove all partition and make sure S2 (in sparc) P0 (in X86) is owning whole disk to assign the disk to pool completely.


partition> p
Current partition table (original):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -    25      129.19MB    (26/0/0)       264576
  1       swap    wu      26 -    51      129.19MB    (26/0/0)       264576
  2     backup    wu       0 - 14086       68.35GB    (14087/0/0) 143349312
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6        usr    wm      52 - 14086       68.10GB    (14035/0/0) 142820160
  7 unassigned    wm       0                0         (0/0/0)             0

partition> 0
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -    25      129.19MB    (26/0/0)       264576

Enter partition id tag[root]: unassigned
Enter partition permission flags[wm]:
Enter new starting cyl[0]:
Enter partition size[264576b, 26c, 25e, 129.19mb, 0.13gb]: 0
partition> 1
Part      Tag    Flag     Cylinders         Size            Blocks
  1       swap    wu      26 -    51      129.19MB    (26/0/0)       264576

Enter partition id tag[swap]: unassigned
Enter partition permission flags[wu]:wm
Enter new starting cyl[26]: 0
Enter partition size[264576b, 26c, 25e, 129.19mb, 0.13gb]: 0


partition> 2
Part      Tag    Flag     Cylinders         Size            Blocks
  2     backup    wu       0 - 14086       68.35GB    (14087/0/0) 143349312

Enter partition id tag[backup]: unassigned
Enter partition permission flags[wu]: wm
Enter new starting cyl[0]:
Enter partition size[143349312b, 14087c, 14086e, 69994.78mb, 68.35gb]: 68.35gb


partition> l
Ready to label disk, continue? y

Solaris Fiber Channel Check

fcinfo hba-port

Check local side
fcinfo hba-port -l

Check remote side
fcinfo remote-port -slp

Port status
luxadm -e port

Link errors
luxadm -e rdls /dev/cfg/c2
luxadm -e rdls /dev/cfg/c3

Test path
luxadm disp /dev/rdsk/c2t0d0s2

Inquiry Path
luxadm inq /dev/rdsk/c2t0d0s2

SCSI information
cfgadm -al

FC ports
mpathadm list initiator-port

MPath support
mpathadm list mpath-support

Show logical units
mpathadm show lu /dev/rdsk/c2t0d0s2

Find & Mount CDROM

Find CDROM dev name

ls -al /dev/sr* |awk '{print "/dev/" $11}'

Mount as HSFS readonly


mkdir -p /cdrom/unnamed_cdrom
mount -F hsfs -o ro /dev/dsk/c0t6d0s2 /cdrom/unnamed_cdrom



Configure NTP


Enable Solaris ntp to sync time to external servers

vi /etc/inet/ntp.conf


server RemoteHostAddre1
server RemoteHostAddre2
slewalways yes
enable pll
statsdir /var/ntp/ntpstats/
filegen peerstats file peerstats type day enable

svcadm disable ntp
svcadm enable ntp




Tuesday, February 12, 2013

ZFS, Adding new disk

Adding new disk to existing storage pool to extend capacity (No mirror)
zpool add dpool c1t4d0


Adding an mirrored stripe to existing mirrors
zpool add dpool mirror newDev1 newDev2

Attaching a disk and make mirror
zpool attach dpool oldDev newDev 

Making a non-redundant to mirrir (existing=c1t1d0 new=c1t5d0)
zpool attach dpool c1t1d0 c1t5d0

Remove mirror from pool
zpool detach dpool c1t5d0

 Can't add new mirror to only disk storage pool

Sunday, February 3, 2013

Creating Solaris package file of multi packages

pkgutil \
  --stream \
  --target=sparc:5.10 \
  --output imagemagick-and-others.pkg \
  --yes \
  --download \
  imagemagick coreutils vim ggrep gsed


MySQL Start/Stop

Stop
/usr/local/mysql/bin/mysqladmin -uroot -p shutdown

Start
/usr/local/mysql/bin/mysqld_safe &

Custom BASH Prompt (PS1) + Git Support

/etc/profile

if [ -f "/usr/local/git/current/share/git-core/git-completion.bash" ] ; then
  source "/usr/local/git/current/share/git-core/git-completion.bash"
  source "/usr/local/git/current/share/git-core/git-prompt.sh"
fi

export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1

if ! hash __git_ps1 2>/dev/null
then
__git_ps1 () { echo -n -e '!'; }    
fi

if [[ "$SHELL" = *bash* ]] && ( [[ "$TERM" = *xterm* ]] || [[ "$TERM" = *vt100* ]] )
then
        USER_ID=`id | cut -d"(" -f2 | cut -f1 -d ")"`
        if [ "$USER_ID" = "root" ]
        then
               PS1="\[\e[1;31m\][\t] \u@\h \[\e[01;34m\]\W \`__git_ps1 "[%s]"\`\`if [ \$? = 0 ]; then echo -e '\[\e[01;32m\]:)'; else echo -n -e '\[\e[01;31m\]:( $EXIT_STATUS'; fi\` \\$\[\e[0m\]\n"
        else
                PS1="\[\e[01;32m\][\t] \u@\[\e[97m\]\h \[\e[01;34m\]\W \`__git_ps1 "[%s]"\`\`if [ \$? = 0 ]; then echo -e '\[\e[01;32m\]:)'; else echo -n -e '\[\e[01;31m\]:( $EXIT_STATUS'; fi\` \[\e[01;34m\]$\[\e[00m\]\n"
        fi
fi

Basics of Zone

zonecfg -z zone01
>create -b
>set zonepath=/zones/zone01
>set autoboot=true
>add net
>>set address=10.0.0.11/18
>>set physical=e1000g2
>>set defrouter=10.0.0.1
>> end
>>verify
>>commit


>info
zonename: zone01
zonepath: /zones/zone01
brand: native
autoboot: true
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
hostid:
net:
    address: 10.0.0.11/18
    physical: e1000g2
    defrouter: 10.0.0.1

Install zone
zoneadm -z zone01 install

Boot and complete installation
zoneadm -z rira01 boot
zlogin -C zone01



Saturday, February 2, 2013

Rename Solaris Host

/etc/hosts
/etc/nodename
/etc/hostname.*
/etc/inet/ipnodes

Some of them doesn't exist, so ignore them.

Reboot machine.

Monday, January 28, 2013

Solaris Boot/OK Prompt

To boot from cdrom and do admin task without mounted disk:

  • init 0
  • connect to system from sc
  • ok> boot cdrom -s or boor cdrom - nowin

Monday, January 21, 2013

Setting Up SSH Public/Private Key

Creating keys, if don't have it yet
ssh-keygen -t dsa
or
ssh-keygen -t rsa -b 4096

Copy public file content (id_dsa.pub) to ~/.ssh/authorized_keys on REMOTE site

ssh client uses id_rsa as private key
ssh server use authroized_keys as public key of client to check validity



  • The file $HOME/.ssh/authorized_keys  lists  the public keys that are permitted for logging in.
  • PuTTY key file formats seems not match with linux/solaris ssh, or need change to make it compatible