Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
System Administrator Interview Questions and Answers
04-18-2009, 08:25 AM (This post was last modified: 04-18-2009 08:52 AM by root.)
Post: #1
System Administrator Interview Questions and Answers
At one of my many interviews, these were the questions I was asked and the answers I gave for them.

NOTE: These questions are for Solaris, some like netstat and top work on Linux but others may not.

System Administrator Commands

Questions

1. What are the different ways to check the load average on a system?

vmstat, top, uptime, w, procinfo

================================

================================



Bonus - Describe the 3 values that top/uptime shows

1-minute, 5-minute and 15-minute load averages

================================

================================



2. What are the different running states of a SOLARIS system?

1,2, and 3

================================

================================



3. How do you check CPU and MEMORY resources on a server?

Memory: dmesg |grep mem, prtdiag |grep Memory, prtconf -v |grep Mem

CPU: /usr/sbin/psrinfo -v

================================

================================



4. How do you obtain system activity for a particular time frame (Say noon to 10PM)?

a) Use the command 'sar'

b) sar consists of three commands that are involved in automatic system activity data collection: sadc, sa1, and sa2.

c) To make sure sadc is run at boot time, the /etc/init.d/perf file must contain a command line that writes a record to the daily data file.

d) The command entry has the following format: /usr/bin/su sys -c "/usr/lib/sa/sadc /var/adm/sa/sa`date +%d`"

e) This entry is already in the /etc/init.d/perf file, but it needs to be uncommented.
Code:
f) Put a line into the /var/spool/cron/crontabs/sys file, which calls the shell script, sa1. This script invokes sadc and writes to the daily data files, /var/adm/sa/sa<dd>. The sa1 script gets installed with the other sar packages and has the following syntax: /usr/lib/sa/sa1 [t n]
g) The syntax for the sar command is as follows: sar [-aAbcdgkmpqruvwy] [-o ] [t n ]

h) So in answer to the original question the command to obtain system activity from 12:00 PM to 10:00 PM is as follows: sar -s 12 -e 22 -i 3600 -A

Example:
Code:
[ root@enterprise ]$ sar -s 12 -e 22 -i 3600 -A

SunOS enterprise 5.9 Generic_118558-14 sun4u    03/22/2009

12:00:00    %usr    %sys    %wio   %idle
13:00:00       1       0       0      99
14:00:00       1       0       0      99
15:00:00       1       0       0      99
16:00:01       1       0       0      99
17:00:00       1       0       0      99

Average        1       0       0      99

12:00:00   device        %busy   avque   r+w/s  blks/s  avwait  avserv

13:00:00   fd0               0     0.0       0       0     0.0     0.0
           nfs1              0     0.0       0       0     0.0     0.0
           sd7               0     0.0       0       3     0.0    60.3
           sd7,a             0     0.0       0       3     0.0    60.3
           sd7,b             0     0.0       0       0     0.0     0.0
           sd7,c             0     0.0       0       0     0.0     0.0
           sd8               0     0.0       0       0     0.0     0.0
           sd8,a             0     0.0       0       0     0.0     0.0
           sd8,b             0     0.0       0       0     0.0     0.0
           sd8,c             0     0.0       0       0     0.0     0.0
           sd13              0     0.0       0       0     0.0     0.0

14:00:00   fd0               0     0.0       0       0     0.0     0.0
           nfs1              0     0.0       0       0     0.0     0.0
           sd7               0     0.0       0       3     0.0    64.0
           sd7,a             0     0.0       0       3     0.0    64.0
           sd7,b             0     0.0       0       0     0.0     0.0
           sd7,c             0     0.0       0       0     0.0     0.0
           sd8               0     0.0       0       0     0.0     0.0
           sd8,a             0     0.0       0       0     0.0     0.0
           sd8,b             0     0.0       0       0     0.0     0.0
           sd8,c             0     0.0       0       0     0.0     0.0
           sd13              0     0.0       0       0     0.0     0.0

15:00:00   fd0               0     0.0       0       0     0.0     0.0
           nfs1              0     0.0       0       0     0.0     0.0
           sd7               0     0.0       0       3     0.0    62.7
           sd7,a             0     0.0       0       3     0.0    62.7
           sd7,b             0     0.0       0       0     0.0     0.0
           sd7,c             0     0.0       0       0     0.0     0.0
           sd8               0     0.0       0       0     0.0     0.0
           sd8,a             0     0.0       0       0     0.0     0.0
           sd8,b             0     0.0       0       0     0.0     0.0
           sd8,c             0     0.0       0       0     0.0     0.0
           sd13              0     0.0       0       0     0.0     0.0

