Friday, May 23, 2008

Linux RPMDB

Rebuild rpmdb
---------------

Note: Backup /var/lib/rpm before any activity!

Method # 1

Remove /var/lib/rpm/__db* files to avoid stale locks:
# cd /var/lib
# rm __db*

Rebuild RPM database:
# rpm --rebuilddb
# rpmdb_verify Packages

------------------------------------------------------
Method # 2

If you are still getting errors, then try your luck with following commands:

# mv Packages Packages-BAKUP
# db_dump Packages-BAKUP | db_load Packages
# rpm -qa
# rpm --rebuilddb

Tuesday, May 20, 2008

SVM @ Solaris 9

Reference sites;
Creating Volumes
Finding/setting nvalias (nvram) OBP settings from a running Solaris O/S

SVM Setup at Solaris 9
------------------------
Situation:
- No any SVM state db exist
- Total new SVM
- Solaris 9
- State db created at c1t0d0s7, size ~94MB

Tasks:
- create state db
- Mirror / and /var

----------------------------------------------------
Primary Disk: c1t0d0 /pci@1f,700000/scsi@2/sd@0,0
Secondary Disk: c1t1d0 /pci@1f,700000/scsi@2/sd@1,0
----------------------------------------------------

c1t0d0 Partition Table;
Part Tag Flag Cylinders Size Blocks
0 root wm 0 - 12074 58.59GB (12075/0/0) 122875200
1 swap wu 12075 - 13261 5.76GB (1187/0/0) 12078912
2 backup wm 0 - 14086 68.35GB (14087/0/0) 143349312
3 var wm 13262 - 14067 3.91GB (806/0/0) 8201856
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 14068 - 14086 94.41MB (19/0/0) 193344


# df -h
Filesystem size used avail capacity Mounted on
/dev/dsk/c1t0d0s0 58G 6.4G 51G 12% /
/proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
fd 0K 0K 0K 0% /dev/fd
/dev/dsk/c1t0d0s3 3.9G 1.2G 2.7G 31% /var
swap 17G 168K 17G 1% /var/run
swap 17G 120K 17G 1% /tmp
esqcqanfs1:/nfs 100G 33G 62G 35% /u01/nsncif/data

2nd Disk to mirror;
1. c1t1d0
/pci@1f,700000/scsi@2/sd@1,0

root@esqcqaa02# fmthard -s /dev/null /dev/rdsk/c1t1d0s2
fmthard: New volume table of contents now in place.

c1t1d0 Partiton Table;
Part Tag Flag Cylinders Size Blocks
0 root wm 0 - 12074 58.59GB (12075/0/0) 122875200
1 swap wu 12881 - 14068 5.76GB (1188/0/0) 12089088
2 backup wu 0 - 14086 68.35GB (14087/0/0) 143349312
3 var wm 12075 - 12880 3.91GB (806/0/0) 8201856
4 unassigned wu 0 0 (0/0/0) 0
5 unassigned wu 0 0 (0/0/0) 0
6 unassigned wu 0 0 (0/0/0) 0
7 unassigned wm 14069 - 14086 89.44MB (18/0/0) 183168


##########################
Create state replica
##########################
root@esqcqaa02# metadb -a -f -c 3 c1t0d0s7 c1t1d0s7
you have mail
root@esqcqaa02# metadb -i
flags first blk block count
a u 16 8192 /dev/dsk/c1t0d0s7
a u 8208 8192 /dev/dsk/c1t0d0s7
a u 16400 8192 /dev/dsk/c1t0d0s7
a u 16 8192 /dev/dsk/c1t1d0s7
a u 8208 8192 /dev/dsk/c1t1d0s7
a u 16400 8192 /dev/dsk/c1t1d0s7
r - replica does not have device relocation information
o - replica active prior to last mddb configuration change
u - replica is up to date
l - locator for this replica was read successfully
c - replica's location was in /etc/lvm/mddb.cf
p - replica's location was patched in kernel
m - replica is master, this is replica selected as input
W - replica has device write errors
a - replica is active, commits are occurring to this replica
M - replica had problem with master blocks
D - replica had problem with data blocks
F - replica had format problems
S - replica is too small to hold current data base
R - replica had device read errors
#

