Saturday, February 12, 2011

solaris interview question Raid levels and File systems

Q) How to create raid 0 concatination

A) # metainit d0 2 1 c0t0d0s1 1 c0t1d0s1

Q)How to see the meta device information

A)# metastat

Q)How to format and mount a slice

A)newfs /dev/md/rdsk/d0
Mount /dev/md/dsk/d0 /nav

Q) how to create raid 0 stripping

A) #metainit d1 1 2 c0t0d0s1 c0t0d0s2
#metastat
#newfs /dev/md/rdsk/d1
#mount /dev/md/dsk/c1 /naveen

Q) How to differentiate concatenation and stripping

A)when used metastat command stripping will show an interlace value 32KB this shows it is striped

Q)how to clear metadevices

A)#metaclear d0
#metaclear d1

Q)How to create mirroring raid -1
#metainit d1 1 1 c0t0d0s1
Metainit d2 1 1 c0t0d0s2
Metainit d3 –m d1
Metattach d3 d2
Metastat

Q)how to create stripe with parity
#metainit d1 –raid5 c0t0d0s0 c0t0d0s0 c0t2d0s0
Metastat
Newfs /dev/md/rdsk/d1
Mount /dev/md/rdsk/d1 /naveen

Q)how to grow the size of the volume
#growfs –M /d1 c0t0d0s1-(new device)

Q)how to create raids using veritas volume manager concationation

A)#vxassit –g rootdg make vol01 20g
#newfs /dev/vx/rdsk/rootdg/vol01
#mount /dev/vx/dsk/rootdg/vol01 /naveen

Stripping
A)
vxassit –g rootdg make vol02 20g layout=stripe st_width=32
#newfs /dev/vx/rdsk/rootdg/vol02
#mount /dev/vx/dsk/rootdg/vol02 /naveen

mirroring

A)vxassit –g rootdg make vol03 20g layout=mirror
newfs /dev/vx/rdsk/rootdg/vol03
mount /dev/vx/dsk/rootdg/vol03 /naveen

stripping with parity.

A)vxassit –g rootdg make vol4 20g layout=raid5,nologs
newfs /dev/vx/rdsk/rootdg/vol4
mount /dev/vx/dsk/rootdg/vol4.

Q)How to print plexes,subdisk,volumes

Vxprint –pt – for plexes
Vxprint –st subdisk
Vxprint –vt volumes

Q)how to increase the size of the volume

Vxassit –r rootdg growby vol01 20g
/usr/lib/fs/fsck –F ufs –M /naveen /dev/vx/rdsk/rootdg/vol01 40980 (offset value by typing the vxprint –vt command)

Q)what is the top command used for

A)Its lists all the processes with the process id
Cpu utilization and idle cpu
Memory utilization and idle memory
Swap utilization and ideal swap
Application using maximum cpu utilization with pid

Q)what is lofs used for

A)Lofs list open files is used for to check a problem encounter with a file or process

Q)what is the use of truss command

A)Trace system call for every running file

30)Whats are the fields in vfstab

A)mount device-raw device for fsk-mountpoint-filesystem-fsckcheck-mount at boot
and it contain all the mounted filesystem
==============================================
How to create 2 database replicas
# metadb –a –f –c 2 c0t0d0s1

Q) How to see the state databases replica.
A) # metabd

Q) what are raid0,raid1 and raid5
A) Raid 0 is concatenation or stripping
Concatenation means writing data in disk one after another
Stripping means writing data of 32kbs interlease value in to disk

Raid 1 – mirroring that means writing data on two disk parallely or duplicatiung the data on two disk.

Raid 5 – stripping with parity the data of 2 disk is duplicated in the third disk with parity information
======================================
How to configure newly attached hardware like hardsik network card.
# devfsadm Or drvconfig

How to set environment variable in NVRAM
# nvalias /pci---/rarp – to set scsi for booting of client
# nvalias net dhcp – to boot from dhcp
# nvunalias net – remove the alias

How to see the physical disk connected to the system from Open Boot Command OBP
ok>probe-scsi