16:00:01   fd0               0     0.0       0       0     0.0     0.0
           nfs1              0     0.0       0       0     0.0     0.0
           sd7               0     0.0       0       3     0.0    64.3
           sd7,a             0     0.0       0       3     0.0    64.3
           sd7,b             0     0.0       0       0     0.0     0.0
           sd7,c             0     0.0       0       0     0.0     0.0
           sd8               0     0.0       0       0     0.0     0.0
           sd8,a             0     0.0       0       0     0.0     0.0
           sd8,b             0     0.0       0       0     0.0     0.0
           sd8,c             0     0.0       0       0     0.0     0.0
           sd13              0     0.0       0       0     0.0     0.0

17:00:00   fd0               0     0.0       0       0     0.0     0.0
           nfs1              0     0.0       0       0     0.0     0.0
           sd7               0     0.0       0       3     0.0    67.0
           sd7,a             0     0.0       0       3     0.0    67.0
           sd7,b             0     0.0       0       0     0.0     0.0
           sd7,c             0     0.0       0       0     0.0     0.0
           sd8               0     0.0       0       0     0.0     0.0
           sd8,a             0     0.0       0       0     0.0     0.0
           sd8,b             0     0.0       0       0     0.0     0.0
           sd8,c             0     0.0       0       0     0.0     0.0
           sd13              0     0.0       0       0     0.0     0.0


Average    fd0               0     0.0       0       0     0.0     0.0
           nfs1              0     0.0       0       0     0.0     0.0
           sd7               0     0.0       0       3     0.0    63.7
           sd7,a             0     0.0       0       3     0.0    63.7
           sd7,b             0     0.0       0       0     0.0     0.0
           sd7,c             0     0.0       0       0     0.0     0.0
           sd8               0     0.0       0       0     0.0     0.0
           sd8,a             0     0.0       0       0     0.0     0.0
           sd8,b             0     0.0       0       0     0.0     0.0
           sd8,c             0     0.0       0       0     0.0     0.0
           sd13              0     0.0       0       0     0.0     0.0

12:00:00 runq-sz %runocc swpq-sz %swpocc
13:00:00     0.0       0     0.0       0
14:00:00     0.0       0     0.0       0
15:00:00     0.0       0     0.0       0
16:00:01     1.0       0     0.0       0
17:00:00     0.0       0     0.0       0

Average      1.0       0     0.0       0

12:00:00 bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s
13:00:00       0       1     100       0       0      54       0       0
14:00:00       0       1     100       0       0      55       0       0
15:00:00       0       0     100       0       0      54       0       0
16:00:01       0       1     100       0       0      55       0       0
17:00:00       0       1     100       0       0      55       0       0

Average        0       1     100       0       0      55       0       0

12:00:00 swpin/s bswin/s swpot/s bswot/s pswch/s
13:00:00    0.00     0.0    0.00     0.0      43
14:00:00    0.00     0.0    0.00     0.0      43
15:00:00    0.00     0.0    0.00     0.0      43
16:00:01    0.00     0.0    0.00     0.0      43
17:00:00    0.00     0.0    0.00     0.0      43

Average     0.00     0.0    0.00     0.0      43

12:00:00 scall/s sread/s swrit/s  fork/s  exec/s rchar/s wchar/s
13:00:00      42       2       2    0.04    0.04     549     188
14:00:00      42       2       2    0.04    0.04     562     189
15:00:00      42       2       2    0.04    0.04     549     188
16:00:01      42       2       2    0.04    0.04     549     188
17:00:00      42       2       2    0.04    0.04     565     189

Average       42       2       2    0.04    0.04     555     189

12:00:00  iget/s namei/s dirbk/s
13:00:00       0       3       0
14:00:00       0       3       0
15:00:00       0       3       0
16:00:01       0       3       0
17:00:00       0       3       0

Average        0       3       0

12:00:00 rawch/s canch/s outch/s rcvin/s xmtin/s mdmin/s
13:00:00       0       0       0       0       0       0
14:00:00       0       0       0       0       0       0
15:00:00       0       0       0       0       0       0
16:00:01       0       0       0       0       0       0
17:00:00       0       0       0       0       0       0

Average        0       0       0       0       0       0

12:00:00  proc-sz    ov  inod-sz    ov  file-sz    ov   lock-sz
13:00:00   52/23834    0 5163/102628    0    0/0       0    0/0
14:00:00   52/23834    0 5163/102628    0    0/0       0    0/0
15:00:00   53/23834    0 5163/102628    0    0/0       0    0/0
16:00:01   52/23834    0 5163/102628    0    0/0       0    0/0
17:00:00   52/23834    0 5163/102628    0    0/0       0    0/0


