You are on page 1of 3

Solaris 10 System Administration

Advanced Administration
By Johnell Averilla

Displaying and Changing System Information


# isainfo v Determining Whether a System Has 32Bit or 64Bit Solaris Capabilities Enabled $ cat /etc/release How to Display Solaris Release Information $ showrev a Displaying General System Information $ hostid Displaying a System's Host ID Number # prtconf vb Displaying a System's Product Name # prtconf | grep Memory Displaying a System's Installed Memory $ date Displaying the Date andTime $ psrinfo v Displaying a System's Processor Type # localeadm l Display the locales currently installed on your system # date 0121173404 (mmddHHMM[[cc]yy]) Thu Jan 21 17:34:34 MST 2004 Set a System'sDate andTime Manually # vi /etc/motd Edit message of the day # sys-unconfig Reconfigure the system Change a System's Host Name Change the system's host name in the following files: /etc/nodename /etc/hostname.*interface /etc/inet/hosts /etc/inet/ipnodes Applies only to some releases of Solaris 10. Rename the host name directory within the /var/crash directory. # cd /var/crash # mv old-host-name new-host-name Reboot the systemto activate the new host name. # init 6

$ du ah ; $ du -ak Displaying the Size of Directories, Subdirectories, and Files # quot a Lists all users of each mounted UFS file system and the number of 1024-byte blocks used. $ ls -t [directory] List files, displaying the most recently created or changed files first Finding and Removing Old or Inactive Files # find /var/adm -type f -atime +60 -print > /var/tmp/deadfiles & Delete files in /var/adm that are not accessed within 60 days # rm cat /var/tmp/deadfiles # rm -r * Delete the files and subdirectories in the current directory # find . -name core -exec rm {} \; Find and remove any core files in this directory and its subdirectories. How to Delete Crash Dump Files Crash dump files can be very large. If you have enabled your system to store these files, do not retain them for longer than necessary. # cd /var/crash/system # rm *

Scheduling and Managing System Tasks


$ crontab -e [username] Create or Edit a crontab File $ crontab -l [username] Display crontab file $ ls -l /var/spool/cron/crontabs VerifyThat a crontab File Exists $ crontab -r [username] Remove crontab file /etc/cron.d/cron.deny users who are listed in this file can not create, edit, display, or remove crontab files. /etc/cron.d/cron.allow users who are listed in this file can create, edit, display, or remove crontab files. EXAMPLE CRON FILE # use /bin/sh to run commands, overriding the default set by cron SHELL=/bin/sh # mail any output to `johnell', no matter whose crontab this is MAILTO=johnell # # run five minutes after midnight, every day 50*** $HOME/bin/daily.job >> $HOME/tmp/out 2>&1 # run at 2:15pm on the first of every month -- output mailed to johnell 15 14 1 * * $HOME/bin/monthly # run at 9 pm on weekdays, annoy John 0 21 * * 1-5 mail -s "It's 10pm" john%John,%%Where are you?% 23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday" 5 4 * * sun echo "run at 5 minutes after 4 every sunday" Command at Example $ at 11:45pm July 31 at> rm /home/smith/*core* at> Press Control-d commands will be executed using /bin/csh job 933486300.a at Tue Jul 31 23:45:00 2004 /etc/cron.d/at.deny users who are listed in this file cannot access at commands $ atq Displays at queue $ at -r jobnamehere.a Remove an at queue

Managing Quotas
Howto Configure File Systems for Quotas Edit the /etc/vfstab file and add rq to the mount options field for each UFS file system that will have quotas. Change directory to the root of the file systemthat will have quotas. Create a file named quotas. # touch quotas Change permissions to read/write for superuser access only. # chmod 600 quotas Sample /etc/vfstab: Quota enabled in /export/home # device device mount FS fsck mount mount # to mount to fsck point type pass at boot options # pluto:/export/home - /export/home nfs - yes rq # edquota username Set Up Quotas for a User # quota -v username Verify the user's quota # quotacheck va Check Quota Consistency # quotaon [-v] -a filesystem ... Turn on file system quotas, -a turn on all quotas in vfstab # quota [-v] username Check for Exceeded Quotas # repquota [-v] -a filesystem Check Quotas on a File System, -a reports on all filesystems # quotaoff [-v] -a filesystem ... Turn off quota

Managing System Processes


$ ps ef List all running processes. Alternatives below # prstat # top # pgrep processname Obtains the process ID for the process # pwdx processidnumber Displays the current working directory for the process # ptree processidnumber Displays the process tree that contains the process # pfiles processidnumber Displays fstat and fcntl information

Managing Disk Use


