Friday, October 5, 2012

Solaris 10 x86 SVM failed root disk replacement


Check the disk for errors with iostat -en, format etc.



 +$ metadb
        flags           first blk       block count
     a m  p  luo        16              8192            /dev/dsk/c3t3d0s7
     a    p  luo        8208            8192            /dev/dsk/c3t3d0s7
     a    p  luo        16400           8192            /dev/dsk/c3t3d0s7
     W    p  luo        16              8192            /dev/dsk/c3t2d0s7
     W  p  luo        8208            8192            /dev/dsk/c3t2d0s7
     W   p  luo        16400           8192            /dev/dsk/c3t2d0s7
[02:57:16]

If you are seeing your metadb with 'W', then it has write errors.

$metastat -c
d60              m  120GB d61 d62 (maint)
    d61          s  120GB c3t3d0s6
    d62          s  120GB c3t2d0s6 (maint)
d40              m  2.0GB d41 d42 (maint)
    d41          s  2.0GB c3t3d0s4
    d42          s  2.0GB c3t2d0s4 (maint)
d30              m  4.0GB d31 d32 (maint)
    d31          s  4.0GB c3t3d0s3
    d32          s  4.0GB c3t2d0s3 (maint)
d10              m  2.0GB d11 d12 (maint)
    d11          s  2.0GB c3t3d0s1
    d12          s  2.0GB c3t2d0s1 (maint)
d0               m  8.0GB d1 d2 (maint)
    d1           s  8.0GB c3t3d0s0
    d2           s  8.0GB c3t2d0s0 (maint)
[02:31:42] charihar@thunderbird:/home/charihar



Now we need to replace the disk.

Procedure for disk replacement. 



Get the disk replaced with a same capacity disk.

Delete the metadb from faulty disk.

$metadb -d  c3t2d0s7

Detach and clear faulty sub-mirrors

$metadetach -f d0 d1
$metadetach -f d10 d11
$metadetach -f d30 d31
$metadetach -f d40 d41
$metadetach -f d60 d61

$metaclear d1
$metaclear d11
$metaclear d31
$metaclear d41
$metaclear d61

Re-Boot your system with Good Disk:

If your First disk failed, and second disk is in Good condition; follow the below procedure.

1. Check you have active boot enabled on Disk2; (format; fdisk (select option 2 to make disk active)
2. Install grub if you have not installed alreday on Disk2
    $/usr/sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c3t3d0s0
4. Edit /boot/solaris/bootenv.rc file and point  bootpath to Good disk.sd@3,0,a

setprop bootpath '/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@3,0:a'
 ls -l /dev/dsk/c3t3d0s0
lrwxrwxrwx   1 root     root          62 Dec 20  2007 /dev/dsk/c3t3d0s0 -> ../../devices/pci@7b,0/pci1022,7458@11/pci1000,3060@2/sd@3,0:a

3. Reboot and press F2 - Go to BIOS and Change First boot disk as Good Disk, Disk2

4. Now you are good to boot with Second disk.



Once you are able to boot to OS with Good Disk.

Create similar partitions on New Disk.


$prtvtoc /dev/rdsk/c3t3d0s0|fmthard -s - /dev/rdsk/c3t2d0s0

Create metadb
$metadb -afc3 c3t2d0s7

Add metainit to new disk slices.

$metainit -f d1 1 1 c3t2d0s0
$metainit -f d11 1 1 c3t2d0s1
$metainit -f d31 1 1 c3t2d0s3
$metainit -f d41 1 1 c3t2d0s4
$metainit -f d61 1 1 c3t2d0s6

Now Attach New sub mirrors to Mirror.

$metattach d0 d1
$metattach d10 d11
$metattach d30 d31
$metattach d40 d41
$metattach d60 d61

Check the status with metastat -c

+$ metastat -c
d60              m  120GB d61 d62 (resync-0%)
    d61          s  120GB c3t3d0s6
    d62          s  120GB c3t2d0s6
d40              m  2.0GB d41 d42 (resync-64%)
    d41          s  2.0GB c3t3d0s4
    d42          s  2.0GB c3t2d0s4
d30              m  4.0GB d31 d32 (resync-33%)
    d31          s  4.0GB c3t3d0s3
    d32          s  4.0GB c3t2d0s3
d10              m  2.0GB d11 d12 (resync-75%)
    d11          s  2.0GB c3t3d0s1
    d12          s  2.0GB c3t2d0s1
d0               m  8.0GB d1 d2 (resync-20%)
    d1           s  8.0GB c3t3d0s0
    d2           s  8.0GB c3t2d0s0
[00:39:55] charihar:/home/charihar



$Do a final restart after completing sync.




Live command examples.



bash-3.00# metadetach -f  d10 d11
d10: submirror d11 is detached
bash-3.00# metaclear d11
d11: Concat/Stripe is cleared
bash-3.00#

 bash-3.00# metainit d10 -m d11
d10: Mirror is setup
bash-3.00# metainit -f d31 1 1 c3t3d0s3
d31: Concat/Stripe is setup
bash-3.00# metainit d30 -m d31
d30: Mirror is setup
bash-3.00# metainit d41     -f d41 1 1 c3t3d0s4
d41: Concat/Stripe is setup
bash-3.00# metainit d40 -m d41
d40: Mirror is setup
bash-3.00# metainit f   -f d61 1 1 c3t3d0s6
d61: Concat/Stripe is setup
bash-3.00# metainit d60 d -m d61
d60: Mirror is setup
bash-3.00#

bash-3.00# metattach d0 d2     d10 d12
d10: submirror d12 is attached
bash-3.00# metattach d10 d1230 d1232
d30: submirror d32 is attached
bash-3.00# metattach d30 d3240 d3242
d40: submirror d42 is attached
bash-3.00# metattach d40 d4260 d4262
d60: submirror d62 is attached
bash-3.00#

Thursday, July 5, 2012

Solaris Zone configuration

Configure zone, verify zone configuration, Export zone configuration, install zone.

Configure new zone.

-bash-3.2#chmod 700 /rpool/test
-bash-3.2# zonecfg -z oracle-cluster01
oracle-cluster01: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:oracle-cluster01> create
zonecfg:oracle-cluster01> set zonepath=/rpool/test
zonecfg:oracle-cluster01> set autoboot=true
zonecfg:oracle-cluster01> add net
zonecfg:oracle-cluster01:net> set address=10.203.121.37
zonecfg:oracle-cluster01:net> set physical=e1000g0
zonecfg:oracle-cluster01:net> end
zonecfg:oracle-cluster01> info
zonename: oracle-cluster01
zonepath: /rpool/test
brand: native
autoboot: true
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
hostid:
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
net:
address: 10.203.121.37
physical: e1000g0
defrouter not specified
zonecfg:oracle-cluster01> verify
zonecfg:oracle-cluster01> commit
zonecfg:oracle-cluster01> exit
-bash-3.2# zoneadm list -vc
ID NAME STATUS PATH BRAND IP
0 global running / native shared
- indigo installed /upromise/zone native shared
- oracle-cluster01 configured /rpool/test native shared
-bash-3.2#
-bash-3.2# zoneadm -z oracle-cluster01 verify

-bash-3.2# zoneadm -z oracle-cluster01 install
cannot create ZFS dataset rpool/test: dataset already exists
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <2893> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1116> packages on the zone.
Initialized <1116> packages on zone.
Zone is initialized.
The file contains a log of the zone installation.
-bash-3.2#
-bash-3.2# zoneadm -z oracle-cluster01 boot

-bash-3.2# zlogin -C oracle-cluster01 (~. to come out of console)

Select 0. for English and 13 for CDE desktop enviornment.

globalzone# zlogin -S oracle-cluster01 (For login to zone)


Deamons for Zone

zoneadmd and
zsched

The zones administration daemon, zoneadmd, is the primary process for managing the zone's virtual platform. The daemon is also responsible for managing zone booting and shutting down. There is one zoneadmd process running for each active (ready, running, or shutting down) zone on the system.

The zoneadmd daemon sets up the zone as specified in the zone configuration. This process includes the following actions:

  • Allocating the zone ID and starting the zsched system process

  • Setting zone-wide resource controls

  • Preparing the zone's devices as specified in the zone configuration

  • Setting up network interfaces

  • Mounting loopback and conventional file systems

  • Instantiating and initializing the zone console device

Unless the zoneadmd daemon is already running, it is automatically started by zoneadm. Thus, if the daemon is not running for any reason, any invocation of zoneadm to administer the zone will restart zoneadmd.


How to rename a zone

global#zonecfg -z test

zonecfg:indigoap> set zonename=testapp

zonecfg:indigoap>verify

zonecfg:indigoap>commit

Move a zone

global# zoneadm -z testapp move /rpool/testmove

A ZFS file system has been created for this zone.
Moving across file-systems; copying zonepath /test/zone...
Cleaning up zonepath /test/zone...
-bash-3.2#








Thursday, June 28, 2012

How to send mail with attachment in linux

$ uuencode file1.tar file1.tar |mailx -s "Mail Subject" email@example.com

Saturday, April 21, 2012