12:00:00   msg/s  sema/s
13:00:00    0.00    0.00
14:00:00    0.00    0.00
15:00:00    0.00    0.00
16:00:01    0.00    0.00
17:00:00    0.00    0.00

Average     0.00    0.00

12:00:00  atch/s  pgin/s ppgin/s  pflt/s  vflt/s slock/s
13:00:00    1.64    0.00    0.00    2.26    6.49    0.00
14:00:00    1.64    0.00    0.00    2.27    6.52    0.00
15:00:00    1.64    0.00    0.00    2.25    6.47    0.00
16:00:01    1.64    0.00    0.00    2.26    6.52    0.00
17:00:00    1.64    0.00    0.00    2.27    6.52    0.00

Average     1.64    0.00    0.00    2.26    6.50    0.00

12:00:00  pgout/s ppgout/s pgfree/s pgscan/s %ufs_ipf
13:00:00     0.00     0.00     0.00     0.00     0.00
14:00:00     0.00     0.00     0.00     0.00     0.00
15:00:00     0.00     0.00     0.00     0.00     0.00
16:00:01     0.00     0.00     0.00     0.00     0.00
17:00:00     0.00     0.00     0.00     0.00     0.00

Average      0.00     0.00     0.00     0.00     0.00

12:00:00 freemem freeswap
13:00:00  175683  3515623
14:00:00  175679  3515644
15:00:00  175669  3515603
16:00:01  175658  3515523
17:00:00  175612  3514639

Average   175660  3515406

12:00:00 sml_mem   alloc  fail  lg_mem   alloc  fail  ovsz_alloc  fail
13:00:00       0       0     0       0       0     0    10764288     0
14:00:00       0       0     0       0       0     0    10764288     0
15:00:00       0       0     0       0       0     0    10764288     0
16:00:01       0       0     0       0       0     0    10764288     0
17:00:00       0       0     0       0       0     0    10764288     0

Average        0       0     0       0       0     0    10764288     0


================================

================================



5. What does an init 5 do?

Shutdown the system, it will sync the file system first.

================================

================================



6. How do you reset the root password on a server? No one has the password or has forgotten it. SUDO is not configured on the server as well.

a. Insert Solaris CD in cd drive and from ok prompt run command: boot cdrom -s

b. This will take you single user mode

c. # fsck /dev/rdsk/c0t0d0s0.

d. Answer y to clear all.

e. mount /dev/dsk/c0t0d0s0 /a

f. cd /a/etc

g. TERM=sun

h. export TERM

i. vi /a/etc/shadow

Remove password between the first two colons i.e..,
root:WYlPW5T2EyiU6:13750:::::: from password field of root and save file with
wq!

j. cd /

k. umount /a

l. init 6

You will be prompted for the root password.

================================

================================



7. How do you check disk usage. How do you trouble shoot a high disk usage issue (Available disk space is at 2% and could crash the application)

First see which partition is full

df -hk

To find out which files/folders are taking up the most space

/du -dk / | sort -n

To delete files older than x number of days in the current working directory and
below, the safe way is

With -mtime

find . ! -mtime - | /usr/bin/xargs rm -rf

With -exec and -newer

create file with appropriate time stamp, this one would be for midnight last
night

touch -t 200903200000 /tmp/timeref

to test first

find . ! -newer /tmp/timeref -exec ls -l {} \; | more

to delete

find . ! -newer /tmp/timeref -exec rm {} \;

================================

================================



8. How do you check the ports in use on a server?

netstat -an

Example:

Administrator@helios ~
$ netstat -an |grep :80 |wc -l
6

This shows I have 6 connections on port 80 to my Apache Webserver.

================================

================================



9. What is NDD?

Make the changes to the running system's network interfaces.

# ndd -set /dev/hme adv_100hdx_cap 0

# ndd -set /dev/hme adv_100fdx_cap 1

# ndd -set /dev/hme adv_autoneg_cap 0

# ndd -get /dev/hme link_mode

Interpretation:

0 -- half-duplex

1 -- full-duplex

# ndd -get /dev/hme link_speed

Interpretation:

0 -- 10 Mbit

1 -- 100 Mbit

1000 -- 1 Gbit

================================

================================



10. What is garbage collection in Java?

When an object is no longer referenced by the program, the heap space it occupies must be recycled so that the space is available for subsequent new objects. The garbage collector must somehow determine which objects are no longer referenced by the program and make available the heap space occupied by such unreferenced objects. In the process of freeing unreferenced objects, the garbage collector must run any finalizers of objects being freed.

================================

================================
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: