Monday, January 24, 2011

Moving local zone root path

Moving the local zone is very easy task in solaris.Here I`m moving the local zone(moon) path from /zones/moon to /export/zones/moon.

Global# mkdir /export/zones

Global# zoneadm -z moon halt


Global# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
4 earth running /zones/earth native shared
- moon installed /zones/moon native shared

Global# zoneadm -z moon move /export/zones/moon

Global# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
4 earth running /zones/earth native shared
- moon installed /export/zones/moon native shared

Global zone name from Local zone

Most of the time we struggle to identify global zone name while we are working in local zone.This tips will be useful to identify global zone name from its local zone.

1.First you login to Global zone and create a file called "global_zone_name" under /usr/bin directory.Hardcore your Global zone name in this file and save it.Change the file permission to 700.

Global Zone
===========
Global# vi /usr/bin/global_zone_name
"/usr/bin/global_zone_name" 1 line, 7 characters

echo "sunray"
wq!


Global# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
1 moon running /zones/moon native shared


Login to local zone
# zlogin moon
[Connected to zone 'moon' pts/6]


In local zone type global_zone_name command it will display your global zone name.
Local Zone:
===========
Sun Microsystems Inc. SunOS 5.10 Generic January 2005

# uname -a
SunOS moon 5.10 Generic_141445-09 i86pc i386 i86pc

# global_zone_name
sunray

**Anyone know better solution than this please share it**

Wednesday, November 17, 2010

Oracle Solaris 11 Express released

Oracle announces immediate availability of Oracle Solaris 11 Express, a fully supported, production-ready environment that builds on existing Oracle Solaris 10 features with more than 2,700 new projects and 400 significant innovations.
for more details
http://www.oracle.com/us/products/servers-storage/solaris/solaris-11-express-185123.html

Wednesday, May 26, 2010

Useful Solaris Commands

1. Display system information
#uname –a

2. Diplay processor information
#psrinfo –v

3.Display hostname
#hostname
#cat /etc/hosts

4.Dispaly domain name
#domainname
#cat /etc/defaultdomain

5. Display installed memory configuration

#prtconf | grep memory

6.To get installed Network card status
#dladm show-dev

7. Display Routing table information
#netstat –nr

8. Display virtual memory information
#swap –l
#swap –s

9. Display Disks error information
#iostat –E

10. Diplay memory status
#vmstat –p

11. Display interrupts status
#vmstat –ip

12. Dispaly Disk usage information
#df –hk

13. Dispaly system events since last reboot
#vmstat –s

14. Display swapping statistics
#vmstat –S

15. Display cache flushing statistics
#vmstat –c

16. To check buffer activities
#sar -b

17. To check system call activities
#sar –c

18.To check unused memory statistics
#sar –r

19.To check CPU utilization
#sar -u

20.Dispaly OBP version
#prtconf -v

21.Display installed packages
#showrev
#pkginfo

22.To get HBA card details
#fcinfo hba-port
#luxadm -e

23.To get running process status
#prstat
#ps -ef

24.To get hardware details
#prtdiag

Tuesday, May 25, 2010

Configuring RAID5 with hot spare using SVM

I`ve planned to create RAID 5 volume with 7 HDD and one HDD for Hot spare.

1.I`m creating RAID5 volume using metainit command.In this -r represent RAID5 volume
bash-2.03# metainit d50 -r c4t0d0s0 c4t1d0s0 c4t2d0s0 c4t8d0s0 c4t9d0s0 c4t10d0s0 c4t11d0s0
d50: RAID is setup

2.type metastat command to verify the RAID 5 status
bash-2.03# metastat d50
d50: RAID
State: Initializing
Initialization in progress: 0% done
Interlace: 32 blocks
Size: 210141064 blocks
Original device:
Size: 210143616 blocks
Device Start Block Dbase State Hot Spare
c4t0d0s0 330 No Initializing
c4t1d0s0 330 No Initializing
c4t2d0s0 330 No Initializing
c4t8d0s0 330 No Initializing
c4t9d0s0 330 No Initializing
c4t10d0s0 330 No Initializing
c4t11d0s0 330 No Initializing

3.After I created the RAID 5 volume I`m creating one Hot spare spool(hsp001) and assign one HDD to this pool(c4t12d0s0)
bash-2.03# metainit hsp001 c4t12d0s0
hsp001: Hotspare pool is setup

4.finally I`m assigning this hot spare spool to RAID5 volume d50
bash-2.03#metaparam -h hsp001 d50

5.verify whether the hot spare disk is assigned to RAID5 volume using metastat command
bash-2.03# metastat d50
d50: RAID
State: Initializing
Initialization in progress: 84% done
Hot spare pool: hsp001
Interlace: 32 blocks
Size: 210141064 blocks
Original device:
Size: 210143616 blocks
Device Start Block Dbase State Hot Spare
c4t0d0s0 330 No Initializing
c4t1d0s0 330 No Initializing
c4t2d0s0 330 No Initializing
c4t8d0s0 330 No Initializing
c4t9d0s0 330 No Initializing
c4t10d0s0 330 No Initializing
c4t11d0s0 330 No Initializing

Friday, July 10, 2009

Jumpstart server Configuration on Solaris10

I configured Jumpstart server for Solaris 10 client last week.

Create one directory and share that directory using NFS
#mkdir -m 775 /vol/install
#vi /etc/dfs/dfstab

share -F nfs -o ro,anon=0 /vol/install
#shareall


insert your SUN Solaris10 DVD to your DVD drive and goto following directory
#cd /cdrom/cdrom0/s0/Solaris_10/Tools

Run setup_install_server command to copy installation files to install base directory(/vol/install) It takes some time...
# ./setup_install_server /vol/install/
Verifying target directory...
Calculating the required disk space for the Solaris_10 product
Calculating space required for the installation boot image
Copying the CD image to disk...
Copying Install Boot Image hierarchy...
Install Server setup complete


Jumpstart server required 3 configuration files.
1.rules [this is a first config file accessed by client to read profile file file]
2.sysidcfg [This file is having values which are required for client initial boot ]
3.Profile file [This file has filesystems,patch details]


Make config directory under install folder and you can copy sample configuration files from DVD which are reside under Misc folder.I`ve copied only check and any_machine files.Remaining files I`ve created manually.


#mkdir /vol/install/config
#cd /cdrom/cdrom0/s0/Solaris_10/Misc/jumpstart_sample/
# cp check /vol/install/config
# cp any_machine /vol/install/config

# ./setup_install_server -b /vol/install/boot

Verifying target directory...
Calculating space required for the installation boot image
Copying Solaris_10 Tools hierarchy...
Copying Install Boot Image hierarchy...
Install Server setup complete


#vi rules
hostname sunserver1 - e250_prof -
any - - any_machine -
in this above
sunserver1 --> client name
e250_prof -->profile file name.
My sunserver1 is a Sun E250 model server,so I created this name:)


#vi e250_prof
# profile keywords profile values
# -------- ------ --------- --------
install_type initial_install
cluster SUNWCXall
partitioning explicit
filesys c0t0d0s0 12000 /
filesys c0t0d0s3 3072 swap
system_type server


#vi sysidcfg
system_locale=en_US
timezone=Asia/Calcutta
timeserver=localhost
terminal=vt100
name_service=NONE
security_policy=NONE
root_password=kFEEDxSc4v2E6
network_interface=hme0 {hostname=sunserver1
netmask=255.0.0.0
ip_address=10.1.1.4
protocol_ipv6=no
default_route=10.1.1.1}

update your client MAC address and name into /etc/ethers file
#vi /etc/ethers
8:0:xx:xx:xx:xx sunserver1

update your client IP address and name into /etc/hosts file
#/etc/hosts
1.1.1.4 sunserver1

Jumpstart server uses TFTP protocol, so check whether the TFTP entry has commented out or not in inetd.conf file.
#vi /etc/inet/inetd.conf
tftp dgram udp6 wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot

#eject cdrom

# /vol/install/Solaris_10/Tools/add_install_client -e 8:0:xx:xx:xx:xx -s 1.2.3.4:/vol0/install -c 1.2.3.4:/vol0/install/config -p 1.2.3.4:/vol0/install/config sunserver1 sun4

updating /etc/bootparams
[1.2.3.4 is IP address of jumpstart server]


##########
#### Client Side ########
##########
ok>boot net - install

Thursday, May 7, 2009

Common Desktop Environment Help

To disable the login server from starting automatically
# /usr/dt/bin/dtconfig -d
done
desktop auto-start disabled.

to kill login server,X server and entire soalris CDE Desktop
# /usr/dt/bin/dtconfig -kill
done
dtlogin kill complete.

Check if login manager is running
# ps -ef grep dtlogin
root 17621 16732 0 23:47:03 pts/8 0:00 grep dtlogin

To start the login server from command line
#/usr/dt/bin/dtlogin -daemon;exit

To enable the login server from starting automatically
# /usr/dt/bin/dtconfig -e
(This will add a S99dtlogin file to /etc/rc2.d directory

Thursday, January 1, 2009

Un-Mirrored root Volume

Check the root mirror status
#metastat d0
this command will update /etc/vfstab and /etc/system file for root disk
#metaroot /dev/dsk/c0t0d0s0
#reboot
....
#metaclear -r d0
#metaclear d20

Creating Mirror for mounted usr volume

#metainit -f d12 1 1 c0t0d0s3
#metainit d22 1 1 c0t1d0s3
#metainit d2 -m d12
#reboot
after reboot you have to run following command
#metattach d2 d22
After created mirror disk for usr volume you need to edit the /etc/vfstab file entry
#vi /etc/vfstab
/dev/md/dsk/d2 /dev/md/rdsk/d2 /usr ufs 1 yes -
:wq!

Creating Mirror for mounted root volume

#metainit -f d1 1 1 c0t0d0s0
#metainit d2 1 1 c0t1d0s0
#metainit d0 -m d1
#metaroot d0 (this will update /etc/vfstab & /etc/system file)
#metaroot d0
#
lockfs -fa
#reboot
after reboot you have to run following command
#metattach d0 d2
After created mirror disk for root volume you need to configure alternate boot path for this server.in case the first disk crashed the system will boot from second disk automatically.to find the physical path
#ls -l /dev/rdsk/c0t1d0s0
devices/sbus@1,f8000000/esp@1,200000/sd@3,0:a
goto OK prompt
create alias for second disk
ok: nvalias backup-root /sbus@1,f8000000/esp@1,200000/sd@3,0:a
ok:printenv boot-root
ok:
setenv boot-device disk backup-root net
ok>nvstore
for manual boot
ok:boot backup_root

Wednesday, December 17, 2008

Managing Tape Devices in Solaris

assume (tape drive connected in /dev/rmt/1)
mt command used to control the tape drive.

1. Dispaly the status of tape device

#mt -f /dev/rmt/1 status
Quantum Super DLT 320 tape drive:

sense key(0x6)= Unit Attention residual= 0 retries= 0 file no= 0 block no= 0

2. Rewinding the Tape
#mt -f /dev/rmt/1 rewind

3. Erase tape content

#mt -f /dev/rmt/1 erase

4. Forward tape to next appended backup

#mt -f /dev/rmt/1 fsf1

5. Backward tape to previous appended job

#mt -f /dev/rmt/1 bsf0

6. Eject the tape from tape drive

#mt -f /dev/rmt/1 offline

Tuesday, December 16, 2008

Configuring MIRROR volume using SVM




last month I configured mirror volume using Solaris volume manger.Find the steps how I did this mirror volume.


1. Copying VTOC of Disk1(c1t9d0s0) to Disk2(c1t10d0s0).Because the disk layout should be same between two hard disk while we mirrored.So I used fmthard command to copy VTOC to other Hard disk.


# prtvtoc /dev/dsk/c1t9d0s0 fmthard -s - /dev/rdsk/c1t10d0s0
fmthard: New volume table of contents now in place.
2. Creating Meta database on both Hard disk at slice 7
# metadb -a -f c1t9d0s7 c1t10d0s7
3. creating first sub mirror d1
# metainit -f d1 1 1 c1t9d0s0
d1: Concat/Stripe is setup
4. Creating Second sub mirror d11
# metainit -f d11 1 1 c1t10d0s0
d11: Concat/Stripe is setup
5. Creating Mirror volume d0 with first sub mirror d1

# metainit d0 -m d11

6. Attaching second sub mirror d11 with do

#metattach d0 d11

7. to Display Mirror volume d0 status
# metastat d0
d0: Mirror
Submirror 0: d1
State: Okay
Submirror 1: d11
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 4194720 blocks (2.0 GB)

d1: Submirror of d0
State: Okay
Size: 4194720 blocks (2.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t9d0s0 0 No Okay Yes

d11: Submirror of d0
State: Okay
Size: 4194720 blocks (2.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t10d0s0 0 No Okay Yes

Device Relocation Information:
Device Reloc Device ID
c1t9d0 Yes id1,sd@SSEAGATE_ST15230W_SUN4.2G00701447
c1t10d0 Yes id1,sd@SSEAGATE_ST15230W_SUN4.2G00631837


8. After I created the mirror volume I created file system using newfs commandd
# newfs /dev/md/rdsk/d0
newfs: construct a new file system /dev/md/rdsk/d0: (y/n)? y
/dev/md/rdsk/d0: 4194720 sectors in 1942 cylinders of 16 tracks, 135 sect
ors
2048.2MB in 44 cyl groups (45 c/g, 47.46MB/g, 7936 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 97376, 194720, 292064, 389408, 486752, 584096, 681440, 778784, 876128,
3305120, 3402464, 3499808, 3597152, 3694496, 3791840, 3889184, 3986528,
4083872, 4181216
9. Mount the mirror volume to mount point /mirror
# mkdir /mirror

# mount /dev/md/dsk/d0 /mirror
# cd /mirror
# df -k .
Filesystem kbytes used avail capacity Mounted on
/dev/md/dsk/d0 2052991 2065 1989337 1% /mirror

# metastat -c d0
d0 m 2.0GB d1 d11
d1 s 2.0GB c1t9d0s0
d11 s 2.0GB c1t10d0s0
Configuring Hot Spare disk for Mirror volume.
HOT SPARE setup
# metainit hsp001 c1t11d0s0
hsp001: Hotspare pool is setup
# metaparam -h hsp001 d1
# metaparam -h hsp001 d11
# metastat d0
d0: Mirror
Submirror 0: d1
State: Okay
Submirror 1: d11
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 4194720 blocks (2.0 GB)

d1: Submirror of d0
State: Okay
Hot spare pool: hsp001
Size: 4194720 blocks (2.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t9d0s0 0 No Okay Yes

d11: Submirror of d0
State: Okay
Hot spare pool: hsp001
Size: 4194720 blocks (2.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t10d0s0 0 No Okay Yes

Device Relocation Information:
Device Reloc Device ID
c1t9d0 Yes id1,sd@SSEAGATE_ST15230W_SUN4.2G00701447
c1t10d0 Yes id1,sd@SSEAGATE_ST15230W_SUN4.2G00631837

Open Solaris Root Login

Recently I`ve installed open solaris in my desktop PC.But I could not login as root user through Login screen.

I`ve removed type=role entry in /etc/user_attr file
After removed the the entry the line will be like this
root::::auths=solaris.*,solaris.grant;profiles=All;lock_after_retries=no;min_label=admin_low;clearance=admin_high

and then reboot the system. You can login as root again.


Wednesday, July 9, 2008

How to Restore entire content of root file systems to new HDD

1. Boot your system
2. At OK prompt type boot cdrom –s
3. Create a file system on new HDD
newfs /dev/rdsk/c0t0d0s0
4. Mount partition to /a directory mount /dev/dsk/c0t0d0s0 /a
5. Go to /a directory
cd /a
6. Restore tape content
ufsrestore rvf /dev/rmt/0
7. Remove the restoresym table file.rm restoresymtable
8. Unmount the /a umount /a
9.
cd /usr/platform/`uname-m`/lib/fs/ufs
10. Configure boot device
installboot bootblk /dev/rdsk/c0t0d0s0
11. Reboot your system init 6

Package Management

PKGADD
1. To install new package (pkgadd -d Source location)

# pkgadd -d /cdrom/sol_7_x86/s2/Solaris2.7/Product/ SUNWbnur

2. To install package from current Dir
#pkgadd –d . SUNWbnwr

3. Copy package to spool dir without installation
#pkgadd –d Source location –s spool pkg name
Spool dir => /var/spool/pkg

4. If Packages are already in spool dir no need to give –d option
#pkgadd SUNWbnwr

PKGCHK
5. Shows details about particular pkg
#Pkgchk –V SUNWbnwr

6.Shows details about particular pkg
#Pkgchk –P SUNWbnwr
It shows pkg permission ,modified details etc

PKGINFO
It shows info about all installed packages.
7.Shows details about particular pkg
#pkginfo –l SUNWbnwr

PKGRM
8. To remove a package
#pkgrm

9. Remove pkg from spool directory
#pkgrm –s spool

you can download sun packages on http://www.sunfreeware.com/

Wednesday, June 25, 2008

Solaris Boot Process -1

Boot Process
0.Power On the server
1. Boot PROM

  • PROM load POST
  • OK prompt
  • Boot loader load from boot devices
  • Boot reads Boot Block (first 15 sectors)
  • a copy of the bootblk is available at /usr/platform/`arch - k`/lib/fs/ufs/bootblk
  • Boot load Boot block

2. Boot Program

  • Boot Block loads secondary Boot loader(UFS boot)
  • (/platform/`arch -k`/ufsboot) UFS boot will load kernel
    Kernel is two parts
    Gen UNIX =>Platform independent (/kernel/genunix )
    Unix => Platform dependant (/platform/`arch -k`/kernel/*)

3. Kernel Initialization

  • Kernel reads config files(/etc/system)
  • Kernel initializes itself & load modules
  • Force load option in /etc/system –used to mount module permanently
  • The kernel creates PID 0 ( sched)

4. Init phase

  • The kernel start PID1 -init (/sbin/init)
  • Init process reads /etc/inittab file and /etc/init/default
  • Init starts rc scripts (/sbin/rc#) [# indicate runlevel]
  • rc script executes the files in /etc/rc#.d

How to get server hardware information ?

Type the following command to get your server hardware information
#/usr/platform/`uname -i`/sbin/prtdiag

Solaris User account Management

User Administration
Below 3 files are important for creating new user account
/etc/passwd -contains user information.
/etc/shadow - information about password
/etc/group -information about group

# cat /etc/passwd
root:x:0:1:Super-User:/:/sbin/sh
daemon:x:1:1::/:
bin:x:2:2::/usr/bin:
sys:x:3:3::/:
Username: Passwd: UID: GID: common name: home dir: Shell
-----------------------------------
/etc/shadow - info about password

# cat /etc/shadow
root:Sb3AZsvho.Flg:13600::::::
daemon:NP:6445::::::
sri:*LK*:::::::
rengs:yE3ME0wy9rSUI:13600::::::
Name:Passwd:Days from unix:min passwd age:Max passwd age:warn:inactive:expire:future purpose
-----------------------------------
/etc/group -info about group
bash-2.05# cat /etc/group
root::0:root
other::1:
sys::3:root,bin,sys,adm
name:grouppasswd:GID:secondary member list
-------------------------------------
UID informations
OS support max 2^31 users
0-99 reserved for system user
100-60000

1.Create new user account using useradd command
# useradd -u 606 -c rengarajang -md /export/rengs -s /bin/bash rengs
-u UID -c comment -md Home Dir -s Shell username

-u uid – Sets the unique UID for the new user.
-g group – Specifies a predefined group's ID or name.
-G group – Defines the new user's secondary group memberships.
-d dir – Defines the full pathname for the user’s home directory.
-m – Creates the new home directory if it does not already exist.
-s shell – Defines the full pathname for the shell program to be used as the user's login shell. If not defined, it defaults to /bin/sh.
–c comment – Typically used to specify the user’s full name and location.
-o – Allows a UID to be duplicated.
-e expire – Sets an expiration date on the user account. Specifies the date (mm/dd/yy) on which a user can no longer log in and access the account. The account is locked.
-f inactive – Sets the number of inactive days allowed on a user account. If the account is not logged into during the specified number of days it is locked.
-k skel_dir – Specifies an alternative directory location containing customized initialization files to be copied into the user’s home directory. (The default is /etc/skel.)

2.Creating alternate super account
# useradd -u 0 –o -c rengarajang -md / -s /bin/bash rengs

3.Modifying user properties using usermod
# usermod -u 606 -c Modifieduser rengs

4.Deleting user account
#userdel –r rengs

5.Managing groups we use following commands
Groupadd
Groupdel

6.Other files for user management
Below file should you modify to change the number of groups to which a user can belong
/etc/system
Default passwd policy in /etc/default/passwd
User profile files are stored in /etc/skel

Friday, June 20, 2008

How to create NIS user account?

How to create NIS user account?

1.Create the local user account on NIS server for ex,

# useradd -u 606 -c rengarajang -md /export/home/rengs -s /bin/bash rengs

set password for this account

#passwd rengs

New Password:*********
Re-enter new Password:*********
passwd: password successfully changed for rengs
Goto /var/yp directory and run make command this will update the nis passwd file

# cd /var/yp
#
/usr/ccs/bin/make
updated netid
pushed netid
Now you can login from NIS client

Wednesday, June 18, 2008

Free Open Solaris CD 2008

OpenSolaris 2008.05 for x86 is available to use free of charge and SUN can send you a CD at no extra cost.
Open Solaris