Was this information useful ?

Search This Blog

Wednesday, December 2, 2009

[UNIX Interview Questions]

Managing Mounts and Unmounts

1) How to check ZFS mounted file system?

-bash-3.00# zfs mount

mypool /mypool

mypool/data /mypool/data

mypool/code /mypool/code


2) What is the syntax of /etc/vfstab?
Syntax :

device device mount FS fsck mount mount
to mount to fsck point type pass at boot options

Note :
device to fsck: This is a raw disk path because in case of error in the file system fsck has to run on raw device to correct the issue.

fsck Pass:
Value
“-” : file system are not checked
“0″ : UFS file systems are not checked
“<>″: File system is checked
“1
″ : Files system are checked one at a time in the order they appear in the /etc/vfstab
“”<1″ and -o p” : files system are checked parallel
“1
″ : Files system are checked one at a time in the order they appear in the /etc/vfstab
“”<1
″ and -o p” : files system are checked parallel

3) Hot to check the details about currently mounted file system?

#cat /etc/mnttab
and
#mount

Both command will give the info about the list of mounted file system and their properties.

Key Notes

Example mount command:

mount -o rw /dev/dsk/c0t0d0s7 /data

Options:
largfiles : This option allows creation of file larger then 2GB
noatime : No access time which will improve the performance

4) What are the files important for managing file system?

/etc/vfstab : Which contais the list of file system to be mounted
/etc/dfs/dfstab : File systems need to be shared automatically shared via NFS either at the boot time or wen the /etc/init.d/nfs.server start command executed by the system admin.
/etc/default/fs : Specify the default local filesystem
/etc/dfs/fstypes :For mount command to determine the remote file system.

5) How to determine fstype?

root@eapad01]# fstyp /dev/rdsk/c1t0d0s0
ufs

6) How to unmount a busy file system?

root@esgtest04-nfs /export/home/root > fuser -c /scripts
/scripts: 5171c

OR
Which gives the info about PID and UID accessing the file system.
root@esgtest04-nfs /export/home/root > fuser -u /scripts
/scripts: 5171c(root)

Now we can kill the process or contact the user and ask them to logout or forcefully unmount the FS.

Kill the process accessing the FS and check if some process is still locking the fle system

root@esgtest04-nfs /export/home/root > fuser -ck /scripts && fuser -u /scripts
/scripts: 5226c
/scripts:

Now we can use umount command to unmount the file system

Else we can use “umount -f” command to forcibly unmount the file system

7) Some /etc/vfstab entries are not proper and server is not booting after the system reboot. Please explain how to fix this issue?

a) boot the system from CDROM or from net

OK boot cdrom -s

OR

OK boot net -s

b) run fsck on “/” file system

fsck /dev/rdsk/c0t0d0s0

c) mount the file system on ram disk

mount -o rw /dev/dsk/c0t0d0s0 /a

d) Export TERM and Editor variable

#TERM=sun ( or ) #TERM=vt100
#export TERM

e) Correcting the /etc/vfstab entry

#vi /a/etc/vfstab

and edit accordingly

f) Resetting the root password

#vi /a/etc/shadow

remove the password entry for the root user.

Example:
root@esgtest04-nfs /export/home/root > head -1 /etc/shadow
root:QB95Qh3ozLDYU:6445::::::

Change the above lie as below
root::6445::::::

g) umount /a

h) reboo the system
#init 6

Package Management in Solaris

8) Name the file which is containing the info about the installed packages

root@esgtest04-nfs /export/home/root > tail /var/sadm/install/contents
/var/uucp/.Log/uuxqt d none 0755 uucp uucp SUNWbnur
/var/uucp/.Old d none 0755 uucp uucp SUNWbnur
/var/uucp/.Sequence d none 0755 uucp uucp SUNWbnur
/var/uucp/.Status d none 0755 uucp uucp SUNWbnur
/var/webconsole d none 0755 root sys SUNWmconr
/var/webconsole/domains d none 0755 root sys SUNWmconr
/var/webconsole/tmp d none 1777 root sys SUNWmconr
/var/webconsole/webapps d none 0755 root sys SUNWmconr
# Last modified by pkgrm for SUNWtdft package
# Fri Jul 03 23:54:24 2009

Checking about the package showrev
root@esgtest04-nfs /export/home/root > grep showrev /var/sadm/install/contents
/usr/bin/showrev f none 0755 root sys 28160 8608 1238178678 SUNWadmc
/usr/share/man/man1m/showrev.1m f none 0644 root root 3835 64380 1218408096 SUNWman
root@esgtest04-nfs /export/home/root >

Thus package showrev is installed in /usr/bin/showrev.

AND
/var/sadm/pkg directory maintains a record of all installed packages

Example:

root@esgtest04-nfs /var/sadm/pkg > ls -l SUNWman
total 9
drwxr-xr-x 2 root root 4 Jul 3 01:55 install
-rw-r–r– 1 root root 672 Jul 3 01:54 pkginfo
drwxr-xr-x 3 root root 3 Jul 3 01:54 save

On what packages it depend on :

root@esgtest04-nfs /var/sadm/pkg/SUNWman/install > cat depend
# @(#)depend 1.9 02/03/01 SMI
# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.

P SUNWcar Core Architecture, (Root)
P SUNWkvm Core Architecture, (Kvm)
P SUNWcsr Core Solaris, (Root)
P SUNWcsu Core Solaris, (Usr)
P SUNWcsd Core Solaris Devices
P SUNWesu Extended System Utilities
P SUNWdoc Documentation Tools
root@esgtest04-nfs /var/sadm/pkg/SUNWman/install >

9) How to reset RSC password in Solaris?

#/usr/platform/SUNW,Sun-Fire-890/rsc/rscadm userpassword admin

10) How to find out what is the device the system is booted from in mirrored environment?

prtconf -vp | grep bootpath

11) How to configure static routing table in Solaris?

Set static routing using /etc/gateways configuration for in.routed

The file /etc/gateways is act as configuration file for /usr/sbin/in.routed IPv4 network routing daemon. All you have to do is put static route per line using following format:

net Nname[/mask] gateway Gname metric value

Open config file:
# vi /etc/gateways
Append following entries:
net 192.168.1.0 gateway 192.168.1.254 metric 1 passive
net 10.0.0.0 gateway 10.20.110.1 metric 1 active

You must one of these keywords must be present to indicate whether the gateway should be treated as passive or active, or whether the gateway is external to the scope of the RIP protocol. A passive gateway is not expected to exchange routing information, while gateways marked active should be willing to exchange RIP packets. The keywoard passive should be used if you want the entry to be permanent.The keyword active should be used if you want in.routed to occasionally query the gateway host, and delte the route if it becomes inactive. See in.routed man page for further details.

Sunday, June 14, 2009

Opensolaris 2009.6 is Out. Download and enjoy the new feature

OpenSolaris 2009.06 is now available for deployment from the desktop to datacenter, check out the latest features:

» Network Virtualization with Crossbow
» Turn any host into a SCSI target with COMSTAR
» Host virtual guests using xVM Hypervisor or LDoms
» SPARC® support for Distro Constructor, Auto Install, and Snap
» Intel Xeon 5500 processor support with deep power management
» MySQL and PHP DTrace Probes in the WebStack
» Improved usability of the package management system
» ZFS Time Slider Snapshot Management
» Contribute new applications with SourceJuicer
» Get 24/7 support with OpenSolaris Subscriptions


Where to get?

http://dlc.sun.com/osol/opensolaris/2009/06/osol-0906-x86.iso


Check out the installations steps shortly over here.

Any help please contact me
gurucp2005@gmail.com