How do you set a deafaulr boot device from the boot prom
# setenv boot-device disk
Boot-device=disk
# reset - To make the changes.

How to see the default boot device from the boot prom or OBP
ok> prtenv boot-device

How to see which kernel version and artitecture used by the system.
# isainfo -v :- To see kernal version and 32 bit or 64 bit system and artictect

How to make processor 3 online when you have more then 4 processor and processor 3 is offline?
# psrinfo –v:- To see the status of all processors
# psrinfo –a 3 online :- To make processor 3 online

How to breakroot passwd

#ok boot cdrom –s

TERM=ansi

Export TERM

Mkdir /demo

Mount /dev/dsk/c0t0d0s0 /demo
Vi /naveen/etc/passwd

Root:KHGHGHGGFG:-remove this junk passwd

Wq!

Reboot it logins with out asking for passwd

# Passwd – enter new password.

NIS Interview questions

How to create a nis master

#Domainname sun.com
#Echo sun.com > /etc/defaultdomain
#Vi /etc/hosts
Sun1 192.168.0.1
Sun2 192.168.0.2 add all the host connected to the network
Wq!

#Cp /etc/nsswitch.nis /etc/nsswitch.conf
#Vi /etc/nsswitch.conf
File nis – add this entry
Wq!

#Cd /var/yp
#Ypinit –m – master server
Enter host 192.168.0.1
Stop at errors say no here
Yes-yes-yes


#Cd /var/yp
#/usr/lib/netsvc/yp/ypstop
#/usr/lib/netsvc/yp/ypstart

Here you can see all the deamon get restarted .

Q)which command display the default nis server
A)ypwhich

Q)which command will display all the master and slave servers
A)Ypcat –k ypservers

Q)how to see the nis users
A)Ypcat passwd

Q)what are the deamons for nis master
A)Ypserv ypbind ypxfrd rpc.ypassword rpc.ypupdates.

Q)what is map
A)Map is table which consist of a key and a file which consist of the information of the key

Q)how to create nis slave server(192.168.0.2)

#Vi /etc/host
Sun1 192.168.0.1 master server ip
Wq!

#Cp /etc/nsswitch.nis /etc/switch.conf
#Vi nsswitch.con
Files nis
Wq!

#Domainname sun.com
#Echo sun.com> /etc/defaultdomain or to maintain more security /var/yp/ypservers

#Cd /var/yp
#Ypinit –s sun1 (master server)
Yes give master server ip or hostname
Error say no
Yes-yes

#Cd /var/up if u r in that directory then its okay
#/usr/lib/netsvc/yp/ypstop
#/usr/lib/netsvc/yp/ypstart
Ypserv ypbind

#Ypwhich – will display master and slave servers
#Ypcat –k ypservers – list master and slave server



Q)what are the daemon for nis slave server
A)Ypserv ypbind

Q)how to see nis user from the slave
A)Ypcat passwd

38)how to configure nis client

#Vi /etc/hosts
Sun1 192.168.0.1 - master
Sun2 192.168.0.2 – slave
Wq!

#Cp /etc/nsswitch.nis /etc/nsswitch.conf
#Domainname sun.com
#Echo sun.com > /etc/defaultdomain or /var/yp/ypservers

#Cd /var/yp
#Ypinit –c
Add the slave if available or master
Yes
No at errors

#Cd /var/yp
#/usr/lib/netsvc/yp/ypstop
#/usr/lib/netsvc/yp/ypstart

Daemons for nis clients are ypbind

Q)To see nis server and master from the client
A)Ypcat –k ypservers

Q)how do you update slave servers from the master
A)Cd /var/yp
#/usr/ccs/bin/make passswd
Or yppush.

Q)how to create nis+ server and client
#Cp /etc/passwd /export/home/nisfiles
#Cp /etc/group /export/home/nisfiles
#Cp /etc/hosts /export/home/nisfiles

#Vi auto_master
Remove all entries and keep only user name home directories
Host1 192.168.0.1:/export/home
Host2 192.168.0.1:/export/home
Wq!

#cp /etc/nsswitch.nis /etc/nsswitch.conf
Files nisplus
Wq!

#domainname sun.com
#echo sun.com>/etc/defaultdomain

#nisserver –r –Y
Reboot
#cd /export/home
#nspopulate -v –F

Q)how to create nis+ client

#cp /etc/nsswitch.nis /etc/nsswitch.conf
Files nisplus
Wq!

#domainname sun.com
#echo sun.com>/etc/defaultdomain

#nisclient –I –h 192.168.0.1 –d sun.com

Listing table & objects in NIS+
• #nisls ;Gives the total objects in NIS+
• #nisls org_dir ;Lists the tables listed in the directory.
Listing a contents of tables
• #niscat passwd.org_dir
Listing table structure
• #niscat -o passwd.org_dir ;lists structure of password table.
Adding A user
• #nistbladm -a name=john uid=123 gid=111 home=/home/john shell=/bin/sh passwd.org_dir
Changing the user information in passwd table (Super user only
Fill in the corresponding values in <>
• #nistbladm –a name=<> passwd=<> uid=<> gid=<> home=<> shelll=<> passwd.org_d
example
• #nistbladm -a name=john uid=123 gid=234 home=/home/john shell=/bin/sh passwd.org_di
to change only shell
• #nistbladm -m shell=/usr/local/bin/bash [name=john],passwd.org_dir
Changing user passwd


As root
• # nispasswd ;user has to update his key through

chkey -p
As user
• $ nispasswd ;update encrypted key
• $chkey -p ;(user NIS+ passwd and login passwd are the same.)

Adding user credentials
• #nisaddcred -p 123 -P john local
• # nisaddcred -p unix.123@planet.com -P john.planet.com. des
123 is userid and john is the user name.
Adding / removing a user dir entry in auto_home table :
• #nistbladm -a key=john value=10.20.30.40:/home/john auto_home.org_dir
• #nistbladm -r key=john auto_home.org_dir ;If key is not unique then more fields needs to be defined .
Removing a user
• #nistbladm -r name=john passwd.org_dir
Modifying the tables for multiple entries.
• #nisaddent -d passwd > /tmp/passwd ;Dump the table to a file
• #vi /tmp/passwd ;Edit the dumped file
• # nisaddent -r -f /etc/passwd passwd ;Put back the dumped file.
nisaddent command is available only for some of the standard tables, for others either nispopulate or nistbladm has to be used .

Booting process in solaris 10

The first question while giving any interview in solaris is what is the booting process in solaris or what is the boot phase in solaris.

Even to understand solaris clearly and to trouble shoot most of the things we need to know the booting process so that we can encounter where exactly is the problem we are getting.

The Boot Phases

The different phases of the boot process on SPARC-based systems are described here:

(I) Boot PROM phase.

The PROM displays the system identification information and then runs power-on self test (POST), which is a diagnostics routine that scans the system to verify the installed hardware and memory. POST runs diagnostics on hardware devices and builds a device tree, which is a data structure describing the devices attached to the system. After the completion of POST, the PROM loads the primary boot program bootblk.

(II) Boot programs phase.

The bootblk program loaded by PROM finds the secondary boot program ufsboot located in the UFS file system on the default boot device and loads it into the memory.

(III) Kernel initialization phase.

The ufsboot program loads the kernel into the memory. The kernel initializes itself and uses the ufsboot program to locate and load OS modules to control the system. A module is a piece of software with a specific functionality, such as interfacing with a particular hardware device. After loading enough modules to mount the root (/) file system, the kernel umnaps the ufsboot program and continues gaining control of the system. At the end of the kernel initialization phase, the kernel starts the /sbin/init process.

(IV) The init phase.

The init phase starts when, after initializing itself, the kernel starts the /sbin/init process, which in turn starts /lib/svc/bin/svc.startd to start the system services to do the following:

Check and mount file systems.

Configure network and devices.

Start various processes and perform tasks related to system maintenance.

The svc.startd process also executes run control (rc) scripts for backward compatibility. The steps in the boot process are illustrated in