Unix Tips


To check current speed of a network card

kstat -m ce -n ce0 |grep -i link_speed
kstat -m eri -n eri0|grep -i ifspeed
kstat -m qfe -n qfe0|grep -i ifspeed

Running Solaris in 32 or 64 Bit mode
Finding the running mode
isainfo -v
64-bit sparcv9 applications
32-bit sparc applications

Checking the status of the tape drive
mt -f /dev/rmt/0 status

Solaris 10 RPC and NFS problem.
run svcs -xv and  see what are the services' not running. Either enable them or disable all unwanted process using svcadm and nfs will will come up automatically.

Backup file system using ufsdump
ufsdump 0cvf /dev/rmt/0 /dev/rdsk/c0t0d0s0
or
ufsdump 0cvf /dev/rmt/0 /usr

To restore a dump with ufsrestore
ufsrestore rvf /dev/rmt/0
ufsrestore in interactive mode allowing selection of individual files and directories.
ufsrestore -i /dev/rmt/0

Making a copy of a disk slice using ufsdump
ufsdump 0f - /dev/rdsk/c0t0d0s7 |(cd /mnt/backup ;ufsrestore xf -)

Backup using cpio
find . -depth -print | cpio -ovcB > /dev/rmt/0

Viewing cpio files on a tape
cpio -ivtB < /dev/rmt/0

Restoring a cpio backup
cpio -ivcB < /dev/rmt/0

Setting up ethernet card speed , duplex mode in Solaris
ndd -set /dev/hme instance 0
(this makes the next commands apply to hme0)

Getting the status of an Ethernet Card
ndd -get /dev/hme link_status 0 = link up, 1 = link down
ndd -get /dev/hme link_speed 0 = 10MBit, 1 = 100MBit
ndd -get /dev/hme link_mode 0 = half duplex, 1 = full duplex
ndd -get /dev/hme adv_autoneg_cap 0 = no autonegotiation, 1 = autoneg. enabled

Setting the Ethernet Card
ndd -set /dev/hme instance 0
ndd -set /dev/hme adv_autoneg_cap 1 to enable autonegotiation for hme0

Making the above changes Permanent
edit the /etc/system file and add these parameters .The sequence number matters.
set hme:hme_adv_autoneg_cap=0
set hme:hme_adv_100T4_cap=0
set hme:hme_adv_100fdx_cap=1
set hme:hme_adv_100hdx_cap=0
set hme:hme_adv_10fdx_cap=0
set hme:hme_adv_10hdx_cap=0

Configuring and adding a CDROM Drive for OS install/Boot
ok devalias cdrom - this will show you current path to internal CD.
Use this to determine what new alias should look like.
ok setenv auto-boot? false
ok reset-all
ok probe-scsi-all - find the path to the new cdrom - write it down
& write target # as well
ok show-disks - find the exact path you just wrote down
How to find  out a particular file belongs to which package
/usr/sbin/pkgchk -l -p /absolute/path/todir

How to NFS  mount a Remote File System on Solaris
mount -F nfs testing:/software /software

How to disable Autoboot from OS
eeprom "auto-boot?"=false

How do you find the WWN for a Sun/Qlogic HBA?
# prtpicl -v | grep wwn
or
# luxadm qlgc

How to mount an ISO Image on Solaris
lofiadm -a pathToIso
mount -F hsfs -o ro /dev/lofi/1 mountPoint


How to set 100FD Speed for BGE Inetrface
# ndd -set /dev/bge0 adv_1000hdx_cap 0
# ndd -set /dev/bge0 adv_1000fdx_cap 0
# ndd -set /dev/bge0 adv_autoneg_cap 0

Solaris Patch Return Codes
0 No error
1 Usage error
2 Attempt to apply a patch that's already been applied
3 Effective UID is not root
4 Attempt to save original files failed
5 pkgadd failed
6 Patch is obsoleted
7 Invalid package directory
8 Attempting to patch a package that is not installed
9 Cannot access /usr/sbin/pkgadd (client problem)
10 Package validation errors
11 Error adding patch to root template
12 Patch script terminated due to signal
13 Symbolic link included in patch
14 NOT USED
15 The prepatch script had a return code other than 0.
16 The postpatch script had a return code other than 0.
17 Mismatch of the -d option between a previous patch install and the current one.
18 Not enough space in the file systems that are targets of the patch.
19 $SOFTINFO/INST_RELEASE file not found
20 A direct instance patch was required but not found
21 The required patches have not been installed on the manager
22 A progressive instance patch was required but not found
23 A restricted patch is already applied to the package
24 An incompatible patch is applied
25 A required patch is not applied
26 The user specified backout data can't be found
27 The relative directory supplied can't be found
28 A pkginfo file is corrupt or missing
29 Bad patch ID format
30 Dryrun failure(s)
31 Path given for -C option is invalid
32 Must be running Solaris 2.6 or greater
33 Bad formatted patch file or patch file not found
34 The appropriate kernel jumbo patch needs to be installed

No comments:

Post a Comment