You are on page 1of 46

Sun

Solaris 9
System Administration Part 1
Prepared by Dzafir Jaffar
Solaris 9 System Administration Part 1

Table of Contents
Prerequisites ...................................................................................................................................................................... 4
File System s ....................................................................................................................................................................... 4
Root Subdirectories ........................................................................................................................................................... 4
File Types........................................................................................................................................................................... 6
Filenames, Inodes and Data Blocks .................................................................................................................................. 7
Hard Links .......................................................................................................................................................................... 7
Disk Architecture ................................................................................................................................................................ 8
Physical Structure .......................................................................................................................................................... 8
Disk Com ponents ........................................................................................................................................................... 8
Disk Slices ...................................................................................................................................................................... 9
Disk Slice Nam ing Convention ....................................................................................................................................... 9
How to List Devices............................................................................................................................................................ 9
The /etc/path_to_ inst File ............................................................................................................................................... 9
The prtconf Com m and ................................................................................................................................................. 10
The form at Comm and .................................................................................................................................................. 11
How to reconfigure devices.............................................................................................................................................. 11
Disk Partitioning ............................................................................................................................................................... 12
File System Types............................................................................................................................................................ 16
Disk-Based File Systems ............................................................................................................................................. 16
Distributed File Systems .............................................................................................................................................. 16
Pseudo File System s ................................................................................................................................................... 17
How to create a ufs File System ...................................................................................................................................... 17
How to Mount File Systems ............................................................................................................................................. 17
Mount Points and the m ount Com m and ....................................................................................................................... 17
Mounting a File System ................................................................................................................................................ 18
The Virtual File System Table (vfstab)............................................................................................................................. 18
Softw are Installation ........................................................................................................................................................ 19
System Requirements...................................................................................................................................................... 19
Before You Begin ............................................................................................................................................................. 20
Software Packages .......................................................................................................................................................... 20
Package Inform ation .................................................................................................................................................... 20
Package Installation ..................................................................................................................................................... 22
Package Check ............................................................................................................................................................ 23
The var/sadm/inst all/contents File ................................................................................................................................ 24
The B oot PR O M ................................................................................................................................................................ 24
What is the Boot PROM................................................................................................................................................... 24
What is NVRAM? ............................................................................................................................................................. 25
Boot PROM commands ................................................................................................................................................... 25
Boot PROM Version Identification ................................................................................................................................ 25
Boot The System .......................................................................................................................................................... 25
List/Change NVRAM Parameters ................................................................................................................................. 25
Display Devices Connected to the Bus ........................................................................................................................ 26
Identify Boot Device ..................................................................................................................................................... 26

Page 2 of 46
Solaris 9 System Administration Part 1

Create and Rem ove Custom Device Aliases ............................................................................................................... 27


View and Change NVRAM Param eters from the Shell ................................................................................................ 28
Interrupt a Hung System .............................................................................................................................................. 30
The Boot Process............................................................................................................................................................. 30
System Shutdown Procedures ....................................................................................................................................... 30
The following describe the different types of system shutdowns: ............................................................................ 30
User and Security Adm inistration .................................................................................................................................. 31
Components of a User Account ....................................................................................................................................... 31
User Creation and Management...................................................................................................................................... 32
User Creation ............................................................................................................................................................... 32
User M odification ......................................................................................................................................................... 32
User Deletion ............................................................................................................................................................... 33
Group Creation and Management ................................................................................................................................... 33
Group Account Creation ............................................................................................................................................... 33
Group Account M odification ......................................................................................................................................... 33
Group Account Deletion ............................................................................................................................................... 33
System Access Control .................................................................................................................................................... 34
Difference between /etc/passwd and /etc/shadow ....................................................................................................... 34
The pwconv Comm and ................................................................................................................................................ 35
Monitor Failed Login Attem pts ..................................................................................................................................... 35
Monitor System Access ................................................................................................................................................ 36
Printer M anagem ent and Adm inistration ....................................................................................................................... 36
Print Management Tools.................................................................................................................................................. 36
Printer Configuration Types ............................................................................................................................................. 37
The Solaris LP Print Service ............................................................................................................................................ 37
Print Service Directory Structure...................................................................................................................................... 37
The Printing Process........................................................................................................................................................ 38
Creating Printer Classes .................................................................................................................................................. 38
Set or Change Default Printer or Printer Class................................................................................................................ 39
Remove Printer Configuration.......................................................................................................................................... 39
Client Side Rem oval ..................................................................................................................................................... 39
Server Side Rem oval ................................................................................................................................................... 40
Stop and Start the LP Print Service ................................................................................................................................. 40
Enable and Disable Printers ............................................................................................................................................ 41
Move Print Requests........................................................................................................................................................ 41
View System Processes .................................................................................................................................................. 42
Scheduling Command Execution..................................................................................................................................... 42
System Backups and R estores ....................................................................................................................................... 43
Tape Media Types and Capacities .................................................................................................................................. 43
Tape Device Naming Conventions .................................................................................................................................. 43
Backup Types .................................................................................................................................................................. 44
The ufsdump Command .................................................................................................................................................. 44
The ufsrestore Command ................................................................................................................................................ 44
Perform a File System Restore........................................................................................................................................ 45
Determine Number of Tapes Required ............................................................................................................................ 46

Page 3 of 46
Solaris 9 System Administration Part 1

Prerequisites
It will be very beneficial to have access to a Sparc system running Solaris 9. If you do not have Solaris 9 installed on
your Sparc system, you can download it free of cost at:
http://survey1.sun.com/servlet/viewsflash?cmd=showform&pollid=sol9_download

File System s
Root Subdirectories
There are several root directories that are created upon the installation of the Solaris Operating System. Each of these
directories resides under the root (/) directory and serves a special purpose.

 / - This is the root of the entire file system’s name space

Think of a / directory as the equivalent of the root of the C drive in Windows. Everything else must be under
“C:\”; for example, “C:\Windows\”

 /bin – This directory is a symbolic link to the /usr/bin directory which stores binary files or system commands

Think of a binary or binary file as the equivalent of a program or exe file in Windows. We will talk more about
symbolic links later in this section

 /dev – Stores symbolic links to device files in the /devices directory

Note: Names in this directory will look like the following examples:

 /dev/rdsk – Raw disk device

 /dev/rmt - Raw magnetic tape device

 /dev/sound - Audio device or its control files

 /dev/term - Serial device

 /devices – This directory stores physical device names and device files

 /etc – Stores configuration files and databases specific to the system


Names in this directory will look like the following examples:

Page 4 of 46
Solaris 9 System Administration Part 1

 /etc/default - Stores default information for programs

 /etc/lp – Stores configuration information for the printer subsystem

 /export – This is the default directory for commonly shared file systems. These include user home directories
and client file systems

 /home – This is the default location or mount point for user home directories

 /kernel - Directory of kernels required as part of the boot process. These kernels are platform-independent

 /mnt – This is a temporary mount point for file systems

 /opt – Default directory for application packages

 /sbin – Executables used in the boot process as well as a manual system recovery

 /tmp – Directory for temporary files. These files are cleared every time the system is rebooted.

 /usr – USR is an acronym for UNIX System Resources. It holds many different components and files required by
the operating system. A few examples of the directories under the /usr directory are as follows:
 /usr/bin – system commands
 /usr/dt - Common Desktop Environment (CDE) software
 /usr/java - Directories containing Java programs and libraries
 /var – Directory for varying files. This usually includes log or temporary files

Page 5 of 46
Solaris 9 System Administration Part 1

File Types
There are four main file types in the Solaris Operating Environment.

 Regular files

 Directories

 Symbolic Links

 Device Files

The first three file types store data. Device files do not store data. They provide access to devices. It is very easy to
differentiate between them by using the ls command.

# cd /etc
# ls -l
total 458
drwxr-xr-x 2 adm adm 512 Jun 20 18:26 acct
lrwxrwxrwx 1 root root 14 Jun 20 17:50 aliases -> ./mail/aliases
drwxr-xr-x 2 root bin 512 Jun 20 18:30 apache
-rw-r--r-- 1 root bin 83 Jun 20 20:34 auto_home
-rw-r--r-- 1 root bin 113 Jun 20 17:50 auto_master
<Output Truncated>

# cd /devices/pci@1f,0/pci@1,1/ide@3
# ls –l
total 0
brw-r----- 1 root sys 136, 0 Jun 20 17:57 dad@0,0:a
crw-r----- 1 root sys 136, 0 Jun 20 17:57 dad@0,0:a,raw
brw-r----- 1 root sys 136, 1 Jun 20 17:57 dad@0,0:b
crw-r----- 1 root sys 136, 1 Jun 20 17:57 dad@0,0:b,raw
<Output Truncated>

The character in the first column indicates the file type.

 - – Regular files

Page 6 of 46
Solaris 9 System Administration Part 1

 d – Directories

 l – Symbolic links

 b – Block special device files

 c – Character special device files

Filenames, Inodes and Data Blocks


Before we proceed any further, it is important to understand how files are stored on the physical disk. All files in a
Solaris environment make use of a filename and an Inode. Many files also use data blocks.

 Filename – Object used to access and manipulate files

 Inode – Object used to record information about a file. This information includes size, permissions, ownership
and pointers

 Data block – Unit of disk space used to store data

Hard Links
The association between a file name and an inode is called a hard link. Think of a filename as a hard link to an inode.
Let’s create a file and then link it.

Step 1: Creating a file


# touch file1
# ls -l
total 0
-rw-r--r-- 1 root other 0 Jun 22 15:38 file1

Step 2: Linking file1 and file2


# ln file1 file2
# ls -l
total 0
-rw-r--r-- 2 root other 0 Jun 22 15:38 file1
-rw-r--r-- 2 root other 0 Jun 22 15:38 file2
# ls -li

Page 7 of 46
Solaris 9 System Administration Part 1

total 0
721025 -rw-r--r-- 2 root other 0 Jun 22 15:38 file1
721025 -rw-r--r-- 2 root other 0 Jun 22 15:38 file2

As you can see, the inodes for both files are identical. This means that both the filenames point to the
same physical location. In other words, inode 721025 has two hard links. One to file1 and the other for
file2.

Step 3: Deleting file1


# rm file1
# ls -li
total 0
721025 -rw-r--r-- 1 root other 0 Jun 22 15:38 file2

Even though we deleted one of the files the same information can be accessed via the filename “file2.”

Disk Architecture
Physical Structure
If you have ever opened a hard disk enclosure, you know that it is made up of magnetic platters stacked on a spindle.
The spindle spins at high speeds while the heads move between them reading and writing data. The heads are moved
by the head actuator arm.

For a pictorial description of what a disk looks like, visit: http://www.howstuffworks.com/hard-disk.htm/printable

Disk Components
Each disk platter is further divided into the following components:

 Sector – Also known as a disk block, a sector is the smallest addressable unit on a platter. Each sector contains
512 bytes

 Track – A concentric path of sectors on a disk is called a track

 Cylinder – A stack of tracks

Page 8 of 46
Solaris 9 System Administration Part 1

Disk Slices
Each disk can be divided into logical partitions known as slices. Slices are groupings of cylinders and are used to
organize data by function.

A disk can have a total of 8 slices from 0 to 7. Slice 2 is conventionally used


to represent the complete disk. It records information about the size and cylinders of the total disk.

Disk Slice Naming Convention


A disk slice name is an eight-character string that identifies the controller, target, disk and slice numbers. For example,
c0t0d0s1 points to Controller 0, Target 0, Disk 0, Slice 1.

 Controller Number – Identifies the host bus adapter, which controls communications between the system and
disk unit

 Target Number – Target numbers correspond to a unique address switch setting that is selected for each
disk, tape, or CD-ROM

 Disk Number – The disk number indicates the number of disks at the target location. The disk number is often
referred to as the logical unit number (LUN)

 Slice Number – A number between 0 and 7 that identifies a logical partition on the physical disk

How to List Devices


There are three methods of listing devices in a Solaris system.

The /etc/path_to_inst File


The system records for all devices are stored in the /etc/path_to_inst file. The information in this file is read at boot
time and is used by the kernel to identify every possible device. The italicized text in parenthesis has been added to
help you understand the contents of the file.

# more /etc/path_to_inst
#
# Caution! This file contains critical kernel state
#
"/pci@1f,0" 0 "pcipsy"

Page 9 of 46
Solaris 9 System Administration Part 1

"/pci@1f,0/pci@1,1" 0 "simba" (pci bus A controller)