$ df h ; $ df k ; $ df ak ; $ df ah Displaying Information About File Size and Disk Space $ ls lh Displaying the Size of Files $ ls -l | sort +4rn | more Finding Large Files (Sorting by the Fifth Field's Character) $ ls -s | sort -nr | more Finding Large Files (Sorting by the Left Most Character) $ find . -size +400 print find files larger than 400 blocks in the current working directory

# pstop processidnumber Stops the process # prun processidnumber Restarts the process $ pkill [signal] processaname $ kill [signal-number] processidnumber Terminate the process Displaying Basic Information About Process Classes # priocntl l CONFIGURED CLASSES ================== SYS (System Class) TS (Time Sharing) Configured TS User Priority Range: -60 through 60 FX (Fixed priority) Configured FX User Priority Range: 0 through 60 IA (Interactive) Configured IA User Priority Range: -60 through 60 $ ps ecl | grep processname Display the global priority of a process. Higher PRI has higher priority # priocntl -e -c TS -m 60 -p 60 find . -name core print Shows how to start the find command with the highest possible user-supplied priority # priocntl -e -c RT -m 500 -p 20 myprog Shows how to execute a command with a 500-millisecond time slice, a priority of 20 in the RT class, and a global priority of 120

Monitoring System Performance


$ vmstat 5 DisplayingVirtual Memory Statistics at 5-second intervals $ vmstat s Display SystemEvent Information $ vmstat S Display Swapping Statistics $ vmstat i Display Interrupts Per Device $ iostat 5 HowtoDisplayDisk Utilization Information every 5 seconds $ iostat xtc display extended disk statistics $ df k Display Disk Space Information $ sar a Display file access operation statistics $ sar b Display buffer activity statistics $ sar c Display system call statistics $ sar d Display disk activity statistics $ sar g Display page-out and memory freeing activities in averages $ sar k Check Kernel Memory Allocation $ sar m Check Interprocess Communication

$ sar p Check Page-In Activity $ sar q Check Queue Activity $ sar r Check Unused Memory $ sar u Check CPU Utilization $ sar v Check System Table Status $ sar w Check Swapping Activity $ sar y Check Terminal Activity # sar A Check Overall System Performance Set Up Automatic Data Collection Run the svcadm enable system/sar:default command. Command writes a special record that marks the time when the counters are reset to zero (boot time). # crontab -e sys Uncomment the following lines: 0 * * * 0-6 /usr/lib/sa/sa1 20,40 8-17 * * 1-5 /usr/lib/sa/sa1 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A $ sar -u 10 2 Takes two data samples separated by 10 seconds /var/adm/sa/sadd Files stored here $ sar Command extracts data from a previously recorded file

Managing System Crash Information # dumpadm Display the current crash dump configuration # dumpadm -c content -d dump-device -m nnnk | nnnm | nnn% -n -s savecore-dir Modify Crash DumpConfiguration Example: # dumpadm Dump content: kernel pages Dump device: /dev/dsk/c0t3d0s1 (swap) Savecore directory: /var/crash/pluto Savecore enabled: yes # dumpadm -c all -d /dev/dsk/c0t1d0s1 -m 10% Dump content: all pages Dump device: /dev/dsk/c0t1d0s1 (dedicated) Savecore directory: /var/crash/pluto (minfree = 77071KB) Savecore enabled: yes # /usr/bin/mdb -k unix.0 Examining a Crash Dump # dumpadm -n | -y Disable or enable the saving of crash dumps on your system Troubleshooting Miscellaneous Software Problems What to Do if Rebooting Fails - The system can't find /platform/uname -m/kernel/unix. You may need to change the boot-device setting in the PROMon a SPARC based system What to Do if You Forgot Root Password (Use keyboard abort sequence--Press Stop A keys to stop the system) ok boot cdrom s (or) ok boot net -s # mount /dev/dsk/c0t3d0s0 /a # cd /a/etc # TERM=vt100 # export TERM # vi shadow (Remove roots encrypted password string) # cd / # umount /a # init 6 What to Do if a System Hangs A system can freeze or hang rather than crash completely if some software process is stuck. 1. Determine whether the system is running a window environment and follow these suggestions. Make sure the pointer is in the window where you are typing the commands. Press Control-q in case the user accidentally pressed Control-s, which freezes the screen. Control-s freezes only the window, not the entire screen. If a window is frozen, try using another window. If possible, log in remotely from another system on the network. Use the pgrep command to look for the hung process. If it looks like the window system is hung, identify the process and kill it. 2. Press Control-\ to force a quit in the running program and (probably) write out a core file. 3. Press Control-c to interrupt the program that might be running. 4. Log in remotely and attempt to identify and kill the process that is hanging the system.

Troubleshooting Software Problems


Managing System Messages $ dmesg ; $ more /var/adm/messages Viewing System Messages # logadm -w /var/apache/logs/access_log -s 100m Apache access_log file is rotated when it reaches 100MB in size /etc/logadm.conf File includes log rotation entries for processes /etc/syslog.conf Edit file, adding or changing message sources, priorities, and message locations according to the syntax described in syslog.conf(4). Managing Core Files - Core files are generated when a process or application terminates abnormally. Core files are managed with the coreadm command. $ coreadm HowtoDisplay the Current CoreDumpConfiguration $ coreadm -p $HOME/corefiles/%f.%p $$ Set a per-process core file name pattern # coreadm -g /var/corefiles/%f.%p Set a global core file name pattern # coreadm -e global -g /var/core/core.%f.%p Enable a global core file path. $ /usr/proc/bin/pstack ./core ExaminingCore Files With proc Tools

5. Log in remotely, become superuser or assume an equivalent role and reboot the system. 6. If the system still does not respond, force a crash dump and reboot. Stop-a , ok sync 7. If the system still does not respond, turn the power off, wait a minute or so, then turn the power back on. 8. If you cannot get the system to respond at all, contact your local service provider for help. File SystemFills Up Because a Large File or Directory Was Created Log in as superuser or assume an equivalent role and use the ls -tl command in the specific file system to identify which large file is newly created and remove it. Troubleshooting File Access Problems Solving ProblemsWith Search Paths (Command not found) $ echo $PATH Display the current search path to verify that the directory for the command is not in your path or that it isn't misspelled. $ which command Verify the new path.

You might also like