--------

Metadevices: ** Plan **
/: d0
-> d10
-> d11
swap: d1
-> d20
-> d21
/var: d3
-> d30
-> d31

##############################
Mirror /var
##############################
Metadevice for /var;
# metainit -f d31 1 1 c1t0d0s3
d31: Concat/Stripe is setup
# metainit d30 1 1 c1t1d0s3
d30: Concat/Stripe is setup
# metainit d3 -m d31
d3: Mirror is setup
> ## Edit /etc/vfstab, Remove the line with /var and add the line below;
/dev/md/dsk/d3 /dev/md/rdsk/d3 /var ufs 1 no -

# Reboot
# metaattach d3 d30

##############################
Mirror Swap
##############################
# metainit -f d20 1 1 c1t0d0s1
d20: Concat/Stripe is setup
# metainit d21 1 1 c1t1d0s1
d21: Concat/Stripe is setup
# metainit d1 -m d20
d1: Mirror is setup
### Edit /etc/vfstab as below;
# grep swap /etc/vfstab
/dev/md/dsk/d1 - - swap - no -
swap - /tmp tmpfs - yes -
#

# Reboot
# metaattach d1 d21

>> To check, run metastat


##############################
Mirror Root FS
##############################
# metainit -f d10 1 1 c1t0d0s0
d10: Concat/Stripe is setup
# metainit d11 1 1 c1t1d0s0
d11: Concat/Stripe is setup
# metainit d0 -m d10
d0: Mirror is setup
# metaroot d0
# lockfs -fa
# cat /etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/md/dsk/d1 - - swap - no -
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -
/dev/md/dsk/d3 /dev/md/rdsk/d3 /var ufs 1 no -
esqcqanfs1:/nfs - /u01/nsncif/data nfs - yes -
swap - /tmp tmpfs - yes -
#

# REBOOT
metaattach d0 d11



Done!
# eeprom boot-device
boot-device=disk disk1

Use "prtconf -vp" to check default disk alias.
If boot-device is not set to backup mirror disk, proceed with follwing steps.
# eeprom use-nvramrc?=true
> We need to do is to set the “use-nvramrc = true” OBP variable so our modifications will be used when system is reboot.
> you can set dev alias if it is not set as below;
# eeprom nvramrc=”devalias rootdisk /pci@780/pci@0/pci@9/scsi@0/disk@0,0 devalias rootmirror /pci@780/pci@0/pci@9/scsi@0/disk@1,0″

> Then set boot-device as below;
# eeprom boot-device=”rootdisk rootmirror”
# reboot

Monday, May 19, 2008

Today - 19 May 2008

2 days had passed. What am i doing? Ans: DUNO!
Waste. only read 2 chapters. =(

Sunday, May 18, 2008

CX310-202: Solaris 10 Sys Admin II

Drag for 2 mons for this exam.. due to do a lot of exercise. Now, i must start to prepare for this exam.

Start with; -
Chapter 8 - Introducing SVM Software Concepts. - Done
Chapter 9 - Configuring SVM Software. - Done
Chapter 6 - Configuring NFS - OTW

Wednesday, May 14, 2008

Solaris Container - Zones

Reference: SystemAdministration Guide: Solaris Containers-Resource Management and Solaris Zones

root@myhost1 # zonecfg -z myhost1-v03
myhost1-v03: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:myhost1-v03> create
zonecfg:myhost1-v03> set zonepath=/export/home/zones/myhost1-v03
zonecfg:myhost1-v03> set autoboot=true
zonecfg:myhost1-v03> add inherit-pkg-dir
zonecfg:myhost1-v03:inherit-pkg-dir> set dir=/opt/zoneshare
zonecfg:myhost1-v03:inherit-pkg-dir> end
zonecfg:myhost1-v03> add net
zonecfg:myhost1-v03:net> set address=10.160.242.40
zonecfg:myhost1-v03:net> set physical=e1000g0
zonecfg:myhost1-v03:net> end
zonecfg:myhost1-v03> add net
zonecfg:myhost1-v03:net> set address=10.188.131.44
zonecfg:myhost1-v03:net> set physical=e1000g2
zonecfg:myhost1-v03:net> end
zonecfg:myhost1-v03> add net
zonecfg:myhost1-v03:net> set address=10.190.131.40
zonecfg:myhost1-v03:net> set physical=e1000g3
zonecfg:myhost1-v03:net> end
zonecfg:myhost1-v03> add attr
zonecfg:myhost1-v03:attr> set name=comment
zonecfg:myhost1-v03:attr> set type=string
zonecfg:myhost1-v03:attr> set value="MY Web Server"
zonecfg:myhost1-v03:attr> end
zonecfg:myhost1-v03> set pool=cwp3-pool
zonecfg:myhost1-v03> add fs
zonecfg:myhost1-v03:fs> set dir=/opt/global
zonecfg:myhost1-v03:fs> set special=/opt/child
zonecfg:myhost1-v03:fs> set type=lofs
zonecfg:myhost1-v03:fs> set options=[rw,nodevices]
zonecfg:myhost1-v03:fs> end
zonecfg:myhost1-v03> verify
zonecfg:myhost1-v03> commit
zonecfg:myhost1-v03> exit
root@myhost1 # zoneadm -z myhost1-v03 verify
WARNING: /export/home/zones/myhost1-v03 does not exist, so it could not be verified.
When 'zoneadm install' is run, 'install' will try to create
/export/home/zones/myhost1-v03, and 'verify' will be tried again,
but the 'verify' may fail if:
the parent directory of /export/home/zones/myhost1-v03 is group- or other-writable
or
/export/home/zones/myhost1-v03 overlaps with any other installed zones.
root@myhost1 # zoneadm -z myhost1-v03 install
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <2664> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1067> packages on the zone.
Initializing package <3> of <1067>: percent complete: 0%
Initializing package <7> of <1067>: percent complete: 0%
Initializing package <11> of <1067>: percent complete: 0%
Initializing package <15> of <1067>: percent complete: 1%
Initializing package <18> of <1067>: percent complete: 1%
Initializing package <22> of <1067>: percent complete: 2%
Initializing package <26> of <1067>: percent complete: 2%
Initializing package <30> of <1067>: percent complete: 2%
..
..
Initializing package <1051> of <1067>: percent complete: 98%
Initializing package <1055> of <1067>: percent complete: 98%
Initializing package <1059> of <1067>: percent complete: 99%
Initializing package <1062> of <1067>: percent complete: 99%
Initializing package <1066> of <1067>: percent complete: 99%
Initialized <1067> packages on zone.
Zone is initialized.
Installation of <7> packages was skipped.
Installation of these packages generated warnings:
The file contains a log of the zone installation.
root@myhost1 # zoneadm -z myhost1-v03 verify
root@myhost1 # zoneadm list -cv
ID NAME STATUS PATH
0 global running /
1 myhost1-v01 running /export/home/zones/vacwpq02-v01
3 myhost1-v02 running /export/home/zones/myhost1-v02
- myhost1-v03 installed /export/home/zones/myhost1-v03
root@myhost1 # zoneadm -z myhost1-v03 boot
root@myhost1 # zoneadm list -cv
ID NAME STATUS PATH
0 global running /
1 myhost1-v01 running /export/home/zones/vacwpq02-v01
3 myhost1-v02 running /export/home/zones/myhost1-v02
4 myhost1-v03 running /export/home/zones/myhost1-v03
root@myhost1 # zlogin -C myhost1-v03
## Configure the new zone setting

From global zone, run
zlogin myhost1-v3

Wednesday, May 7, 2008

Solaris SVM - SAN DISKs

Create new disk from SAN.

Edit the entry in /etc/lvm/md.tab
e.g.
myhostDS/d100 1 1 /dev/rdsk/c4t600508B40010887F0000B00000640000d0s0

Edit the metaset script in /etc/init.d. Name might be different.

If you can see fibre channels connected with cfgadm -al but there is no
disk in format output you may need to run following commands:

# devlinks
# disks

Just plain command, no switches or options. These build /dev links
again and disks-command makes new disks available for system.

run > cfgadm -al
then, use format to check SAN disk id.

root@myhost1 # metaset -s myDS -a -h myhost1
root@myhost1 # metaset -s myDS -a /dev/rdsk/c4t600508B40010887F0000B00005FB0000d0
root@myhost1 # ls /dev/md/myDS*
/dev/md/myDS
root@myhost1 # EDIT /etc/lvm/md.tab
# Add the line below;
myDS/d100 1 1 /dev/rdsk/c4t600508B40010887F0000B00002D20000d0s0

root@myhost1 # ADD the myDS in /etc/init.d/cp.metasets
root@myhost1 # metaset

Set name = myhost01DS, Set number = 1

Host Owner
myhost1 Yes

Drive Dbase

/dev/dsk/c4t600508B40010887F0000B00000640000d0 Yes

Set name = myhost02DS, Set number = 2

Host Owner
myhost1

Drive Dbase

/dev/dsk/c4t600508B40010887F0000B00002D20000d0 Yes

Set name = myDS, Set number = 3

Host Owner
myhost1 Yes

Drive Dbase

/dev/dsk/c4t600508B40010887F0000B00005FB0000d0 Yes
root@myhost1 # metainit -s myDS -a
myDS/d100: Concat/Stripe is setup
root@myhost1 # newfs /dev/md/myDS/rdsk/d100
newfs: construct a new file system /dev/md/myDS/rdsk/d100: (y/n)? y
Warning: 4096 sector(s) in last cylinder unallocated
/dev/md/myDS/rdsk/d100: 20922368 sectors in 3406 cylinders of 48 tracks, 128 sectors
10216.0MB in 213 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
19957152, 20055584, 20154016, 20252448, 20350880, 20449312, 20547744,
20646176, 20744608, 20843040
root@myhost1 # fsck /dev/md/myDS/rdsk/d100
** /dev/md/myDS/rdsk/d100
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3a - Check Connectivity
** Phase 3b - Verify Shadows/ACLs
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cylinder Groups
2 files, 9 used, 10302683 free (11 frags, 1287834 blocks, 0.0% fragmentation)
root@myhost1 # mount /dev/md/myDS/dsk/d100 /opt/global
root@myhost1 # df -h
Filesystem size used avail capacity Mounted on
..
/dev/md/dsk/d4 3.9G 4.0M 3.9G 1% /opt/zoneshare
/dev/md/dsk/d5 29G 898M 28G 4% /export/home
/dev/md/cwppv01DS/dsk/d100
9.8G 658M 9.1G 7% /opt/cwppv01
/dev/md/myDS/dsk/d100
9.8G 10.0M 9.7G 1% /opt/cwppv03

Saturday, May 3, 2008

Linux LVM 1 & 2

Coming up ... ... Linux LVM 1 & 2

To check the LVM version installed on Linux. run the following command;
[kschua@centera ~]$ rpm -qa | grep lvm
lvm2-2.02.26-3.el5
system-config-lvm-1.0.22-1.0.el5
[kschua@centera ~]$

From the example above, my system is using LVM 2.

How to change keyboard layout in Linux

Linux:
X:
edit /etc/X11/xorg.conf
line : "XkbLayout" "us"

console:
edit /etc/sysconfig/keyboard
KEYTABLE="us"

on spot change keyboard layout.
> loadkeys us