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 Config Files

Global config
/etc/my.cnf

Server specific config
mysql-data-dir/my.cnf

User specific config
~/.my.cnf

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.