"/pci@1f,0/pci@1,1/ebus@1" 0 "ebus" (extended bus)
"/pci@1f,0/pci@1,1/ebus@1/power@14,724000" 0 "power" (power management
bus)
"/pci@1f,0/pci@1,1/ebus@1/fdthree@14,3023f0" 0 "fd" (floppy disk)
"/pci@1f,0/pci@1,1/ebus@1/SUNW,CS4231@14,200000" 0 "audiocs"
"/pci@1f,0/pci@1,1/ebus@1/su@14,3062f8" 1 "su" (mouse)
"/pci@1f,0/pci@1,1/ebus@1/se@14,400000" 0 "se" (serial ports A and B)
"/pci@1f,0/pci@1,1/ebus@1/su@14,3083f8" 0 "su" (keyboard)
"/pci@1f,0/pci@1,1/ebus@1/ecpp@14,3043bc" 0 "ecpp" (extended
capability parallel port)
"/pci@1f,0/pci@1,1/ide@3" 0 "uata"
"/pci@1f,0/pci@1,1/ide@3/sd@2,0" 0 "sd"
"/pci@1f,0/pci@1,1/ide@3/dad@0,0" 0 "dad" (disk)
"/pci@1f,0/pci@1,1/network@1,1" 0 "hme" (Fast-Ethernet)
"/pci@1f,0/pci@1,1/SUNW,m64B@2" 0 "m64" (color memory frame buffer)
"/pci@1f,0/pci@1" 1 "simba" (pci bus A controller)
"/options" 0 "options"
"/scsi_vhci" 0 "scsi_vhci"
"/pseudo" 0 "pseudo"

The prtconf Command


The prtconf command is used to display the system’s configuration information. This includes the total amount of
memory installed and the configuration of system peripherals formatted as a device tree. This command lists all
instances of devices, and whether the device is attached or not attached to the system.

In order to get a list of connected devices, we are filtering the output of the prtconf command by using “grep –v not”.
The “grep –v not” command is used to omit all lines that contain the word “not.”

# prtconf | grep -v not


System Configuration: Sun Microsystems sun4u
Memory size: 512 Megabytes
System Peripherals (Software Nodes):

SUNW,Ultra-5_10
options, instance #0
pci, instance #0
pci, instance #0

Page 10 of 46
Solaris 9 System Administration Part 1

ebus, instance #0
power, instance #0
se, instance #0
su, instance #0
su, instance #1
fdthree, instance #0
SUNW,CS4231, instance #0
network, instance #0
SUNW,m64B, instance #0
ide, instance #0
dad, instance #0
sd, instance #0
pci, instance #1
pseudo, instance #0

The format Command


The format command can be used to display logical and physical device names for all available disks.

# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:


0. c0t0d0 <ST39120A cyl 17660 alt 2 hd 16 sec 63>
/pci@1f,0/pci@1,1/ide@3/dad@0,0
Specify disk (enter its number):

How to reconfigure devices


In order to reconfigure a system, a reconfiguration boot must be invoked. This boot process adds the device to the
device tree and to the /dev and /devices directories.

1. Create a /reconfigure file.

# touch /reconfigure

2. Shut down the system.

# init 5

Page 11 of 46
Solaris 9 System Administration Part 1

3. Power off all external devices.

4. Install the new device.

5. Power on all external devices.

6. Power on the main system.

7. Use the prtconf or the format command to verify that the peripheral device has been detected
and added.

Disk Partitioning
The format command is used to repartition disks.

1. Type format. You must be logged in as root.

2. Select the disk that you wish to work on. In our example, we will work on disk zero.
3. Type partition.

4. Type print.

5. Type slice number. In our example, we will be selecting slice zero.

6. Type a name for the new slice or press Return to keep the default. You can also type ? to get a list of
choices.

7. Press Return for the default tag.

8. Type ? to get a list of available choices for permissions. Usually wm is selected.

9. Press Return for default flags.

10. Press Return to keep the starting cylinder the same.

11. Enter a new partition size. In this example, we are not changing anything.

Page 12 of 46
Solaris 9 System Administration Part 1

12. Type print.

Now, let’s take a look at an example to get familiar with the menus. In this example, we will not really
change anything but will run through the menus.

# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:


0. c0t0d0 <ST39120A cyl 17660 alt 2 hd 16 sec 63>
/pci@1f,0/pci@1,1/ide@3/dad@0,0
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted, no defect list found]
Warning: Current Disk has mounted partitions.

FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
repair - repair a defective sector
show - translate a disk address
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> partition

Page 13 of 46
Solaris 9 System Administration Part 1

PARTITION MENU:
0 - change `0' partition
1 - change `1' partition
2 - change `2' partition
3 - change `3' partition
4 - change `4' partition
5 - change `5' partition
6 - change `6' partition
7 - change `7' partition
select - select a predefined table
modify - modify a predefined partition table
name - name the current table
print - display the current table
label - write partition map and label to the disk
!<cmd> - execute <cmd>, then return
quit
partition> print
Current partition table (original):
Total disk cylinders available: 17660 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks


0 root wm 1041 - 4458 1.64GB (3418/0/0) 3445344
1 swap wu 0 - 1040 512.37MB (1041/0/0) 1049328
2 backup wm 0 - 17659 8.49GB (17660/0/0) 17801280
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 home wm 4459 - 17657 6.34GB (13199/0/0) 13304592

partition> 0
Part Tag Flag Cylinders Size Blocks
0 root wm 1041 - 4458 1.64GB (3418/0/0) 3445344

Enter partition id tag[root]: ?


Expecting one of the following: (abbreviations ok):
unassigned boot root swap

Page 14 of 46
Solaris 9 System Administration Part 1

usr backup stand var


home alternates

Enter partition id tag[root]:


Enter partition permission flags[wm]: ?
Expecting one of the following: (abbreviations ok):
wm - read-write, mountable
wu - read-write, unmountable
rm - read-only, mountable
ru - read-only, unmountable

Enter partition permission flags[wm]:


Enter new starting cyl[1041]:
Enter partition size[3445344b, 3418c, 4458e, 1682.30mb, 1.64gb]:
partition> quit

FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
repair - repair a defective sector
show - translate a disk address
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> quit

Page 15 of 46
Solaris 9 System Administration Part 1

File System Types


Solaris supports three types of file systems.

 Disk-Based File Systems

 Distributed File Systems

 Pseudo File Systems

Disk-Based File Systems


This type of file system is found on storage devices and media. Note that the acronyms are not capitalized. This is how
they are commonly referred to in Solaris documentation.

 Unix File System (ufs) – Based on the Berkeley fast file system, this is the standard UNIX file system.

 High Sierra File System (hsfs) – A special file system developed for CD-ROM media.

 PC File System (pcfs) – A UNIX implementation of the FAT32 file system found in DOS/Windows.

 Universal Disk Format (udf) – A special optical storage file system for DVD and CD-ROM media.

Distributed File Systems


Distributed file systems allow network access to resources.

 Network File System (nfs) – Allows files sharing between different systems in a network.

Page 16 of 46
Solaris 9 System Administration Part 1

Pseudo File Systems


Pseudo file systems are memory resident or memory based. They allow access to the kernel.

 Temporary File System (tmpfs) – This file system is created at boot time and is not persistent. It is “flushed”
when the system is rebooted. The file system is used for file storage in memory without the I/O overhead
associated with disk-based file systems.

 Swap File Systems (swapfs) – Used by the kernel to manage the swap space on disks.

 File Descriptor File System (fdfs) – Provides names for opening files using file descriptors such as /dev/fd/0.

 Process File System (procfs) – Contains a list of active processes. The list is stored in the /proc directory.

How to create a ufs File System


Before we can store any data on a partition, it must have a file system. The ufs file system can be created using the
newfs command.

1. Type the newfs command for the partition you want to build the file system on; e.g., newfs /dev/rdsk/c1t3d0s0.

2. Type y to proceed.

That’s all there is to creating an ufs file system. However, the new partition must be mounted before it can be used.

How to Mount File Systems


Mount Points and the mount Command
A mount point is a directory that points to a location in the file system. This is how users and the operating system
interact with each other. To obtain a list of mounted file systems, you can type the mount command. This displays the
mount point, the device name, mount options and date and time when it was mounted.

# mount
/ on /dev/dsk/c0t0d0s0
read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Thu Jun 20
18:41:03 2002
/proc on /proc read/write/setuid/dev=38c0000 on Thu Jun 20 18:41:02 2002
/etc/mnttab on mnttab read/write/setuid/dev=3980000 on Thu Jun 20 18:41:02 2002
/dev/fd on fd read/write/setuid/dev=39c0000 on Thu Jun 20 18:41:04 2002
/var/run on swap read/write/setuid/xattr/dev=1 on Thu Jun 20 18:41:16 2002

Page 17 of 46
Solaris 9 System Administration Part 1

/tmp on swap read/write/setuid/xattr/dev=2 on Thu Jun 20 18:41:18 2002


/export/home on /dev/dsk/c0t0d0s7
read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Thu Jun 20
18:41:18 2002
/home/athar on /export/home/athar read/write/setuid/dev=2200007 on Mon Jun 24 11:38:35
2002

Mounting a File System


In order to mount a file system you can type:

# mount /dev/disk/c0t0d0s7 /home

This would mount the slice seven on disk zero as the home directory. Since we did not specify any file
system options, ufs is used by default. If another file system is required, it must be specified. This is
most commonly used with floppy disks. For example,

# mount –F pcfs /dev/floppy /floppy

The Virtual File System Table (vfstab)


The /etc/vfstab file lists all the file systems that need to be mounted automatically at boot time. The
file can be manually edited by the root user.
Let’s take a look at the contents of this file:

# cat /etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c0t0d0s1 - - swap - no -
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no -
/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs 2 yes
-
swap - /tmp tmpfs - yes -

Notice that these fields do not align properly because they are tab separated. This can lead to confusion. It appears
correctly formatted on the screen. Here is the output copied and pasted in the Solaris Text Editor.

Page 18 of 46
Solaris 9 System Administration Part 1

Softw are Installation


System Requirements
To install Solaris 2.9, your system must meet the following requirements.

 SPARC 32 or 64-bit platform

 600MB of disk space for desktops. Or, 1GB for servers

 64MB of RAM

Notice that the Intel platform is no longer supported. The software spans 3 CD-ROMs.

Page 19 of 46
Solaris 9 System Administration Part 1

Before You Begin


Before you begin installation, you should have the following information ready or thought out.

 Host Name

 IP Address/Subnet Mask or DHCP

 Name service to use (e.g., DNS)

 IP Address(es) for Name Service Server (e.g., DNS Servers)

 Geographic Region

 Root Password

 Language to install

Software Packages
Similar to a setup.exe file that we are familiar with on a Windows platform, software products for the Solaris platform
are called packages. These are basically a collection of files and directories.

Package Information
In the following example, we are using the pkginfo command and filtering for lines that contain the word “application.”
The pkginfo command displays the category, package instance and names of all installed packages.

# pkginfo | grep application | more


application NSCPcom Netscape Communicator system SUNWadmap System
administration
applications
application SUNWdialh Buttons/Dials Header Files system SUNWdtbas CDE
application basic runtime
environment
system SUNWdtbax CDE application basic runtime environment (64-bit)
application SUNWfbc Frame Buffer Configuration

Page 20 of 46
Solaris 9 System Administration Part 1

Utility
application SUNWj2pi Java Plug-in
application SUNWjhdem JavaHelp Demos
application SUNWjhdev JavaHelp Development Utilities
application SUNWjhdoc JavaHelp Documentation
<Output Truncated>
To get information about a particular application, you would need to specify a name.

For example:

# pkginfo -l SUNWman
PKGINST: SUNWman
NAME: On-Line Manual Pages
CATEGORY: system
ARCH: sparc
VERSION: 42.0,REV=58
BASEDIR: /usr
VENDOR: Sun Microsystems, Inc.
DESC: System Reference Manual Pages
PSTAMP: tinkertoym01184752
INSTDATE: Jun 20 2002 18:28
HOTLINE: Please contact your local service provider
STATUS: completely installed
FILES: 7268 installed pathnames
3 shared pathnames
85 directories
85786 blocks used (approx)

Page 21 of 46
Solaris 9 System Administration Part 1

Package Installation
You can use the pkgadd command to install an application from an installation source. The usual syntax is as follows:

# pkgadd –d /cdrom/cdrom0/s0/<path to package>

In the following example, we will initiate an installation but will not complete it:

# pkgadd -d /cdrom/cdrom0/s0/Solaris_9/Product/

The following packages are available:

<Output Truncated>

18 SUNWadmap System administration applications


(sparc) 11.9,REV=2002.04.14.23.49
19 SUNWadmc System administration core libraries
(sparc) 11.8,REV=2002.04.14.22.42
20 SUNWadmfw System & Network Administration Framework
(sparc) 11.8,REV=2002.04.14.22.42

Select package(s) you wish to process (or 'all' to process


all packages). (default: all) [?,??,q]: 18

Processing package instance <SUNWadmap> from </cdrom/sol_9_sparc/s0/Solaris_9/Product>

System administration applications


(sparc) 11.9,REV=2002.04.14.23.49
Copyright 2002 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.

This appears to be an attempt to install the same architecture and


version of a package which is already installed. This installation
will attempt to overwrite this package.

Using </> as the package base directory.


## Processing package information.
## Processing system information.

Page 22 of 46
Solaris 9 System Administration Part 1

139 package pathnames are already properly installed.


## Verifying package dependencies.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

The following files are being installed with setuid and/or setgid
permissions:
* /usr/bin/admintool <setuid root>

* - overwriting a file which is also setuid/setgid.

Do you want to install these as setuid/setgid files [y,n,?,q] n

Do you want to continue with the installation of <SUNWadmap> [y,n,?] n

Installation of <SUNWadmap> was terminated due to user request.


No changes were made to the system.
<Output Truncated>
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: q

Package Check
The pkgchk command checks the contents and attributes of an installed package. For example:

# pkgchk SUNWadmap

If no message is displayed, it means that the package installation was successful.

To list files in a package:

# pkgchk -v SUNWadmap
/usr
/usr/bin
.
.
<Output Omitted>

Page 23 of 46
Solaris 9 System Administration Part 1

.
.
/usr/snadm/lib/libnsnis.so.1
/usr/snadm/lib/libnsnisplus.so
/usr/snadm/lib/libnsnisplus.so.1
/usr/snadm/lib/libnsnone.so
/usr/snadm/lib/libnsnone.so.1
#

The var/sadm/install/contents File


This file holds information about all the software packages installed on the system.

$ more /var/sadm/install/contents
/bin=./usr/bin s none SUNWcsr
/dev d none 0755 root sys SUNWcsr SUNWcsd
/dev/allkmem=../devices/pseudo/mm@0:allkmem s none SUNWcsd
/dev/arp=../devices/pseudo/arp@0:arp s none SUNWcsd
/dev/conslog=../devices/pseudo/log@0:conslog s none SUNWcsd
/dev/console=../devices/pseudo/cn@0:console s none SUNWcsd
<Output Truncated>

The Boot PRO M


What is the Boot PROM
The boot Programmable Read-Only Memory (PROM) chip is typically 8 Kilobytes and located on the same board as
the CPU. It is used to test the hardware and boot the operating system. The firmware on the boot PROM is often
referred to as the monitor program.

Page 24 of 46
Solaris 9 System Administration Part 1

What is NVRAM?
The Non-Volatile Random Access Memory (NVRAM) is another key component in the Sun system. NVRAM stores the
Ethernet address, host ID, and time.

Boot PROM commands


The boot PROM has remarkable capabilities even when a system is “down.” It can be used to perform quite a few
administrative tasks to help repair and restore a system.

Boot PROM Version Identification


The banner command lists information about the system such as model, memory, host ID, Ethernet address, and the
boot PROM version number.
ok banner

Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 400MHz), Keyboard Present


OpenBoot 3.25, 512 MB memory installed, Serial #13596499.
Ethernet address 8:0:20:cf:77:53, Host ID: 80cf7753.

Boot The System


In order to boot the system, the boot command is used at the ok prompt.
To boot to the normal multiuser mode, type:

ok boot

To boot the system to a single-user mode:


ok boot -s

List/Change NVRAM Parameters


To get a list of all NVRAM parameters, type:

ok printenv

To display a specific parameter, type the printenv command followed by the parameter name. For example:

ok printenv boot-device
boot-device = disk:a disk net

Page 25 of 46
Solaris 9 System Administration Part 1

To change or set a NVRAM parameter, you can use the setenv command. In this example, we will check the current
value for auto-boot and then change it:

ok printenv auto-boot?
auto-boot? = true
ok
ok setenv auto-boot? False
ok reset
Resetting ...

The reset command commits changes to the NVRAM and resets the system.

Display Devices Connected to the Bus


Sun organizes devices attached to a system into a “device tree.” This device tree is built at boot time (during the POST
phase) with the information gathered by the OpenBoot firmware. The show-devs command is used to view the device
tree.

ok show-devs
<Output Omitted>

Other commands to list and identify peripheral devices include the following:

 probe-ide
 probe-scsi
 probe-scsi-all

Identify Boot Device


The boot device for a system is defined in the NVRAM within the “boot-device” parameter. To determine the type of
device used for the boot process:

ok printenv boot-device
boot-device = disk

Then use the devalias command to identify the device.

ok devalias
screen /pci@1f,0/pci@1,1/SUNW,m64B@2
net /pci@1f,0/pci@1,1/network@1,1

Page 26 of 46
Solaris 9 System Administration Part 1

cdrom /pci@1f,0/pci@1,1/ide@3/cdrom@2,0:f
disk /pci@1f,0/pci@1,1/ide@3/disk@0,0
disk3 /pci@1f,0/pci@1,1/ide@3/disk@3,0
disk2 /pci@1f,0/pci@1,1/ide@3/disk@2,0
disk1 /pci@1f,0/pci@1,1/ide@3/disk@1,0
disk0 /pci@1f,0/pci@1,1/ide@3/disk@0,0
ide /pci@1f,0/pci@1,1/ide@3
floppy /pci@1f,0/pci@1,1/ebus@1/fdthree
ttyb /pci@1f,0/pci@1,1/ebus@1/se:b
ttya /pci@1f,0/pci@1,1/ebus@1/se:a
keyboard! /pci@1f,0/pci@1,1/ebus@1/su@14,3083f8:forcemode
keyboard /pci@1f,0/pci@1,1/ebus@1/su@14,3083f8
mouse /pci@1f,0/pci@1,1/ebus@1/su@14,3062f8
name aliases

Create and Remove Custom Device Aliases


Sun architecture allows systems to be booted from external devices. However, external devices do not usually have
defined device aliases. To address this issue, Sun reserves a portion of the NVRAM, called the NVRAMRC, to hold
parameters for such custom device aliases.

The nvalias command is used to create custom device aliases and is used as follows:

ok nvalias alias-name device-path

For example:

ok nvalias cramdisk /pci@1f,0/pci@1/pci@1/SUNW,isptwo@4/sd

This stores the command line in the NVRAMRC.


A system administrator will typically use the show-disks command to list all the disks and then copy and paste the
device path into the nvalias command.

As we learned previously, the setenv command can be used to set this newly created disk as the boot device.

To remove a custom device alias name, run:


ok nvunalias alias-name

This deletes the alias name from the NVRAMRC.

Page 27 of 46
Solaris 9 System Administration Part 1

View and Change NVRAM Parameters from the Shell


Until now, we have been manipulating NVRAM parameters at the “ok” prompt. Now, we will learn how to use the
/usr/sbin/eeprom command to do the same from within the Solaris environment. Let’s start with a list of all the
parameters we can work with.

# eeprom
tpe-link-test?=true
scsi-initiator-id=7
keyboard-click?=false
keymap: data not available.
ttyb-rts-dtr-off=false
ttyb-ignore-cd=true
ttya-rts-dtr-off=false
ttya-ignore-cd=true
ttyb-mode=9600,8,n,1,-
ttya-mode=9600,8,n,1,-
pcia-probe-list=1,2,3,4
pcib-probe-list=1,2,3
mfg-mode=off
diag-level=max
#power-cycles=56
system-board-serial#: data not available.
system-board-date: data not available.
fcode-debug?=false
output-device=screen
input-device=keyboard
load-base=16384
boot-command=boot
auto-boot?=true
watchdog-reboot?=false
diag-file: data not available.
diag-device=net
boot-file: data not available.
boot-device=disk:a disk net
local-mac-address?=false
ansi-terminal?=true
screen-#columns=80
screen-#rows=34

Page 28 of 46
Solaris 9 System Administration Part 1

silent-mode?=false use-nvramrc?=false
nvramrc: data not available. security-mode=none
security-password: data not available. security-#badlogins=0
oem-logo: data not available. oem-logo?=false
oem-banner: data not available.
oem-banner?=false
hardware-revision: data not available.
last-hardware-update: data not available. diag-switch?=false

To list a single parameter, type eeprom followed by the parameter name:

# eeprom boot-device
boot-device=disk:a disk net

To change the value of a parameter:

# eeprom boot-device=cramdisk
#

Now, to check the new value of the boot-device parameter:

# eeprom boot-device boot-device=cramdisk

Page 29 of 46
Solaris 9 System Administration Part 1

Interrupt a Hung System


An unresponsive system is referred to as a frozen or hung. When a system is in such a state, it must be interrupted.
Interrupting a system instantly stops the processor, does not allow the memory to be flushed, or the file systems to be
synchronized.

There are several strategies that can be used to interrupt an unresponsive system.

1. Logging in remotely to kill the offending process.

2. Attempting to “gracefully” reboot the system.

3. Holding down the “stop-a” sequence.

4. Synchronizing the file system using the OpenBoot PROM (OBP) sync command. This causes the system to
create a crash dump of the memory and reboot.

The Boot Process


The boot process consists of four phases:

Phase Details

PROM Runs POST

boot locates boot-device


Boot PROM Phase
boot reads bootblk

boot loads bootblk

bootblk loads secondary boot program (ufsboot)


Boot Programs Phase
ufsboot loads kernel (32-bit kernel or 64-bit kernel)

kernel initializes itself and loads modules


Kernel Initialization Phase
Reads configuration file /etc/system

kernel starts /etc/init


init phase
init starts rc scripts

System Shutdown Procedures


The following describe the different types of system shutdowns:
 Shut down to single-user mode

Page 30 of 46
Solaris 9 System Administration Part 1

 Shut down to display the ok prompt

 Shut down and power off

 Shut down automatically and reboot to multi-user mode

The following commands can be used by root to perform these shutdowns:

 /sbin/init – Can be used with run levels S, 1, 0, 5 or 6 to shut down, power off, or reboot the system gracefully.
This command performs an immediate shutdown without warning to logged on users

 /usr/sbin/shutdown – Works just like the init command except that it delays the shutdown for 60 seconds (by
default) and warns users with a default or customized message

 /usr/sbin/halt – Performs an immediate shutdown without notification to users. Stops the Solaris Operating
Environment and brings the system to an ok prompt

 /usr/sbin/poweroff – Performs an immediate shutdown without notification to users

 /usr/sbin/reboot – Performs an immediate shutdown without notification to users and brings the system to a run
level 3 by default

User and Security Adm inistration


Components of a User Account
User accounts consist of five main components:

 User Name – A unique name used to log into a system

 Password – A combination of six or more letters, numbers or special characters that must be entered with a user
name to access a system

 User’s Home Directory – A directory that the user is placed in upon login

 User’s Login Shell – A work environment set up by the initialization files defined by the user’s login shell. The
Bourne shell, K shell, C shell, Z shell, BASH shell and the TC shell are the six possible shells that a user may be
assigned

Page 31 of 46
Solaris 9 System Administration Part 1

 User Initialization Files – Shell scripts that determine how the work environment is set up for the user

User Creation and Management


User and Group account creation and modification are very critical parts of a system administrator’s tasks. Therefore, it
is imperative that you read the man pages extra carefully for all the commands covered in the following sections.

User Creation
Users can be added to the local system by using the useradd command. This command adds an entry for the user to
the /etc/passwd and /etc/shadow files.

For example:

# useradd -u 100 -g other -d /export/home/cramusr1 -m -s /bin/ksh –c “Account for


CramSession” cramusr1

This creates a user named cramuser1 with the following properties:

 User ID: 100

 Group Name: other

 Home Directory: /export/home/cramuser1

 Shell: K Shell

 Comment: Account for CramSession

User Modification
Users can be modified on the local system by using the usermod command
For example, the following command renames cramusr1 to cramusr2 while retaining all its properties:

# usermod -d /export/home/cramusr2 -m -l cramusr2 cramusr1

Page 32 of 46
Solaris 9 System Administration Part 1

User Deletion
The userdel command can be used to delete a user’s account from a system. It can also remove the user’s home
directory and its contents if used with the “-r” option.
For example:

# userdel –r cramusr2

Group Creation and Management


Group accounts are commonly used to manage permissions to shared resources but may also be leveraged for other
purposes.

Group Account Creation


The groupadd command is used to create new group accounts. This command updates the /etc/group file with an
entry for the newly created account.

For example, the following command creates a new group account called cramusrs with a group ID of 301.

# groupadd -g 301 cramusrs

Group Account Modification


The groupmod command is used to modify group accounts. This command updates the /etc/group file appropriately.

In the following example, we will change the Group ID (GID) from 301 to 400:

# groupmod -g 400 cramusrs

Group Account Deletion


The groupdel command is used to delete group accounts. This command updates the /etc/group file appropriately.

In the following example, we will delete the cramusrs group account from the local system:

# groupdel cramusrs

Page 33 of 46
Solaris 9 System Administration Part 1

System Access Control


Difference between /etc/passwd and /etc/shadow
The /etc/passwd file contains almost everything about a user except for the password. This file is readable by anyone.
The password itself is encrypted and stored in the /etc/shadow file. This file is readable only by root.

Notice the difference between the two files (especially the “x” following a user name):

# cat /etc/passwd
root:x:0:1:Super-User:/:/sbin/sh
daemon:x:1:1::/:
bin:x:2:2::/usr/bin:
sys:x:3:3::/:
adm:x:4:4:Admin:/var/adm:
lp:x:71:8:Line Printer Admin:/usr/spool/lp:
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
smmsp:x:25:25:SendMail Message Submission Program:/:
listen:x:37:4:Network Admin:/usr/net/nls:
nobody:x:60001:60001:Nobody:/:
noaccess:x:60002:60002:No Access User:/:
nobody4:x:65534:65534:SunOS 4.x Nobody:/:
athar:x:100:0::/home/athar:/bin/sh
# cat /etc/shadow
root:s5JR561b9zPVs:6445::::::
daemon:NP:6445::::::
bin:NP:6445::::::
sys:NP:6445::::::
adm:NP:6445::::::
lp:NP:6445::::::
uucp:NP:6445::::::
nuucp:NP:6445::::::
smmsp:NP:6445::::::
listen:*LK*:::::::
nobody:NP:6445::::::
noaccess:NP:6445::::::
nobody4:NP:6445::::::
athar:QROSXsUei6iEU:11859::::::

Page 34 of 46
Solaris 9 System Administration Part 1

The pwconv Command


The pwconv command updates the /etc/shadow file with information from the /etc/passwd file. If the /etc/shadow file
does not exist, the pwconv command creates it. If you look closely in the preceding section, you will notice that in the
/etc/passwd file, there is an x following the user name. This “x” indicates that the password for the user exists in the
/etc/shadow file.

Monitor Failed Login Attempts


Failed login attempts are recorded in the /var/adm/loginlog. This file does not exist by default and needs to be created
or “touched.”

# touch /var/adm/loginlog

Once this file has been created, all failed login activity after five attempts is recorded in this file automatically. If there
are fewer than five failed attempts, the file will not contain any information.

Once the file is created, and we purposefully enter incorrect passwords at a telnet session, the following message is
displayed in a terminal window on the console:

# Jul 7 15:25:07 unknown login: REPEATED LOGIN FAILURES ON /dev/pts/4 FROM dhcp-249-
16-75.mydomain.com, athar

Also, the following entries are added to the /var/adm/loginlog:

# cat /var/adm/loginlog
athar:/dev/pts/4:Sun Jul 7 15:24:24 2002
athar:/dev/pts/4:Sun Jul 7 15:24:30 2002
athar:/dev/pts/4:Sun Jul 7 15:24:37 2002
athar:/dev/pts/4:Sun Jul 7 15:24:44 2002
athar:/dev/pts/4:Sun Jul 7 15:25:03 2002

Page 35 of 46
Solaris 9 System Administration Part 1

Monitor System Access


The who command lists users connected to a system. The command reads the /var/adm/utmpx file to obtain this
information.

# who
root pts/3 Jul 7 15:41 (mylaptop.mydomain.com:6954.0)
root dtremote Jul 4 23:39 (mylaptop.mydomain.com:6954)

Also, the last command is used to display a record of system access. It obtains this information from the
/var/adm/wtmpx file.

# last
athar ftp mylaptop.mydomai Sun Jul 7 15:30 still logged in
root dtremote mylaptop.mydomai Thu Jul 4 23:39 still logged in
<Output Omitted>
wtmp begins Thu Jun 20 18:40

Printer M anagem ent and Adm inistration


The LP print service in Solaris allows printers to be shared across systems and allows users to print while continuing to
work on other tasks.

Print Management Tools


There are three components native to the Solaris Operating Environment that enable system administrators to set up
and administer printers.

 Solaris Operating Environment Print Manager – A new graphical tool that enables system administrators to
configure and manage printers both on the local as well as remote systems. This tool is preferred over admintool
and can be started from /usr/sadm/admin/bin/printmgr

 admintool – An older graphical tool used to set up and manage printers on a local system

 LP print service commands – A command line interface used to perform the same functions as the previous
two tools

Page 36 of 46
Solaris 9 System Administration Part 1

Printer Configuration Types


Printers can be set up and accessed in any of the following configurations:

 Local Printer – A printer physically connected to the system

 Network Printer – A printer attached to the network with its own hostname and IP address without being
attached to a print server

 Remote Printer – A printer attached to a remote system or the network

The Solaris LP Print Service


The LP print service performs four basic functions.

 Initialization – The service initializes the printer to ensure that it is in a known state before it sends a print
request

 Queuing – The service schedules print requests as they are spooled

 Tracking – The service tracks the status of all print requests. This allows users to view and cancel their own
requests. And, it allows root to manage them if necessary. Any errors that occur are logged by the tracking
feature
 Fault Notification – In the event that a print request cannot be fulfilled, this feature of the service notifies the
user either by a message on the console or via email

Print Service Directory Structure


The following is a brief introduction to some of the more important directories:

 /usr/bin – Contains user commands including lp, lpstat and cancel

 /usr/sbin – Contains administrative commands including lpadmin, lpusers and lpshut

 /usr/share/lib/terminfo – Contains terminfo database which contains printer and terminal capabilities

 /usr/lib/lp – Contains lpsched daemon, binary files used by the print service, postscript filters and default printer
interface programs

 /etc/lp – Contains a hierarchy of LP server configuration directories and files. This directory is maintained by the
lpsched daemon and should not be edited manually

Page 37 of 46
Solaris 9 System Administration Part 1

 /etc/lp/printers – Contains a directory for each local printer. These subdirectories contain
configuration information for the respective printer

 /etc/lp/interfaces – Contains interface program files for each printer


 /var/spool/lp – Contains a list of print requests in queue

 /var/lp/logs – Contains a history of finished print requests

The Printing Process


A print processes consists of the following steps:

1. lp send a request to lpsched.

2. lpsched spools the print request.

3. lpsched matches the printer type and file content type. It also identifies the destination printer for the print
client.
4. If necessary, lpsched filters the print request.

5. lpsched starts the printer’s interface program.

6. The interface program downloads the file to the printer

7. The document is printed at the printer.

Creating Printer Classes


A printer class is a group of printers identified by a common name. Users can submit print requests to a class name
instead of a specific printer. The LP print service automatically routes the request to the first available printer within the
class. This feature is often used for load balancing purposes.

Printer classes are created using the lpadmin command.

In the following example, we will create a printer class called “complab” for a college computer lab with two printers.

# lpadmin -p printer1 -c complab

Notice that the complab class is created automatically when printer1 is added to it.

Page 38 of 46
Solaris 9 System Administration Part 1

Now, we will add the second printer to this class.

# lpadmin -p printer2 -c complab

Now that both printers are added to the class, students may submit print requests as follows:

# lp –d complab myfile

Set or Change Default Printer or Printer Class


The lpadmin command is used to set or change the default printer or printer class for a system.

To set complab as the default printer class:


# lpadmin -d complab

To remove the default printer class:


# lpadmin -d

Remove Printer Configuration


Printer configurations can be removed from two locations – the client or the server.

Client Side Removal


To remove the printer configuration from the client:

1. Log in as root on the system.

2. Use the lpadmin command to delete the printer configuration:

# lpadmin -x printer1

This removes the configuration information from the /etc/lp/printers directory on the client.

Page 39 of 46
Solaris 9 System Administration Part 1

Server Side Removal


To remove the printer configuration from the print server:

1. Log in as root on the print server.

2. Stop accepting additional print requests on the printer.

# reject printer1

3. Stop the printer.

# disable printer1

4. Delete the printer using the lpadmin command.

# lpadmin -x printer1

This removes the configuration information from the /etc/lp/printers directory on the print server.

Stop and Start the LP Print Service


The lpshut and lpsched commands are used to stop and start the print service respectively.

# /usr/lib/lpshut

Print services stopped.

# /usr/lib/lpsched

Print services started.

Page 40 of 46
Solaris 9 System Administration Part 1

Enable and Disable Printers


The enable and disable commands are used to activate and deactivate printers.
For example to activate printer1:

# /usr/bin/enable printer1
printer “printer1” now enabled

Now to deactivate printer1:

# /usr/bin/disable –W –r “Printer shut down for 10 minutes” printer1


printer “printer1” now disabled

The “-W” switch causes the command to wait to until the current print request is completed. Conversely, if the “–c”
switch had been used, the current print request would have been cancelled.

Move Print Requests


The lpmove command is used to move one or all print requests from one printer to another.

1. Log in as root on the print server.

2. Use the reject command to prevent additional print requests from being accepted.

# reject –r “Printer1 will be back in one hour” printer1

3. Use the lpstat command to view pending requests.

lpstat –o
<Output Omitted>

4. Verify that new printer is accepting print requests

# lpstat –a printer2
printer printer2 accepting requests since Sun May 5

5. Move all print requests from printer1 to printer2

Page 41 of 46
Solaris 9 System Administration Part 1

# lpmove printer1 printer2

Or, to move a specific print request (e.g. printer1-25):

# lpmove printer1-25 printer2

6. Re-activate printer1 when it is back online.

# accept printer1
destination “printer1” now accepting requests

View System Processes


Any program that runs on the system is called a process and is assigned a unique Process Identification Number (PID)
which is used by the kernel to track and manage it. The following methods are used to view processes running on a
system:

 The CDE Process Manager – A graphical tool that can be launched from the CDE workspace or from the
command line by typing /usr/dt/bin/sdtprocess

 The ps command – The Process Status (ps) command is the most commonly used method

 The prstat command – This is a new and improved command that was included with Solaris 8

Scheduling Command Execution


Commands can be scheduled to run either once or at a recurring interval.

The at and batch commands are used to schedule a one-time execution at a certain time. For recurring execution of
commands, a crontab file is used. These files are located at /var/spool/cron/crontabs

Page 42 of 46
Solaris 9 System Administration Part 1

System Backups and Restores


Tape Media Types and Capacities
It is beneficial to become familiar with the types of tape devices typically used to backup file systems.

Media Capacity

½ Inch Reel Tape 140 MB

¼ Inch QIC Cartridge Tape 8 GB

4 mm 24 GB

8 mm Cartridge Tape 40 GB

½ Inch DLT Cartridge Tape 70 GB

Tape Device Naming Conventions


Tape devices are usually named in the format /dev/rmt/0hn

Let’s take a closer look at the “0hn” part of the name:

 0 – This is the logical number of the tape. For example, the first tape could be named /dev/rmt/0 and so on

 h – This part of the name indicates the tape density. For example:

 l – Low Density

 m – Medium Density

 h – High Density

 c – Compressed

 u – Ultra Compressed

 n – This part of the name indicates whether a tape is to be rewound when the operation is completed. If there is
an “n” in the name, this indicates that the tape is not to be rewound

Page 43 of 46
Solaris 9 System Administration Part 1

Going back to our example, we can see that the tape in question is the first logical tape of high density and is not to be
rewound.

Backup Types
There are only two types of backups in the Solaris Operating Environment.

 Full – A complete backup of the entire file system

 Incremental – A backup of new and modified files since the previous backup

The ufsdump Command


Although there are other backup tools available from Sun as well as other vendors, the command you need to be
extremely familiar with for this exam is the ufsdump command.

The /usr/bin/ufsdump command can be used to perform a backup at a level 0 through 9 and also to verify the contents
of the backup. A level 0 backup is a full backup. Levels 1 through 9 are incremental. The difference between any given
level and another is that it will perform a backup of all files that have been created or changed since the last lower level
backup. The command can also be used to update the /etc/dumpdates file which contains the file system, date and
dump level information.

Usually the crontab file is used to schedule nightly, weekly and monthly backups. The flexibility of the ufsdump and
crontab offer endless possibilities and allow system administrators to create backup strategies specific to their needs.
Be sure to read the man pages for this command and understand the various options and usage.

The ufsrestore Command


The ufsrestore command is used to restore file systems that were backed up by the ufsdump command. The
command copies files to disk relative to the present working directory and the incremental backups that follow it. It also
creates a restoresymtable that can be removed once the restore has been completed.

Page 44 of 46
Solaris 9 System Administration Part 1

Perform a File System Restore


Obviously the most important file system is / or root. Since this is what the system uses to boot from, it is a little tricky
to restore. In the following example, we will go through a restore of the / partition to the boot disk c0t0d0s0.

1. Boot with the Solaris CD

ok boot cdrom –s

2. Create a new file system

# newfs /dev/rdsk/c0t0d0s0

3. Mount the file system to an empty mount point (e.g. /x)

# mount /dev/dsk/c0t0d0s0 /x
# cd /x

4. Restore the root file system from backup. Note that we need to always start a restore from the tape that
contains the level 0 backup. Here let’s assume that it resides on tape 0.

# ufsrestore rf /dev/rmt/0

5. Remove the restoresymtable

# rm restoresymtable

6. Install bootblk on the boot disk.

# cd /usr/platform/`uname -m`/lib/fs/ufs
# installboot bootblk /dev/rdsk/c0t0d0s0

7. Unmount the new file system

# cd /
# umount /x

8. Check the file system

Page 45 of 46
Solaris 9 System Administration Part 1

# fsck /dev/rdsk/c0t0d0s0

9. Reboot the system

# init 6

10. Perform a full back up of the new file system. This is necessary because the ufsrestore command changes the
position of the files and re-allocates inodes.

# ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t0d0s0

Step 6 is important when restoring the root partition. It can be skipped when restoring the /usr and /var file systems. In
order to restore regular file systems, steps 1, 6 and 9 can be skipped.

Determine Number of Tapes Required


The ufsdump command can be used to determine the number of bytes needed to perform a backup of a given file
system at a particular backup level

For example, if we want to find out how many bytes it would take to perform a full backup of the / partition:

# ufsdump 0S /
1249763328

Or, if we want to find out the number of bytes required to perform a level 3 back up the /export/home file system:

# ufsdump 3S /export/home
122871808

Now we can take the number of bytes reported back and divide it by the capacity of the tape. This will
give us the number of tapes required to perform the backup.

Page 46 of 46

You might also like