Archive

Archive for April, 2011

configure syslog to redirect WebSphere Message Broker (mq) messages to file

April 29th, 2011 No comments

On Linux® and UNIX® systems, all WebSphere® Message Broker messages (other than those generated by the command line utilities) are sent to the syslog, so it is useful to redirect user messages to a separate file.

Start of changeOn UNIX, syslog entries are restricted in length and messages that are sent to the syslog are truncated by the new line character. To record a large amount of data in a log on UNIX, set the Destination property on the Trace node to File or User Trace instead of Local Error Log.End of change

Before you create a broker on Linux or UNIX systems, configure the syslog daemon to redirect user messages to a file called user.log:

Log on as root.
Enter the following commands to create a file called user.log.
On UNIX systems, enter the command:

touch /var/adm/user.log
chown root:mqbrkrs /var/adm/user.log
chmod 640 /var/adm/user.log

On Linux, enter the command:

touch /var/log/user.log
chown root:mqbrkrs /var/log/user.log
chmod 640 /var/log/user.log

Add the following line to the /etc/syslog.conf file Start of change(on later versions of SUSE Linux, this is /etc/syslog-ng.conf)End of change to redirect debug level messages to the file user.log:
On UNIX systems, enter the command:

user.info /var/adm/user.log

On Linux, enter the command:

user.info /var/log/user.log

You can use user.* – instead of user.info in the preceding examples.
* means that information, notice, warning, and debug messages are caught
- means that syslog does not synchronize the file after writing to it.
You might experience a performance gain, but you can lose some data if the computer fails immediately after it has written to the file.
Start of changeAdd a line to ensure that messages at the required level from the user facility are recorded. If you specify a level of info, all operational messages are recorded; these messages provide important information about the operation of the broker, and can be useful in diagnosing problems.End of change
Restart the syslog daemon.
On AIX®, enter the command:

refresh -s syslogd

On HP-UX and Solaris, enter the command:

kill -HUP ‘cat /etc/syslog.pid’

On Linux, enter the command:

/etc/init.d/syslogd restart

or

/etc/rc.d/init.d/syslogd restart

for systems where rc.d is not a soft link
For other syslog options, see the documentation for your operating system.

About other websphere message broker documents, please refer to http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp

Categories: IT Architecture, Linux Tags: , ,

Resolved:solaris patch panic – cannot start the system after patch

April 27th, 2011 No comments

Here goes the whole story:

Step 1. patch with PCA. after reboot — -r

Rebooting with command: boot -r

Boot device: /pci@1c,600000/scsi@2/disk@0,0:a  File and args: -r

SunOS Release 5.10 Version Generic_142900-13 64-bit

Copyright 1983-2010 Sun Microsystems, Inc.  All rights reserved.

Use is subject to license terms.

WARNING: mod_load: cannot load module ‘sharefs’

WARNING: Cannot mount /etc/dfs/sharetab

 

Hardware watchdog enabled

/kernel/drv/sparcv9/ip: undefined symbol ‘ddi_get_lbolt64′

WARNING: mod_load: cannot load module ‘ip’

/kernel/fs/sparcv9/sockfs: undefined symbol ‘sock_comm_create_function’

/kernel/fs/sparcv9/sockfs: undefined symbol ‘smod_lookup_byname’

/kernel/fs/sparcv9/sockfs: undefined symbol ‘sctp_disconnect’

/kernel/fs/sparcv9/sockfs: undefined symbol ‘sctp_getsockname’

/kernel/fs/sparcv9/sockfs: undefined symbol ‘nd_free’

/kernel/fs/sparcv9/sockfs: undefined symbol ‘nd_load’

/kernel/fs/sparcv9/sockfs: undefined symbol ‘UDP_WR’

 

Step 2. zfs Roll back

ok>boot -F failsafe

#zfs rollback rpool/ROOT/sol10_sparc@pre_patched.142900-13_04.03.2011

 

Step 3. Patch with PCA again, then “halt”, boot archive is not updated after patching, so we need remove the boot_archive

ok>boot -F failsafe

# mv /a/platform/`uname -i`/boot_archive /a/root/b_back

# /a/sbin/bootadm update-archive -R /a

# reboot

 

Step 4. Server is patched

root@solaris01~# uname -a

SunOS solaris01 5.10 Generic_144488-06 sun4u sparc SUNW,Sun-Fire-V240

Step 5. Restore the Zone

root@solaris01~# zoneadm -z solaris01sub01 halt

root@solaris01~# zoneadm -z solaris01sub01 detach

root@solaris01~# zoneadm -z solaris01sub01 attach -u

zoneadm: zone ‘solaris01sub01′: ERROR: attempt to downgrade package SUNWcsu, the source had patch 142053-03 which is not installed on this system

# SUNWcsu is the core package. we can’t live without it’s upgrade

 

root@solaris01~# zoneadm list -civ

ID NAME             STATUS     PATH                           BRAND    IP

0 global           running    /                              native   shared

- solaris01sub01   configured /export/zones/solaris01sub01   native   shared

 

root@solaris01~# showrev -a|grep 142053-03

Patch: 142053-03 Obsoletes: 142485-01 Requires: 127127-11, 139555-08 Incompatibles:  Packages: SUNWcslr, SUNWcsu

Patch: 143954-04 Obsoletes: 142053-03, 142485-01, 142487-01, 142535-03 Requires: 127127-11, 139555-08 Incompatibles:  Packages: SUNWcslr, SUNWcsr

 

root@solaris01~# zoneadm -z solaris01sub01 attach -u -F

root@solaris01~# zoneadm -z solaris01sub01 boot

 

root@solaris01~# zlogin solaris01sub01

Last login: Sat Mar 26 05:15:27 on pts/2

Sun Microsystems Inc.   SunOS 5.10    Generic   January 2005

# The zones doesn’t work

root@solaris01sub01/# svcs

STATE          STIME    FMRI

online          5:40:24 svc:/system/svc/restarter:default

offline         5:40:24 svc:/system/sysidtool:net

offline         5:40:25 svc:/network/nfs/status:default

offline         5:40:28 svc:/system/boot-archive-update:default

uninitialized   5:40:27 svc:/application/x11/xfs:default

uninitialized   5:40:28 svc:/network/rpc-100235_1/rpc_ticotsord:default

 

root@solaris01sub01/# zfs list

internal error: Unknown error

Abort (core dumped)

root@solaris01sub01/# logout

 

root@solaris01~# zoneadm list -civ

ID NAME             STATUS     PATH                           BRAND    IP

0 global           running    /                              native   shared

- solaris01sub01   configured /export/zones/solaris01sub01   native   shared

 

root@solaris01~# zfs rollback rpool/export/zones/solaris01sub01@id24_pre_AMpatch12

 

root@solaris01sub01/# showrev -a|grep  142053-03

Patch: 142053-03 Obsoletes: 142485-01 Requires: 127127-11, 139555-08 Incompatibles:  Packages: SUNWcslr, SUNWcsu

 

root@solaris01~# zlogin solaris01sub01

Last login: Sat Mar 26 05:55:32 on pts/2

Sun Microsystems Inc.   SunOS 5.10    Generic   January 2005

 

root@solaris01sub01/# unzip -q 143954-04.zip

root@solaris01sub01/# patchadd 143954-04

Validating patches…

 

Global patches.

 

0 Patch 143954-04 is for global zone only – cannot be installed on non-global zone.

 

No patches to install.

 

root@solaris01/datastore/Explorers/patches# showrev -a|grep 142053-03

Patch: 142053-03 Obsoletes: 142485-01 Requires: 127127-11, 139555-08 Incompatibles:  Packages: SUNWcslr, SUNWcsu

Patch: 143954-04 Obsoletes: 142053-03, 142485-01, 142487-01, 142535-03 Requires: 127127-11, 139555-08 Incompatibles:  Packages: SUNWcslr, SUNWcsr

 

root@solaris01/datastore/Explorers/patches# unzip -q 143954-04.zip

root@solaris01/datastore/Explorers/patches# patchadd 143954-04

Validating patches…

….

Patch packages installed:

SUNWcslr

SUNWcsr

SUNWcsu

 

Done!

root@solaris01/datastore/Explorers/patches# zlogin solaris01sub01

[Connected to zone 'solaris01sub01' pts/2]

Last login: Sat Mar 26 05:58:17 on pts/2

Sun Microsystems Inc.   SunOS 5.10    Generic   January 2005

 

# Now we have the new package

root@solaris01sub01/# showrev -a|grep  142053-03

Patch: 142053-03 Obsoletes: 142485-01 Requires: 127127-11, 139555-08 Incompatibles:  Packages: SUNWcslr, SUNWcsu

Patch: 143954-04 Obsoletes: 142053-03, 142485-01, 142487-01, 142535-03 Requires: 127127-11, 139555-08 Incompatibles:  Packages: SUNWcslr, SUNWcsr, SUNWcsu

 

root@solaris01/datastore/Explorers/patches# zoneadm -z solaris01sub01 halt

root@solaris01/datastore/Explorers/patches# zoneadm -z solaris01sub01 detach

 

# the upgrade goes very smooth

root@solaris01/datastore/Explorers/patches# zoneadm -z solaris01sub01 attach -u

Getting the list of files to remove

Removing 481 files

Remove 11 of 11 packages

Installing 11639 files

Add 190 of 190 packages

Updating editable files

The file </var/sadm/system/logs/update_log> within the zone contains a log of the zone update.

root@solaris01/datastore/Explorers/patches# zoneadm list -civ

ID NAME           STATUS     PATH                           BRAND    IP

0 global           running    /                              native   shared

- solaris01sub01   installed  /export/zones/solaris01sub01   native   shared

root@solaris01/datastore/Explorers/patches# zoneadm -z solaris01sub01 boot

root@solaris01~# zoneadm list -civ

ID NAME             STATUS     PATH                        BRAND    IP

0 global           running    /                              native   shared

31 solaris01sub01   running    /export/zones/solaris01sub01   native   shared

 

root@solaris01~# zlogin solaris01sub01

svc:/system/sysidtool:net failed.

root@solaris01~# zlogin -C solaris01sub01

# choose Term Type 3) VT100. then everything goes well.

Categories: Kernel, Unix Tags: ,

Steps to create new volume of VxVM under solaris

April 27th, 2011 1 comment

1.Take snapshot of running processes, filesystem partitions, network connections:
#/usr/ucb/ps aauuxxww>/running_processes.2011.04.25
#df -k>/filesystem.2011.04.25
#netstat -rnv>/networking.2011.04.25

2.Check free space of dg(disk group), sector position of dm(disk media), and subdisk allocation:
#vxprint

3.Let’s see the lengths and offsets of all subdisks under plexes:

vxprint -st

You can also use iostat -En.

Where free sectors lay on the disks:

#vxdg -g abinitio free

#vxassist -g abinitio maxsize

4.Create v(volume):
vxassist -g abinitio make ora2 5g

After this, you can see in vxprint:
v  ora2         fsgen        ENABLED  10485760 -        ACTIVE   -       -
pl ora2-01      ora2         ENABLED  10487040 -        ACTIVE   -       -
sd disk1-14     ora2-01      ENABLED  10487040 0        -        -       -

And,
#fstyp /dev/vx/dsk/abinitio/ora2
Unknown_fstyp (no matches)

Let’s create filesystem for volume ora2:

Firstly, let’s check the block size of other filesystem on the server:

#fstyp -v /dev/vx/rdsk/abinitio/F41|grep bsize
bsize  1024 size  10240 dsize  0  ninode 10240  nau 0
defiextsize 0  ilbsize 0  immedlen 96  ndaddr 10

It’s 1024 Bytes.

Then, let’s create the filesystem for volume ora2:

#mkfs -F vxfs -o bsize=1024,largefiles /dev/vx/rdsk/abinitio/ora2
version 6 layout
10485760 sectors, 5242880 blocks of size 1024, log size 16384 blocks
largefiles supported
After this, let’s check it:
# fstyp /dev/vx/rdsk/abinitio/ora2
vxfs

5.Mount a File System:
#mkdir /ora2
#mount -F vxfs -o largefiles /dev/vx/dsk/abinitio/ora2 /ora2

Now, cd to /ora2 and create a file to test it:
# cd /ora2/
# touch aa
# ls -l
total 0
-rw-r–r–   1 root     other          0 Apr 25 02:42 aa
drwxr-xr-x   2 root     root          96 Apr 25 02:40 lost+found

If all are ok, you should add an entry into /etc/vfstab
/dev/vx/dsk/abinitio/ora2       /dev/vx/rdsk/abinitio/ora2 /ora2        vxfs    2       yes     largefiles

Categories: Storage Tags:

luxadm usage

April 24th, 2011 No comments

Here’s the more detailed one about luxadm, please refer to this:

 

luxadm forcelip/display on solaris 10

http://www.doxer.org/learn-linux/luxadm-forcelipdisplay-on-solaris-10/

Some of the basic usage:

luxadm probe                 (discovers fcal)
luxadm display Enclosure (displays information on fcal box)
luxadm reserve /dev/rdsk/c#t#d#s# (reserves device so it can’t be accessed)
luxadm -e offline /dev/rdsk/c#t#d#s#     (takes a device offline)
luxadm -e bus_quiesce /dev/rdsk/c#t#d#s#    (quiesce the bus)
luxadm -e bus_unquiesce /dev/rdsk/c#t#d#s# (unquiesce the bus)
luxadm -e online /dev/rdsk/c#t#d#s#    (bring the disk device back online)
luxadm release /dev/rdsk/c#t#d#s#    (unreserved the device for use)
luxadm remove_device BAD,f2    (removes a device from slot f2 on enclosure BAD)
luxadm insert_device BAD,f2     (hot plug a new device to slot f2 on enclosure BAD)

What’s luxadm used for?

luxadm is an utility, which discovers FC devices (luxadm probe), shut downs devives (luxadm shutown_device …) runs a firmware upgrade (luxadm download_firmware …) and many other things.

luxadm is used for internal SUN fibre disks as well as external disk arrays. luxadm command is used for administration program for the Sun Enterprise Network Array (SENA), RSM, SPARC storage Array (SSA) subsystems,and individual Fiber Channel Arbitrated Loop (FC_AL) devices.

Categories: Storage, Unix Tags: ,

Difference between dm, dmp, rdmp, v, pl, sd, lun, c, t, d, s

April 24th, 2011 No comments

dm – disk media

dmp – disk media mapping

rdmp – an rdmp file is a mapping to a raw device stored on a san.  rdmp specifically is a physical mode rdm.  This data, although you may see it as the actual size of the raw device, is only a pointer to the actual storage to a volume on your SAN.

v – volume

pl – plex

sd – subdisk

lun – logic unit number

NOTE:

Disks (dm) must be added to a disk group (dg) under Veritas. A volume contains one or more plexes which in turn contain one or more subdisks.

And again, for the famous c, t, d, s issue:

From the computer perspective, SCSI LUN is only a part of the full SCSI address. The full device’s address is made from the:

  • c-part: controller ID of the host bus adapter,
  • t-part: target ID identifying the SCSI target on that bus,
  • d-part: disk ID identifying a LUN on that target,
  • s-part: slice ID identifying a specific slice on that disk.

 

Categories: Storage Tags:

Resolved:[Load Manager Shared Memory]. Error is [28]: [No space left on device](for apache, pmserver etc. running on linux, solaris, unix)

April 23rd, 2011 No comments

This error may occur in pmserver, apache, oracle, rsync, up2date and many other services running on linux, solaris, unix, so it’s a widespread and a famous question if you try to search google the keyword:”[Load Manager Shared Memory].  Error is [28]: [No space left on device]“.
Now, let’s take pmserver running on solaris10 for example to demonstrate to you step by step on how to solve the annoying problem.
Firstly, from “[No space left on device]” and “Load Manager Shared Memory”, we firstly guessed that it’s caused by shortage of memory, but after checking, we can see that memory is enough to allocate:

1.check the total memory size:

# /usr/sbin/prtconf |grep -i mem
Memory size: 32640 Megabytes
memory (driver not attached)
virtual-memory (driver not attached)

2.check application project memory size:

# su – sbintprd #as you have guessed, pmserver is running by user sbintprd in the box
$ id -p
uid=71269(sbintprd) gid=70772(sbintprd) projid=3(default)

This means that pmserver is running inside ‘default’ project. Then let’s check the setting of “default” project:

# projects -l default
default
projid : 3
comment: “”
users  : (none)
groups : (none)
attribs: project.max-msg-ids=(privileged,256,deny)
project.max-shm-memory=(privileged,17179869184,deny)

# prctl -n project.max-shm-memory -i project default
project: 3: default
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
project.max-shm-memory
privileged      16.0GB      -   deny                                 -
system          16.0EB    max   deny                                 -

16GB available to ‘default’ project. How come the shortage of memory then?

Let’s bump up the max-shm-memory size by 2 GB to see what happens:

#prctl -n project.max-shm-memory -r -v 18gb -i project default

After this, we tried to bounce the pmserver, but the problem is still there:

#tail -f pmserver.log
INFO : LM_36070 [Fri Apr 22 22:19:42 2011] : (25218|1) The server is running on a host with 32 logical processors.
INFO : LM_36039 [Fri Apr 22 22:19:42 2011] : (25218|1) The maximum number of sessions that can run simultaneously is [10].
FATAL ERROR : CMN_1011 [Fri Apr 22 22:19:42 2011] : (25218|1) Error allocating system shared memory of [2000000] bytes for [Load Manager Shared Memory].  Error is [28]: [No space left on device]
FATAL ERROR : SF_34004 [Fri Apr 22 22:19:42 2011] : (25218|1) Server initialization failed.
INFO : SF_34014 [Fri Apr 22 22:19:42 2011] : (25218|1) Server shut down.

OK, then, we should think in other ways.

As we know, linux use shared memory between processes. We can use ipcs to check the information about  active  shared  memory  segments:

# ipcs -m|grep sbintprd
m  671088691   0          –rw——- sbintprd sbintprd

#ipcs -mA|grep sbintprd|wc -l
92

And each of them use 20000 size:

IPC status from <running system> as of Sat Apr 23 03:29:51 BST 2011
T         ID      KEY        MODE        OWNER    GROUP  CREATOR   CGROUP NATTCH      SEGSZ  CPID  LPID   ATIME    DTIME    CTIME  ISMATTCH         PROJECT
Shared Memory:
m  671088691   0          –rw——- sbintprd sbintprd sbintprd sbintprd      1    2000000  7781 16109  3:28:35  3:28:50  2:01:43        0         default

Now, we can conclude that the sbintprd user has over allocated and is not freeing up the space. So let’s clear the shared memeory:

#for i in `ipcs -m | grep prd | awk ‘{print $2}’`; do ipcrm -m $i; done

After this step, the pmserver started successfully. From the log we can see:

NFO : LM_36070 [Sat Apr 23 01:51:17 2011]
: (5979|1) The server is running on a host with 32 logical processors.
INFO : LM_36039 [Sat Apr 23 01:51:18 2011] : (5979|1) The maximum number of sessions that
can run simultaneously is [10].
INFO : CMN_1010 [Sat Apr 23 01:51:18 2011] : (5979|1) Allocated system shared memory [id =
469762275] of [2000000] bytes for [Load Manager Shared Memory].
INFO : LM_36095 [Sat Apr 23 01:51:50 2011] : (5979|1) Persistent session cache file
cleanup is scheduled to run on [Sun Apr 24 01:51:50 2011].
INFO : SF_34003 [Sat Apr 23 01:51:50 2011] : (5979|1) Server initialization completed.

Problem resolved!

The result of rm -rf / on linux(debian)

April 20th, 2011 No comments

210169:/# rm -rf /
rm: cannot remove root directory `/’

Haven’t tested other distributions, maybe you can have a try? :D

Categories: Kernel, Linux Tags:

Install curl utility on solaris

April 19th, 2011 1 comment

Firstly, download curl package from sunfreeware.com. unzip the tarball, and execute ./configure
# ./configure
checking whether to enable maintainer-specific portions of Makefiles… no
checking whether to enable debug build options… no
checking whether to enable compiler optimizer… (assumed) yes
checking whether to enable strict compiler warnings… no
checking whether to enable compiler warnings as errors… no
checking whether to enable curl debug memory tracking… no
checking whether to enable c-ares for DNS lookups… no
checking for sed… /usr/bin/sed
checking for grep… /usr/bin/grep
checking for egrep… /usr/bin/egrep
checking for ar… /usr/local/bin/ar
checking for a BSD-compatible install… ./install-sh -c
checking whether build environment is sane… configure: error: newly created file is older than distributed files!
Check your system clock

This was because the system time was off and the timestamps in the source code were in the future.  To fix this all you can do is copy the files to another directory using the copy command:

#cp -r curl-7.21.4 /

Then try to compile again.

After this,  make and make install. If you come across the problem:

configure: error: ar not found in PATH. Cannot continue without ar.

That’s because you haven’t installed GNU_Binutils on your solaris system.

You should download binutils package from sunfreeware.com and install it:

#gzip -d binutils-2.21-sol10-x86-local.gz
#pkg-add -d binutils-2.21-sol10-x86-local

After this step, if you still receive alert:
configure: error: no acceptable C compiler found in $PATH

If you have installed gcc(we can check using find / -name gcc), then it’s the problem of PATH environment variable:
#export PATH=$PATH:/usr/sfw/bin  #you can of course make the variable permanently changed via edit /etc/profile
Then,

#make
#make install
Finished!

Let’s have a test of curl:
# which curl
/usr/local/bin/curl

# curl -I -L www.doxer.org
HTTP/1.1 200 OK
Date: Mon, 18 Apr 2011 01:36:14 GMT
Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By: PHP/5.2.9
X-Pingback: http://www.doxer.org/xmlrpc.php
Content-Type: text/html; charset=UTF-8
Connection: Keep-Alive

Categories: Unix Tags:

Using zpool clear to resolve zpool “cannot open” issue

April 17th, 2011 2 comments

I’ve created a zfs pool tank using one removable disk. And it worked all ok before I reboot it.

As I unpluged the disk before rebooting, so zpool list returned “FAULTED” on Healthy column:

-bash-3.00# zpool list
NAME   SIZE  ALLOC   FREE    CAP  HEALTH  ALTROOT
tank      -      -      -      -  FAULTED  -

Using zpool status -x to check:

-bash-3.00# zpool status -x
pool: tank
state: UNAVAIL
status: One or more devices could not be opened.  There are insufficient
replicas for the pool to continue functioning.
action: Attach the missing device and online it using ‘zpool online’.
see: http://www.sun.com/msg/ZFS-8000-3C
scrub: none requested
config:

NAME        STATE     READ WRITE CKSUM
tank        UNAVAIL      0     0     0  insufficient replicas
c4t0d0    UNAVAIL      0     0     0  cannot open

c4t0d0 is the name of the removable disk. Using iostat -En, I can see that the disk is not connect to system:

-bash-3.00# iostat -En
c0d1             Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Model: ST31000524AS    Revision:  Serial No:             9VP Size: 1000.20GB <1000202305536 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0
c1t0d0           Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: SAMSUNG  Product: CDRW/DVD SM-348B Revision: T509 Serial No:
Size: 0.00GB <0 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 2 Predictive Failure Analysis: 0

c0d1 is the hard disk, and c1t0d0 is SAMSUNG DVD.

Now, after plugging in the removable disk, and run again iostat -En, I can see that one more entry returned by iostat -En:

c4t0d0           Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: Generic  Product: USB Disk         Revision: 9.02 Serial No:
Size: 20.00GB <20003880960 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 3 Predictive Failure Analysis: 0

As I’ve plugged the removable disk that comprised the zfs pool, then I can use zpool clear to let zfs to recheck the status of itself:

-bash-3.00# zpool clear tank

After this, using zpool status -x, we can see the pool is in healthy status:

-bash-3.00# zpool status -x
all pools are healthy

After getting zpool back to work, let’s check the status of zfs:

-bash-3.00# zfs list

NAME                  USED  AVAIL  REFER  MOUNTPOINT
tank                  254K  18.2G    22K  /tank
tank/home             150K  18.2G    23K  /tank/home
tank/home/firsttry    106K  18.2G   106K  /tank/home/firsttry
tank/home/secondtry    21K  18.2G    21K  /export/secondtry

When I tried to cd to /tank/home, it prompt me:

-bash-3.00# cd /tank/home
-bash: cd: /tank/home: No such file or directory

That’s because zfs not been mounted yet, let’s mount all zfs then:

-bash-3.00# zfs mount -a

Ok, now we can cd to that directory:

-bash-3.00# cd /tank/home/
-bash-3.00# pwd
/tank/home

 

Categories: Unix Tags:

UNIX Printers not working status solution

April 17th, 2011 No comments

Sometimes, unix printers do not work due to some faults of the service. Usually you would have to clean the queue and restart the printer spooler service.

For an example see below:

From the printer-hosting system, check the status of unix printers(all status information):

root@localhost#lpstat –t

printer PRINTER_NAME faulted printing PRINTER_NAME-27847. enabled since Feb 28 10:07 2009. available.

PRINTER_NAME: processing

root@localhost# ping PRINTER_NAME

PRINTER_NAME is alive

root@localhost# lpstat -p PRINTER_NAME #check the status of PRINTER_NAME unix printer status

printer PRINTER_NAME now printing PRINTER_NAME-27847. enabled since Tue Feb 24 09:35:32 2009. available.

root@localhost# lpc clean PRINTER_NAME

clean: PRINTER_NAME: ok-substitution

root@localhost# lpc restart PRINTER_NAME #start a new printer daemon

root@localhost# lpstat -p PRINTER_NAME

printer PRINTER_NAME idle. enabled since Sat Feb 28 10:10:36 2009. available.

root@localhost# lpstat -t | grep PRINTER_NAME

device for PRINTER_NAME: /dev/PRINTER_NAME

PRINTER_NAME accepting requests since Fri Jun 06 09:04:18 2008

printer PRINTER_NAME idle. enabled since Sat Feb 28 10:10:36 2009. available.

# All seems ok so print a test page

root@localhost# echo ‘Hello World’ | lp -d PRINTER_NAME

request id is PRINTER_NAME-27862 (standard input)

root@localhost# lpstat -p PRINTER_NAME

printer PRINTER_NAME idle. enabled since Sat Feb 28 10:10:36 2009. available.

Categories: Unix Tags:

openview Error getting OvCore ID solution

April 17th, 2011 No comments

In order to resolve the issue I had to do the following:

/opt/OV/bin/opcagt -stop
/opt/OV/bin/opcagt -kill
./ovcoreid -version
./ovcoreid -create
./ovcert -check
./ovcert -list
./ovcert -remove 62647e9a-b574-753b-023c-c23175d68bad
./ovcert -remove CA_1a50fab8-f092-750d-1d73-ff3268150d67
./ovcert -remove CA_3f49eabc-9514-752f-15c8-ff1a32bb2ec3
./ovcert -remove CA_ebc2af64-3bbc-750d-0528-c9520bf60692
/opt/OV/bin/OpC/install/opcactivate -srv test-cert_srv test

Then got error:

(xpl-273) Error occurred when loading configuration file ‘/var/opt/OV/conf/xpl/config/local_settings.ini’.
(xpl-272) Syntax error in line 0.
(xpl-95) Conversion to UTF16 failed.
(xpl-278) Processing update jobs skipped.

Then, do the following steps:

cd /var/opt/OV/conf/xpl/config/
mv local_settings.ini local_settings.ini_corrupted
/opt/OV/bin/OpC/install/opcactivate -srv test-cert_srv test
/opt/OV/bin/ovcert -certreq

bash-3.00# /opt/OV/bin/ovcert -list
+———————————————————+
| Keystore Content |
+———————————————————+
| Certificates: |
+———————————————————+
| Trusted Certificates: |
+———————————————————+
bash-3.00# /opt/OV/bin/ovc -status
ovcd OV Control CORE (17140) Running
ovbbccb OV Communication Broker CORE (17141) Running

Categories: HA & HPC Tags:

About swap file & swap space create/delete

April 17th, 2011 No comments

Best practice: The size of SWAP is usually set to twice the size of memory, but should not exceed 2G.

There are two ways to add space to SWAP:

Add swap partition using fdisk
Create swap file using mkswap

Let’s go through one by one.
1. Add swap partition using fdisk:
1)create a swap partition:
fdisk -l /dev/cciss/c0d0 (m—p —n –t (82)–w)(Result: /dev/cciss/c0d0p6)
2)Format the partition:
mkswap -c v1 /dev/cciss/c0d06;
3)Modify /etc/fstab, add a line:
/dev/cciss/c0d0p6 swap swap default 0 0
4)Activate swap partition:
swapon -a /dev/cciss/c0d0p6
5) Check the result:
swapon -s OR free -m OR cat /proc/swaps
2.Create swap file using mkswap
1)dd if=/dev/zero of=/tmp/tmp.swap bs=1M count =100( make a file of 100MB);
2)mkswap /tmp/tmp.swap(set up a Linux swap area)
3)swapon /tmp/tmp.swap;(Activate inux swap area)
4)Modify /etc/fstab, add a line below:
/tmp/tmp.swap swap swap defaults 0 0
5)Check the result:
swapon -s OR free -m OR cat /proc/swaps
3.Delete swap area or swap file
1) swapoff /dev/cciss/c0d0p6 #or delete swap file
2) modify /etc/fstab and comment out the line you just added.

NB: Read more…

Categories: Linux, Unix Tags:

Symantec products reference manual and docs – AWESOME

April 17th, 2011 No comments

Please refer to:

https://sort.symantec.com/documents

Just find your destination and click on it(for example, symantec netbackup, symantec veritas, symantec filestore, symantec Veritas Cluster Server, etc.), a pdf reference manual will be there for you then. AWESOME, isn’t that? :D

Categories: Hardware, Storage Tags:

EMC BCV database backup howto

April 17th, 2011 4 comments

What is a BCV ?
A BCV (Business Continuity Volume) is a snapshot of a set of EMC Symmetrix logical disk devices (luns).
The luns are grouped together into logical units known as symdgs and it is at the symdg level that bcv establishes work. This snapshot is taken at a block level.
When a snapshot (known as a bcv sync) is taken it can be either a full establish or an incremental establish.
• A full establish synchronizes all blocks across the devices.
• An incremental establish only synchronizes those blocks that have been changed since the last establish.

As the BCV is an exact replica of the ‘live’ data it can be accessed in the same way that the original data is (eg if the original data is a VxVM diskgroup, the BCV can also be imported as a vxdg on a different host)

The BCV does not necessarily have to be established to devices in the same Symmetrix Array as the live data. A bcv established to devices in a second array is known as a remote bcv (rbcv)

Essentially, BCVs are just mirrors of storage. Each BCV is a separate device that can be either attached or ‘split’. When BCV is attached to the standard volume, it is first synchronised with the master copy, and then all the changes are applied to both the master and BCV.
Fully mirrored drive sets

Fully mirrored drive sets

When you split the BCV, the changes are no longer propagated to it and the device can be imported on any other server connected to that storage array. You can then perform any operations with recent production data, like a backup, without impacting production performance.
The split-mirror set after the splitting process

The split-mirror set after the splitting process

Usual steps the each backup consists of are: Read more…

Categories: Storage Tags:

Mysql tricks – fix replication error

April 17th, 2011 No comments

Fixing MySQL service start problem:”manager of pid file could nor be found”

1. Check for any invalid entry in /apps/mysql/etc/my.cnf and correct it and restart service. If unsuccessfull, follow step#2 and below.

2. Delete all binary log, error log files under the directories below and start the service:

/apps/mysql/log
/apps/mysql/log.replicate
/apps/mysql/log.relay

3. If step#2 is successful and required to fix service startup, reset replication state using the command:

a) shell> mysql -h host -u user ?p
b) mysql> reset master;
c) mysql> stop slave;
d) mysql> reset slave;
e) mysql> start slave;

Note: Step#3 needs to be executed in both the servers in the replication pair

Get mysql version info and server variables from server

Shell> mysqladmin version ?h -u -p

Shell> mysqladmin variables ?h -u -p

Fix replication error (if slave is NOT beyond the current binary log file master is using)

This is to skip the current transaction that the replication thread is hung on and continue (at SLAVE server). You can issue the following command in mysql to skip a transaction:

Mysql> STOP SLAVE;

mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;

NOTE:

1.Use the value 1 for any SQL statement that does not use AUTO_INCREMENT or LAST_INSERT_ID(), otherwise you will need to use the value 2.

2.Statements that use AUTO_INCREMENT or LAST_INSERT_ID() take up 2 events in the binary log.

mysql> START SLAVE;

mysql> SHOW SLAVE STATUS\G;

Continue repeating the steps until the replication error is cleared.

Fix replication error (if slave is beyond the current binary log file master is using)

You need to follow backup databases from master server and restore it to slave server to sync and reinitiate replication. Follow the steps below to do that:

Step#1: Stop slave thread at the slave server (on Slave server):

mysql> STOP SLAVE;

Step#2: Impose a global read lock (in Master Server). Start the command line client and flush all tables and block write statements by executing the FLUSH TABLES WITH READ LOCK statement:

mysql> FLUSH TABLES WITH READ LOCK;

Note: DO NOT close the connection console from where the command is executed, otherwise lock will be released

Step#3: Backup databases from Master server Backup the databases from the master server through executing the command below:

shell> mysqldump ?h -u -p –all-databases –opt –routines –master-data –single-transaction > dbdump.db

Step#4: Restore databases at Slave Server Restore the database at server with the backup taken at step#3, using the command below

Shell> mysql -h -u -p < dbdump.db

Step#5: Start Slave thread (at slave server) Start slave thread at the slave server using the command:

mysql> START SLAVE;

mysql> SHOW SLAVE STATUS\G;

Step#6: Release global read lock at Master Server Release the write block at master server imposed at step#2 using the command below at the same console used:

mysql> UNLOCK TABLES;

mysql> exit;

Reset replication

If the data are already synced between the master server and slave server and you only need to reset replication status to its initial state, execute the commands below in BOTH master and slave servers:

shell> mysql ?h -u -p mysql> reset master;

mysql> stop slave;

mysql> reset slave;

mysql> start slave;

Change replication configuration setting

If you change the replication configuration setting in the my.cnf configuration file and mysql service is not catching it up after a restart, follow any one of the step below:

1. Stop mysql server

2. Delete the file: /apps/mysql/log.replicate/master.info

3. Update mysql configuration file with the desired replication configuration setting (if not already done).

4. Start the mysql service

NOTE:

Replication configuration setting can also be changed in run-time through mysql command:

mysql> CHANGE MASTER TO -> MASTER_HOST=’master_host_name’, -> MASTER_USER=’replication_user_name’, -> MASTER_PASSWORD=’replication_password’, -> MASTER_LOG_FILE=’recorded_log_file_name’, -> MASTER_LOG_POS=recorded_log_position;

Point in time restore

mysql -uroot ?mypassword POSITIONING EXAMPLE

shell> mysqlbinlog –stop-position=”368312″ /var/log/mysql/bin.123456 \ | mysql -u root -p shell> mysqlbinlog –start-position=”368315″ /var/log/mysql/bin.123456 \ | mysql -u root -p

NOTE:

In this example, I am assuming that log-bin mode has been used to start the daemon. You can also start this using MySQL admin tool. The logfiles are usually stored in the base directory of the data folder. This example uses a stop date to specify when the log replay should stop. You can also use log positioning. To know which log to use, use SHOW MASTER STATUS.

Examining binary log

mysqlbinlog –start-date=”2008-05-01 13:49:00″ –stop-date=”2008-05-01 13:51:59″ binary_logfile.000004 > C:\drop\mysql_restore.sql

NOTE:

This will produce a file and give dates and positions on what changes occurred so you can more accurately specify what stop and start times to use.

Categories: Databases Tags:

solaris runlevel – determin the runlevel of solaris and type of runlevel in solaris

April 17th, 2011 No comments

How many runlevels in solaris
Totally there are 9 run levels.
init -0 prom stage ok
init -s single user mode with out network
init -S single user mode with network
init -1 single user mode with non system disk
init -2 multi user mode with out nfs
init -3 multi user mode with nfs
init -4 currently not in use
init -5 halt the system
init -6 reboot the system
NB:man init for details about runlevels.

How to determine the runlevel of solaris:

who -r #-r, Indicates the current run-level of  the  init  process.

Categories: Unix Tags:

Solaris pca patching – required patch 142909-17 does not exist

April 17th, 2011 No comments

Firstly, download patch file using pca -d option.
Then, install patches using pca -i option (presume that you have downloaded patches in patches directory, pca patching method need not system in runlevel 1)

./pca -X . -P ./patches -i 2>&1 |tee /var/sadm/patch/Patching.log.`date +%Y%m%d`
If all goes well, you should restart your system:
reboot — -r
However, I come across with error “required patch 142909-17 does not exist”.
Then, I decide to install this patching:

./pca -X . -y -P ./patches -i 142909-17
After running that, it alerts:
** Zone none-global is not in a halted state.
** All non-global zones must be in the halted state before installing
** the specified patches. Halt all non-global zones and then
** execute patchadd again.
Ok. According to the prompt, I should firstly halt (shut down is better) non-global zone using zoneadm -z none-global halt (zlogin none-global shutdown -i5 -g0 -y), then go on with the patching process.
Notice:
Before patching servers, you should firstly take snapshot of all processes currently running on them (both global zone & non-global zone), and filesystem snapshot (using df -k). Then, stop services that will be patched later, for example, if you have oracle instance running inside the box, you should stop it, then checking if it’s still running using:

ps -ef | grep smon | grep -v grep
If you have veritas running on it, freeze and stop it:

haconf -makerw
hasys -freeze -persistent -evacuate
haconf -dump -makero
hastop -local
After patching, you should recover all processes and check filesystem snapshot.

Categories: Unix Tags:

howto replace bad disk on Solaris OS with madmin tool

April 17th, 2011 No comments

plain text stops working again, please check the pdf file here: howto replace bad disk on Solaris OS with madmin tool

Categories: Hardware, Storage Tags:

Install driver for rtl8111d of mother board GA-880GM-D2H on solaris10

April 17th, 2011 No comments

I’ve installed solaris10 on my DIY computer which has a mother board of GA-880GM-D2H. After installation, the server boot ok, but when I checked with ifconfig -a, it only showed lo0 – the loop NIC, this means that the system cannot detect the NIC of rtl8111d which is integrated into mother board of GA-880GM-D2H.

After searching a lot on google, I’ve found this url: http://homepage2.nifty.com/mrym3/taiyodo/eng/. Under “15. gani driver for Realtek rtl8169 rtl8110 rtl8168 rtl8101 PCI/PCI-Express GbE chipset” of that page, I downloaded gani-2.6.8.tar.gz which is for AMD64(you can use isainfo -n to check the platform of your cpu). Then it’s time to compile the package to solaris.

Firstly, unzip the file:

gunzip -cd gani-2.6.8.tar.gz | tar xf -

Make links to correct binary directory and Makefile according to yourconfiguration:

#cd gani-2.6.8

# rm obj Makefile

#ln -s Makefile.${KARCH}_${COMPILER} Makefile

# ln -s ${KARCH} obj

where ${KARCH} is the result of `isainfo -n`, and ${COMPILER} is ”gcc” or “suncc” which you want to use to make the driver.

Now, time to make and make install:

/usr/ccs/bin/make

Testing before installation:

#./adddrv.sh

#modload obj/gani

#devfsadm -i gani

#ifconfig gani0 plumb

#ifconfig -a #you will see an entry for gani0

/usr/ccs/bin/make install

OK, then, you need set ip address for your newly installed NIC gani0:

#vi /etc/hostname.gani0
doxer
#chmod 644 /etc/inet/netmasks
#vi /etc/inet/netmasks

192.168.0.11 255.255.255.0

#chmod 644 /etc/inet/hosts

#vi /etc/inet/hosts
192.168.0.11 doxer loghost
#chmod 644 /etc/inet/ipnodes
#vi /etc/inet/ipnodes
192.168.0.11 doxer loghost
#vi /etc/defaultrouter
192.168.0.1

#hostname doxer
After all the steps, reboot the system: init 6.

You should now see your NIC device:

#dladm show-link

If you want to set this through interactive mode, you can try to use sys-unconfig utility.

Optimization of php array_intersect():get repetitive value of arrays

April 17th, 2011 No comments

Imagine that now we have a site that shows users varies kinds of mobile-phones. The search functionality allows our users to find their phones through different kinds of criteria(For example, by OS type, screen resolution, whether the phone has a webcam, etc). Now, we use associate arrays to store the infomation of all mobiles, each key represents one attribute of the cellphones, and the value represents name of them. Then, we can intersect several arrays to get the specified phone.

Imagine that each key contains 1,000 products IDs, let’s get the material for the performance test.

Firstly, let’s test the performance of php built-in function array_intersect():

Before optimizing the function, you must notice one special point of the funcion:

Result:
* array_intersect($param_a, $param_b): 1, 2, 2
* array_intersect($param_b, $param_a): 1, 2

From the result we can conclude that if there are repetitive values in the first array, then the return value of function array_intersect will give all the repetitive values. Based on this, we should think out of a way to remove the repetitive ones.

Below is the function int_array_intersect() which is implemented by custom:

function int_array_intersect() {
if (func_num_args() < 2) {
trigger_error(‘param error’, E_USER_ERROR);
}

$args = func_get_args();

foreach ($args AS $arg) {
if (!is_array($arg)) {
trigger_error(‘param error’, E_USER_ERROR);
}
}

$intersect = function($a, $b) {
$result = array();

$length_a = count($a);
$length_b = count($b);

for ($i = 0, $j = 0; $i < $length_a && $j < $length_b; null) {
if($a[$i] < $b[$j] && ++$i) {
continue;
}

if($a[$i] > $b[$j] && ++$j) {
continue;
}

$result[] = $a[$i]; //only element in $a and $b which is the same are set to the $result array.

if (isset($a[$next = $i + 1]) && $a[$next] != $a[$i]) {
++$j;
}
++$i;
}

return $result;
};

$result = array_shift($args);
sort($result); //sort elements in the first array

foreach ($args as $arg) {
sort($arg); //sort elements in the compared arrays, i.e. elements after the first element.
$result = $intersect($result, $arg);
}

return $result;
}

$time = microtime(true);

$result = int_array_intersect($param_a, $param_b);

$time = microtime(true) – $time;

echo “int_array_intersect: {$time}\n”;
By intuition, we prefer the built-in functions to customized ones, as we usually think that the built-in ones are faster than built-in ones. However, the test result shows that it’s the opposite:

* array_intersect: 0.023918151855469
* int_array_intersect: 0.0026049613952637

Why this happens?
Yep, as the customized function int_array_intersect() all handles with integers, otherwise the built-in array_intersect handles with the string even if you pass integers as parameters, so we get the result as that way.

PS:
The php code are compatible with PHP5.3.5, you should change the function a little to fit your version of PHP.

Categories: Programming Tags:

howto replace bad disk on Solaris OS with madmin tool

April 17th, 2011 No comments

How to replace bad disk on Solaris OS?

Below we will show you an example on how to do it through the using of madmin and unix diskset tools like format etc.

1. split the mirror with:

lockfs -af  and then metadetach mirror submirror

2. madmin to replace the new disk:

Entered “madmin” menu”: root@localhost # madmin Machine Administration Menu

1. Hardware Configuration
2. Hardware Monitoring Information
3. RCI-related Settings
4. System Control Administration
5. eXtended System Control Facility (XSCF) Administration
6. Log Data
7. Hot Swapping Guide
8. FJVTS Diagnostic Program
9. Remote Customer Support System (REMCS) Setup
10. Hardware Control Program (HCP) Administration
11. Option Menu 12. Version Information
13. Exit

q:Quit b:Back to previous menu t:Go to top menu h:Help

Select(1-13,q,h):7 Hot Swapping Guide

1. The Faulty Hard Disk Drive Replacement (Hot Swap)
2. Preventive Maintenance of the Hard Disk Drive (Hot Swap)
3. Include the Hard Disk Drive after the Cold Maintenance
4. Power Supply Unit of Main Cabinet
5. Fan Unit of Main Cabinet
6. Power Supply Unit of Expansion Cabinet
7. Fan Unit of Expansion Cabinet

q:Quit b:Back to previous menu t:Go to top menu h:Help

Select(1-7,q,b,t,h):

2 Preventive Replacement for Disk

Input the disk name to be replaced. One of the following notation can be used:

Instance Name(sdX)
Device Special File Name(cXtXdXsX)
Unit Name(PCI#X-ID#X, SCSI#X-ID#X, etc.)

L: Select from a list.

q:Quit b:Back to previous menu t:Go to top menu h:Help

Select (name,L,q,b,t,h):c1t0d0s2 Preventive Replacement for Disk

Disk name:

/dev/rdsk/c1t0d0s0 (sd16: SCSI#1-PORT#0-ID#0)

Disk error statistics information:

Date         Error count
Nov 13 2010 :    1
……
Jan 10 2011 :    1

Are you going to replace this disk ?

q:Quit b:Back to previous menu t:Go to top menu h:Help

Select (y,q,b,t,h):y Preventive Replacement for Disk

Disk name:

/dev/rdsk/c1t0d0s0 (sd16: SCSI#1-PORT#0-ID#0)

This disk is going to be logically excluded.

Input “y” to continue.

q:Quit b:Back to previous menu t:Go to top menu h:Help

Select (y,q,b,t,h):y
Disk to be replaced /dev/rdsk/c1t0d0s0 (sd16: SCSI#1-PORT#0-ID#0)

Are you sure to start replacement by hot swap ?(y,n):y Target disk can be located by LED.Please change disk.

(At this point the engineer physically replaces the disk.)

1: disk change has finished. 2: disk change has been aborted. Please enter 1 or 2. 1 Completed Hit return key. Hot Swapping Guide

1. The Faulty Hard Disk Drive Replacement (Hot Swap)
2. Preventive Maintenance of the Hard Disk Drive (Hot Swap)
3. Include the Hard Disk Drive after the Cold Maintenance
4. Power Supply Unit of Main Cabinet
5. Fan Unit of Main Cabinet
6. Power Supply Unit of Expansion Cabinet
7. Fan Unit of Expansion Cabinet

q:Quit b:Back to previous menu t:Go to top menu h:Help

Select(1-7,q,b,t,h):q Machine Administration Menu

1. Hardware Configuration
2. Hardware Monitoring Information
3. RCI-related Settings
4. System Control Administration
5. eXtended System Control Facility (XSCF) Administration
6. Log Data
7. Hot Swapping Guide
8. FJVTS Diagnostic Program
9. Remote Customer Support System (REMCS) Setup
10. Hardware Control Program (HCP) Administration
11. Option Menu
12. Version Information
13. Exit

q:Quit b:Back to previous menu t:Go to top menu h:Help

Select(1-13,q,h):q
3. format the new disk

1. c1t0d0 <FUJITSU-MAW3073NC-3701 cyl 24345 alt 2 hd 8 sec 737>
/pci@83,4000/FJSV,ulsa@2/sd@0,0

Specify disk (enter its number): 1

selecting c1t0d0

[disk formatted]
FORMAT MENU:

disk       – select a disk
type       – select (define) a disk type
partition  – select (define) a partition table
current    – describe the current disk
format     – format and analyze the disk
repair     – repair a defective sector
label      – write label to the disk
analyze    – surface analysis
defect     – defect list management
backup     – search for backup labels
verify     – read and display labels
save       – save new disk/partition definitions
inquiry    – show vendor, product and revision
volname    – set 8-character volume name
!<cmd>     – execute <cmd>, then return
quit

format> partition

PARTITION MENU:

0      – change `0′ partition
1      – change `1′ partition
2      – change `2′ partition
3      – change `3′ partition
4      – change `4′ partition
5      – change `5′ partition
6      – change `6′ partition
7      – change `7′ partition
select – select a predefined table
modify – modify a predefined partition table
name   – name the current table
print  – display the current table
label  – write partition map and label to the disk
!<cmd> – execute <cmd>, then return
quit

partition> print Current partition table (original): Total disk cylinders available: 24345 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
0       root    wm    1423 -  4268        8.00GB    (2846/0/0)   16780016
1       swap    wu       0 -  1422        4.00GB    (1423/0/0)    8390008
2     backup    wm       0 – 24344       68.44GB    (24345/0/0) 143538120
3 unassigned    wm    4269 -  4442      500.93MB    (174/0/0)     1025904
4 unassigned    wm    4443 -  6577        6.00GB    (2135/0/0)   12587960
5        var    wm    6578 -  8712        6.00GB    (2135/0/0)   12587960
6 unassigned    wm    8713 – 24337       43.93GB    (15625/0/0)  92125000
7 unassigned    wm   24338 – 24344       20.15MB    (7/0/0)         41272

partition> 0

Part      Tag    Flag     Cylinders         Size            Blocks
0       root    wm       0 -  5334       15.00GB    (5335/0/0)   31455160

Enter partition id tag[root]:

Enter partition permission flags[wm]:

Enter new starting cyl[0]:

Enter partition size[31455160b, 5335c, 15358.96mb, 15.00gb]: 5336c

partition> 1

Part      Tag    Flag     Cylinders         Size            Blocks
1       swap    wu    5336 – 12093       19.00GB    (6758/0/0)   39845168

Enter partition id tag[swap]:

Enter partition permission flags[wu]:

Enter new starting cyl[5336]:

Enter partition size[39845168b, 6758c, 19455.65mb, 19.00gb]: 1423c

partition> 3

Part      Tag    Flag     Cylinders         Size            Blocks
3 unassigned    wm    4269 -  4442      500.93MB    (174/0/0)     1025904

Enter partition id tag[unassigned]: var

Enter partition permission flags[wm]:

Enter new starting cyl[4269]: 6759

Enter partition size[1025904b, 174c, 500.93mb, 0.49gb]: 1779c

partition> 4

Part      Tag    Flag     Cylinders         Size            Blocks
4 unassigned    wm    4443 -  6577        6.00GB    (2135/0/0)   12587960

Enter partition id tag[unassigned]: stand

Enter partition permission flags[wm]: wu

Enter new starting cyl[4443]: 8538

Enter partition size[12587960b, 2135c, 6146.46mb, 6.00gb]: 1779c

partition> 5

Part      Tag    Flag     Cylinders         Size            Blocks
5        var    wm    6578 -  8712        6.00GB    (2135/0/0)   12587960

Enter partition id tag[var]: stand

Enter partition permission flags[wm]:

Enter partition size[12587960b, 2135c, 6146.46mb, 6.00gb]: 1779c

partition> 6

Part      Tag    Flag     Cylinders         Size            Blocks
6 unassigned    wm    8713 – 24337       43.93GB    (15625/0/0)  92125000

Enter partition id tag[unassigned]: stand

Enter partition permission flags[wm]:

Enter new starting cyl[8713]: 12096

Enter partition size[72220104b, 12249c, 35263.72mb, 34.44gb]: 12231c

partition> 7

Part Tag Flag Cylinders Size Blocks

7 unassigned    wm   24338 – 24344       20.15MB    (7/0/0)         41272

Enter partition id tag[unassigned]: stand

Enter partition permission flags[wm]:

Enter new starting cyl[24338]: 24327

Enter partition size[41272b, 7c, 20.15mb, 0.02gb]: 18c

partition> print

Current partition table (unnamed): Total disk cylinders available: 24345 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks

0       root    wm       0 -  5335       15.00GB    (5336/0/0)   31461056
1       swap    wu    5336 -  6758        4.00GB    (1423/0/0)    8390008
2     backup    wm       0 – 24344       68.44GB    (24345/0/0) 143538120
3        var    wm    6759 -  8537        5.00GB    (1779/0/0)   10488984
4      stand    wu    8538 – 10316        5.00GB    (1779/0/0)   10488984
5      stand    wm   10317 – 12095        5.00GB    (1779/0/0)   10488984
6      stand    wm   12096 – 24326       34.39GB    (12231/0/0)  72113976
7      stand    wm   24327 – 24344       51.82MB    (18/0/0)       106128

partition> label

Ready to label disk, continue? y

partition> print Current partition table (unnamed): Total disk cylinders available: 24345 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks

0       root    wm       0 -  5335       15.00GB    (5336/0/0)   31461056
1       swap    wu    5336 -  6758        4.00GB    (1423/0/0)    8390008
2     backup    wm       0 – 24344       68.44GB    (24345/0/0) 143538120
3        var    wm    6759 -  8537        5.00GB    (1779/0/0)   10488984
4      stand    wu    8538 – 10316        5.00GB    (1779/0/0)   10488984
5      stand    wm   10317 – 12095        5.00GB    (1779/0/0)   10488984
6      stand    wm   12096 – 24326       34.39GB    (12231/0/0)  72113976
7      stand    wm   24327 – 24344       51.82MB    (18/0/0)       106128

partition> quit
4. rebuild the mirror

metattach mirror submirror
if mirror already exits.
metattach d0 d20 (only this step needed)
if newly build one mirror.
metainit d14 1 1 c1t0d0s4
metainit d4 -m d14
metattach d4 d24

Ref

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

Part Tag Flag Cylinders Size Blocks

0       root    wm       0 -  5335       15.00GB    (5336/0/0)   31461056
1       swap    wu    5336 -  6758        4.00GB    (1423/0/0)    8390008
2     backup    wm       0 – 24344       68.44GB    (24345/0/0) 143538120
3        var    wm    6759 -  8537        5.00GB    (1779/0/0)   10488984
4      stand    wu    8538 – 10316        5.00GB    (1779/0/0)   10488984
5      stand    wm   10317 – 12095        5.00GB    (1779/0/0)   10488984
6      stand    wm   12096 – 24326       34.39GB    (12231/0/0)  72113976
7      stand    wu   24327 – 24344       51.82MB    (18/0/0)       106128

root@localhost # metastat -p

d0 -m d20 1
d20 1 1 c0t0d0s0
d1 -m d21 1
d21 1 1 c0t0d0s1
d3 -m d23 1
d23 1 1 c0t0d0s3
d4 -m d14 1
d14 1 1 c1t0d0s4
d5 -m d25 1
d25 1 1 c0t0d0s5
d6 -m d26 1
d26 1 1 c0t0d0s6
d10 1 1 c1t0d0s0
d11 1 1 c1t0d0s1
d13 1 1 c1t0d0s3
d15 1 1 c1t0d0s5
d16 1 1 c1t0d0s6
d24 1 1 c0t0d0s4

Change dump device so that it isn’t using c1t0d0:

root@localhost # dumpadm -d /dev/dsk/c0t0d0s4

Dump content: kernel pages
Dump device: /dev/dsk/c0t0d0s4 (dedicated)

Savecore directory: /var/crash/localhost

Savecore enabled: yes

root@localhost # dumpadm

Dump content: kernel pages
Dump device: /dev/dsk/c0t0d0s4 (dedicated)

Savecore directory: /var/crash/localhost

Savecore enabled: yes

Remove metadevices d4, d14 and d24:

root@localhost # metaclear -r d4 d4: Mirror is cleared d14: Concat/Stripe is cleared

root@localhost # metaclear d24

Remove metadb replicas from c1t0d0:

root@localhost # metadb -d /dev/dsk/c1t0d0s7

root@localhost # metadb -i

flags           first blk       block count
a m  p  luo        16              1034            /dev/dsk/c0t0d0s7
a    p  luo        1050            1034            /dev/dsk/c0t0d0s7
a    p  luo        2084            1034            /dev/dsk/c0t0d0s7
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

Categories: Hardware, Storage Tags:

Solaris patching trick – first patch submirror, then sync between mirrors

April 17th, 2011 No comments

The main idea of this solution is that, we firstly patch submirror of solaris, and then sync between mirrors. This way, we prevent failure on the patching by sync only after the submirror patch succeed.

d0 is root metadevice
d3 is /var metadevice
d10 is c1t0d0s0
d20 is c1t1d0s0
d13 is c1t0d0s3
d23 is c1t1d0s3

- flush FS cache to disk
# sync; sync: sync

-keep a note of all disks with command format. You’ll need the info later:

AVAILABLE DISK SELECTIONS:
0. c1t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@1c,600000/scsi@2/sd@0,0
1. c1t1d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@1c,600000/scsi@2/sd@1,0
2. c1t2d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@1c,600000/scsi@2/sd@2,0
3. c1t3d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@1c,600000/scsi@2/sd@3,0

- detach root metadevice submirror
# metadetach d0 d20

- detach /var metadevice submirror
# metadetach d3 d23

- fsck detached submirrors
# fsck -F ufs /dev/rdsk/c1t1d0s0
# fsck -F ufs /dev/rdsk/c1t1d0s3

- mount detached submirrors in /a mountpoint
# mkdir /a
# mount /dev/dsk/c1t1d0s0 /a && mount /dev/dsk/c1t1d0s3 /a/var

- update mounted rootmirror vfstab and system files
vi /a/etc/vfstab
Change / and /var to mount the rootmirror slices instead of the metadevices(because metadevices are detached already)

vi /a/etc/system and remove the following lines
* Begin MDD root info (do not edit)
rootdev:/pseudo/md@0:0,0,blk
* End MDD root info (do not edit)

- start patching
# cd /var/patches/10_PC
# ./installcluster -R /a –apply-prereq –s10cluster
# nohup ./installcluster -R /a –s10cluster > install_cluster.log 2>&1 &

- monitor patching process
while true
do
grep -n `awk ‘/^Installing/ {print substr($2,1,9)}’ install_cluster.log | tail -1` patch_order_10_Recommended
sleep 60
done

- boot off patched submirrors
# to ease recovery in case of issues – temporarily set the following OBP values;
eeprom “auto-boot?=false”
eeprom “boot-device=rootmirror rootdisk” #boot from patched mirror, if fails, will boot from unpatched one.

/a/boot/solaris/bin/create_ramdisk -R /a
umount /a/var
umount /a

fsck -F ufs /dev/rdsk/c1t1d0s0
fsck -F ufs /dev/rdsk/c1t1d0s3

reboot #boot from d20, the patched mirror
NOTE:reboot successfully, checked uname -a, version updated.

- If happy with the results – the following process should be followed to make the newly patched sub-mirrors the new boot environment.

metaclear d20
metaclear d23
metaclear -r d0
metaclear -r d3

metainit -f d20 1 1 c1t1d0s0
metainit -f d23 1 1 c1t1d0s3
metainit d0 -m d20
metainit d3 -m d23

metaroot d0 #boot from the patched mirror

vi /etc/vfstab and update the line for /var filesystem to mount the d3 metadevice instead of the rootmirror slice

# update the rootdisk /etc/vfstab and /etc/system files so that we can still get back to the non-patched version of the O/S easily. i.e.

fsck -F ufs /dev/rdsk/c1t0d0s0
fsck -F ufs /dev/rdsk/c1t0d0s3

mkdir -p /a
mount /dev/dsk/c1t0d0s0 /a
mount /dev/dsk/c1t0d0s3 /a/var

vi /a/etc/vfstab
Change / and /var to mount the rootdisk slices instead of the metadevices #c1t0d0s0 and c1t0d0s3

vi /a/etc/system and remove the following lines
* Begin MDD root info (do not edit)
rootdev:/pseudo/md@0:0,0,blk
* End MDD root info (do not edit)

sync ; sync ; sync

umount /a/var
umount /a

init 6 #boot from d0

- if everything is ok, reattach old rootdisk:

metainit d10 1 1 c1t0d0s0
metainit d13 1 1 c1t0d0s3

metattach d0 d10 #will sync d10 d20
metattach d3 d13 #will sync d13 d23

# reset the OBP settings back to the normal values;
eeprom “auto-boot?=true”
eeprom “boot-device=rootdisk rootmirror”

then, alter kernel params as per EMC recommendations:

vi /etc/system

Must add “set sd:sd_io_time=60″, “set sd:sd_max_throttle=20″, “set ssd:ssd_io_time=60″, and “set ssd:ssd_max_throttle=20″ in the /etc/system file for Symmetrix or CLARiiON attach. Do not include quotes on these entries.

and reboot #reboot from synced rootdisk c1t0d0s0

Categories: Storage, Unix Tags:

Solved:missing config file ifcfg-ifcfg-eth0 on centos linux

April 17th, 2011 5 comments

When I ping the gateway, it gave this alert:

vif0.0: received packet with own address as source address
And when I tried to restart network, using service network restart, there was error message like this:

missing config file ifcfg-ifcfg-eth0

Then, when I checked the address of eth0, the hwaddr was abnormal:

HWaddr FE:FF:FF:FF:FF:FF

Ok, something must be in wrong status.

NOTE: When you met error “received packet with own address as source address“, this article is suitable for you too.

Firstly, I backed up ifcfg-eth0 to ifcfg-eth0.bak

[root@user network-scripts]# cp ifcfg-eth0 ifcfg-eth0.bak
Then, set the hardware address for eth0(I’ve mapped eth0′s hwaddr to static ip address in router):

ifconfig ethX hw ether 1C:6F:65:D2:47:7B

After this, shoot setup command to add new NIC device for eth0:

[root@user network-scripts]# setup
On the prompt up window, select “Network Configuration”, “Run Tool”. Then select “Edit device”, “<New Device>”. On the next window, select and enter on “Ethernet”.

Name is eth0, device is eth0, select “Use DHCP”(click space button when focus on the brackets). Save and Quit.

When come back to shell environment, restart the network:

service network restart, then the server will send request to DHCP server to allow ip address to itself.

And issue solved. :D

Categories: Kernel, Linux Tags:

ERROR: Unable to read from logfile ‘/var/opt/perf/datafiles/logxxx’ – corrupted data

April 17th, 2011 No comments

Try this:
1.# mwa stop all
Wait for all processes to terminate.
2.#ttd -k
3. Move the log files (/var/opt/perf/data/logxxx) into a different directory for later access or remove it.
4. Restart mwa to create the new logfile set
#mwa start all

NB:
What is wma?
mwa – performance tool script for starting and stopping data collection and alarms
mwa is a script  that  is  used  to  start,  stop,  and  re-initialize  HP Performance Agent processes.
On Sun Solaris,IBM/AIX and Tru64 UNIX systems, depending on which  communication  protocol  is installed and running, you can
choose a protocol selector (ncs or dce).

Categories: HA & HPC Tags:

Extending filesystems on LVM VXVM/VXFS how to

April 17th, 2011 No comments

Linux LVM

Growing:

You can grow LVM/ext pair online, without the need to umount the FS.

Step zero: check how much space is available in the PV in question, using “vgdisplay”
First, use “lvextend -L” to extend the volume. You can either specify total new size, like “2GB”, or how much space to add, like “+1GB”
Second, grow the FS. Use “resize2fs” without any flags to grow/shrink the FS to all the space available in the volume.
Example:

lvextend -L 2G /dev/VolGroup00/apps-yourapp
resize2fs /dev/VolGroup00/apps-yourapp
Shrinking:

Shrinking can’t be done that easily and requires an umount. To shrink the FS, do the following:

umount <logical-volume-device>
e2fsck -f <logical-volume-device>
resize2fs <logical-volume-device> <new-size-minus-50MB>
lvreduce -L <new-size> <logical-volume-device>
resize2fs <logical-volume-device>
mount <logical-volume-device>
Basically, we have to umount the partition and fsck it, then we resize the FS to a slightly smaller size then we want in the result, this saves us from counting up actual size blocks and possible errors buried here (if we accidentally resize the volume to be smaller then the FS, FS will become corrupted and there’s no easy way to restore it). Only then we shrink the volume and resize the FS to fill the whole volume.

Example:

umount /dev/VolGroup00/apps-yourapp
e2fsck -f /dev/VolGroup00/apps-yourapp
resize2fs /dev/VolGroup00/apps-yourapp 750M
lvreduce -L 800M /dev/VolGroup00/apps-yourapp
resize2fs /dev/VolGroup00/apps-yourapp
mount /dev/VolGroup00/apps-yourapp
Solaris zfs

Working with zfs filesystems is real simple. Just change quota and possibly reservation attributes on the relevant filesystem, like this:

zfs set quota=1G localpool/var-opt
zfs set reservation=1G localpool/var-opt
You can both grow and shrink filesystems like this, online.

Solaris VXVM/VXFS

1) Enlarging VxVM controlled filesystem by adding new LUN

- get & discover new LUN

TBA
- add LUN to DG

vxdg -g dg1 adddisk {disk_name}
-grow filesystem

vxresize -b -F vxfs -g dg1 vol1 100G
2) Enlarging VxVM controlled filesystem by extending LUN

- grow LUN

TBA
- refresh VxVM info on LUN size

vxdisk -g dg1 resize {disk_name}
- get new max volume size

vxassisst -b maxgrow vol1
- grow volume and FS

vxresize -b -F vxfs -g dg1 vol1 100G
PS:

If working on a server that is part of a cluster (VCS/WAS/other), make sure to apply changes to all nodes to keep them consistent.

Categories: Storage Tags:

Add netgroup on linux & solaris boxes

April 17th, 2011 No comments

1.Add Netgroup

When you have defined netgroup, sudo group and sudo command on your ldap server,  the next thing you should do is to add netgroup to your client server(which use ldap as authentication) on your linux or solaris box.

Method as follows:

  • For solaris

Edit /etc/passwd, add line(you should change name according to your requirements):

+@your-ng:x:::::

And then run pwconv

  • For linux

edit /etc/security/access.conf

+:@your-ng :ALL

Then run pwconv

2.Add a single user

  • For Linux

If you want to give access to test01 for server linux01 for example, edit /etc/security/access.conf, add line below:

+:test01 :ALL

And then run pwconv

  • For solaris

vi /etc/passwd

+test01:x:::::

Then run pwconv

To know which ldap server the client is using:

  • For solaris using iplanet DS, check /var/ldap/ldap_client_file. If it’s ip addresses, use nslookup xxx.xxx.xxx.xxx(the ipaddress) to check the server name
  • For linux using openldap, check /etc/ldap.conf.

Remember to test the user account when you finish your job.

That’s all about that. :D

PS:

Here’s something about linux/solaris +/- syntax(compat mode).

Interaction with +/- syntax (compat mode)
Linux libc5 without NYS does not have the name service switch but does
allow the user some policy control. In /etc/passwd you could have
entries of the form +user or +@netgroup (include the specified user
from the NIS passwd map), -user or -@netgroup (exclude the specified
user), and + (include every user, except the excluded ones, from the
NIS passwd map). Since most people only put a + at the end of
/etc/passwd to include everything from NIS, the switch provides a
faster alternative for this case (‘passwd: files nis’) which doesn’t
require the single + entry in /etc/passwd, /etc/group, and /etc/shadow.
If this is not sufficient, the NSS ‘compat’ service provides full +/-
semantics. By default, the source is ‘nis’, but this may be overridden
by specifying ‘nisplus’ as source for the pseudo-databases passwd_com-
pat, group_compat and shadow_compat. This pseudo-databases are only
available in GNU C Library.
The Linux libc5 with NYS support and the GNU C Library 2.x (libc.so.6)
contain a cleaner solution of this problem. It is designed after a
method used by Sun Microsystems in the C library of Solaris 2. We fol-
low their name and call this scheme “Name Service Switch” (NSS). The
sources for the “databases” and their lookup order are specified in the
/etc/nsswitch.conf file.

This means that, in solaris, if you add the following in /etc/nsswitch.conf:

passwd: files ldap

This will add all ldap accounts to the host. Whilst if you add the following in /etc/nsswitch.conf:

passwd_compat:files ldap

passwd:compat

This means you can now use +/- syntax(compat mode) in /etc/passwd.

In linux, we usually use /etc/security/access.conf to control access(include ldap) to the host.(You can also use /etc/passwd to control ldap users).

Categories: Linux, Unix Tags:

Veritas Cluster Brown Bag

April 17th, 2011 3 comments

Terms

Cluster — set of one or more nodes running resource group(s) in cooperation
Active-Active cluster — one resource group running on several nodes at the same time
Active-Passive cluster — one resource group running on single node at the same time
Resource group — logical set of resources which can’t be splitted and should work toghether to provide some services
Resource — is a resource of some resource type :)
Resource type — IP address, VxVM volume, VxFX file system, Oracle instance, etc.
Heartbeat — is a dedicated channel between nodes to communicate to each other (vi ethernet, storage, COM-port, etc).
Cluster panic — situation when one node loose connection to other nodes via hartbeat and hence don’t know what to do with resource groups
VIP — virtual IP address associated to resource group
Commands

# Status of cluster
hastatus -sum

# Failover some resource group from one node to another
hagrp -switch ResourceGroup1 -to Server1

# List of resources in resourse group
hares -list | grep ResourceGroup1

# Offline group
hagrp -offline ResourceGroup1 -sys test

# Online group
hagrp -online ResourceGroup1 -sys Server1

# Get state of group
hagrp -state ResourceGroup1

# Display group parameters (attributes)
hagrp -display ResourceGroup1

# Freeze resource group
hagrp -freeze ResourceGroup1

# Unfreeze resource group
hagrp -unfreeze ResourceGroup1

# Get list of supported resource types
hatype -list

# How to get commands which can be used to re-build VCS configuration
hacf -cftocmd /etc/VRTSvcs/conf/config -dest .
less main.cmd

# Stop all nodes in cluster
hastop

# Stop local node in cluster
hastop -local

# Stop local node in cluster w/o stopping resource groups and keep them running
hastop -local -force

# Start cluster
hastart

Practice

Task: Create new resource group ResourceGroup1 with VIP address associated with it.
Environment: Server1/Server2

# make cluster configuration read/write
haconf -makerw

# Create new resource group
hagrp -add ResourceGroup1
hagrp -modify ResourceGroup1 SystemList  Server1 0 Server2 1
hagrp -modify ResourceGroup1 AutoStartList  Server1 Server2
hagrp -modify ResourceGroup1 SourceFile “./main.cf”

# Add VIP (Virtual IP) to resource group
hares -add Server1_IP IP ResourceGroup1
hares -local Server1_IP Device
hares -modify Server1_IP Device ce5 -sys Server1
hares -modify Server1_IP Device ce1 -sys Server2
hares -modify Server1_IP Address “xxx.xxx.xxx.xxx”
hares -modify Server1_IP NetMask “255.255.255.0″
hares -modify Server1_IP IfconfigTwice 1
hares -modify Server1_IP ArpDelay 1
hares -modify Server1_IP Enabled 1

# make cluster configuration read/only
haconf -dump -makero

# Check state of resource group ResourceGroup1
hagrp -state ResourceGroup1

# Bring it online on Server2
hagrp -online ResourceGroup1 -sys Server2

# Check state of resource group ResourceGroup1 again
hagrp -state ResourceGroup1

# Ping IP address xxx.xxx.xxx.xxx, check ifconfig (on Server2):
ping xxx.xxx.xxx.xxx
ifconfig -a

# Failover ResourceGroup1 to Server1
hagrp -switch ResourceGroup1 -to Server1

# Check how it is moving
hastatus -sum

# Ping IP address xxx.xxx.xxx.xxx, check ifconfig (on Server1):
ping xxx.xxx.xxx.xxx
ifconfig -a

# Stop ResourceGroup1
hagrp -offline ResourceGroup1 -sys Server1

# Ping IP address xxx.xxx.xxx.xxx, check ifconfig (on both machines):
ping xxx.xxx.xxx.xxx
ifconfig -a

# Bring back online on Server1
hagrp -online ResourceGroup1 -sys Server1

# Manually unplumb IP:
ifconfig ce5:6 unplumb

# Wait while VCS will spot that IP missed. VCS will failover resource group ResourceGroup1 to Server2 at this point and will mark resource Server1_IP as failed on Server1
hastatus -sum

# Try to switch resource group ResourceGroup1 back to Server1. You’ll get error that some resources in this group are failed on Server1 and need to clear them.
hagrp -switch ResourceGroup1 -to Server1

# Check which resources are failed
hares -state | grep FAULT

# Clear failed resources
hares -clear Server1_IP -sys Server1

# Try to switch resource group ResourceGroup1 back to Server1 again after clearing of failed resources
hagrp -switch ResourceGroup1 -to Server1

# Stop ResourceGroup1
hagrp -offline ResourceGroup1 -sys Server1

# Remove ResourceGroup1 resources and resource group
haconf -makerw
hares -delete Server1_IP
hagrp -delete ResourceGroup1
haconf -dump -makero

Categories: HA & HPC Tags:

Difference between the block device and character device

April 17th, 2011 No comments

The /etc/vfstab contains entries for a single filesystem on a Solaris server:
For example:

/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /opt ufs 3 yes -

The first 2 fields in the above entry, list the same disk device as both a block device (“dsk”) and character device (“rdsk”). The block device is used by mount when mounting the filesystem while the character device is used by fsck when checking the filesystem and newfs when creating the filesystem.Both fields must be present in /etc/vfstab.

Categories: Kernel Tags:

About swap file & swap space create/delete

April 17th, 2011 No comments

Best practice: The size of SWAP is usually set to twice the size of memory, but should not exceed 2G.

There are two ways to add space to SWAP:

Add swap partition using fdisk
Create swap file using mkswap

Let’s go through one by one.
1. Add swap partition using fdisk:
1)create a swap partition:
fdisk -l /dev/cciss/c0d0 (m—p —n –t (82)–w)(Result: /dev/cciss/c0d0p6)
2)Format the partition:
mkswap -c v1 /dev/cciss/c0d06;
3)Modify /etc/fstab, add a line:
/dev/cciss/c0d0p6 swap swap default 0 0
4)Activate swap partition:
swapon -a /dev/cciss/c0d0p6
5) Check the result:
swapon -s OR free -m OR cat /proc/swaps
2.Create swap file using mkswap

1)dd if=/dev/zero of=/tmp/tmp.swap bs=1M count =100( make a file of 100MB);
2)mkswap /tmp/tmp.swap(set up a Linux swap area)
3)swapon /tmp/tmp.swap;(Activate inux swap area)
4)Modify /etc/fstab, add a line below:
/tmp/tmp.swap swap swap defaults 0 0
5)Check the result:
swapon -s OR free -m OR cat /proc/swaps
3.Delete swap area or swap file
1) swapoff /dev/cciss/c0d0p6 #or delete swap file
2) modify /etc/fstab and comment out the line you just added.

Categories: Kernel, Linux, Unix Tags:

Create a Solaris zone(under Sun Solaris)

April 17th, 2011 No comments

root@beisoltest03 / # zonecfg -z red
red: No such zone configured
Use ‘create’ to begin configuring a new zone.
zonecfg:red> create
zonecfg:red> info
zonename: red
zonepath:
brand: native
autoboot: false
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
zonecfg:red> add net
zonecfg:red:net> set address=10.240.3.212
zonecfg:red:net> set physical=e1000g1
zonecfg:red:net> set defrouter=10.240.3.254
zonecfg:red:net> end
zonecfg:red> verify
zonepath cannot be empty.
red: Required resource missing
zonecfg:red> set zonepath=/zone/red
zonecfg:red> verify
zonecfg:red> exit

it’s ready, let’s check

root@beisoltest03 / # zonecfg -z red
zonecfg:red> info
zonename: red
zonepath: /zone/red
brand: native
autoboot: false
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
net:
address: 10.240.3.212
physical: e1000g1
defrouter: 10.240.3.254

Now install it

root@beisoltest03 / # zoneadm -z red install
Preparing to install zone <red>.
Creating list of files to copy from the global zone.
Copying <7792> files to the zone.

Now give it life

root@beisoltest03 / #zoneadm -z red boot

root@beisoltest03 / #zlogin -C red

Welcome to new world .

PS: Other commands that will be used in future:

zoneadm list -cv
Boot the zone called \jubail”
zoneadm -z jubail boot
Delete zone and con guration from system
zoneadm -z jubail uninstall -F
Login to the console of the jubail zone from the global zone
zlogin -C jubail (Exit from session with ~. escape sequence)
Halt the jubail zone (no shutdown scripts will be run)
zoneadm -z jubail halt
Shutdown the jubail zone from the global zone
zlogin jubail shutdown -i0 -g0 -y
List what zone you are currently in
zonename
View zone performance statistics (from global zone)
prstat -Z

Categories: Unix Tags: