Beruflich Dokumente
Kultur Dokumente
Unix (officially trademarked as UNIX, sometimes also written as UNIX) is a multitasking, multi-
user computer operating system originally developed in 1969 by a group of AT&T employees at
Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy and Joe
Ossanna. The Unix operating system was first developed in assembly language, but by 1973 had
been almost entirely recoded in C, greatly facilitating its further development and porting to
other hardware. Today's Unix system evolution is split into various branches, developed over
time by AT&T as well as various commercial vendors, universities (such as University of
California, Berkeley's BSD), and non-profit organizations.
Solaris is known for its scalability, especially on SPARC systems, and for originating many
innovative features such as ZFS, SMF and Zones. Solaris supports SPARC-based and x86-based
workstations and servers from Sun and other vendors, with efforts underway to port to
additional platforms.
2
Unix Principles
Everything is a file.
− Including hardware
3
.
# uname –a -----------------------------------------------Gives all details about the system
# uname –m ----------------------------------------------Displays H/W platform (sun4u)
# uname –p -----------------------------------------------Machine processor architecture (sparc or i386)
# uname –i ------------------------------------------------Machine model architecture (SUNW, Ultra 5_10)
# uname –X -----------------------------------------------Detailed description
# echo $MANPATH
: /usr/local/samba/man:
# find /kris –name file1 --------------------------------------------------------Searches for file file1 in /kris directory
# find /ris –name file1 –exec ls –l {} \; -------------------------------------Search and display
# find /kris –type f –size 0 –exec ls –l {} \; --------------------------------Search for the file with size 0
# find /kris –user user1 --------------------------------------------------------Shows file used by user ‘user1’
4
.
File Archives
# tar –cvf bkp.tar file1 file2 -----------Will archive file1 & file2
# tar –tvf bkp.tar -----------------------Shows the table of content
# tar –xvf bkp.tar -----------------------It extracts file from the tar archive
# jar –cvf bkp.tar
# jar –tvf bkp.jar
# jar –xvf bkp.jar
# compress bkp.tar --------------------To compress tar archive
# ls
bkp.tar.z
# uncompress bkp.tar.z ----------------To uncompress tar archive
# gzip bkp.tar ----------------------------To create gzip file
bkp.tar.gz
# gunzip bkp.tar.gz ---------------------To extract the tar archive by gunzip
bkp.tar
# zip out.zip bkp.tar --------------------To create zip archive
# unzip out.zip --------------------------To extract the zip archive
5
Unit 1
6
Introducing the Solaris 10 Directory Structure
4. /home – Home Directories
Home directories for all users to store their personal files.
For example: /home/john, /home/nikita
Inode: is a object that the Solaris OS uses to record information about a file
Inodes are numbered, and each file system contains its own inode list.
Data Blocks: are disk space units used to store data. ( note: device files donot hold
data)
The character in the first column identifies each file type, as follows:
- Regular files
d Directories
l Symbolic links
b Block-special device files
c Character-special device files
Symbolic Links
A symbolic link is a file that points to another file.
A symbolic link contains the path name of the file to which it
points.
Because symbolic links use path names to point to other files, they
can point to files in other file systems.
The size of a symbolic link always matches the number of
characters in the path name it contains.
# ln –s <filename> <linkname>
Device Files
A device file provides access to a device. the inode
information of device files holds numbers that refer to devices.
Device Naming :
Disks, like other devices of the Solaris 10 operating system, can be
referenced using, three naming conventions:
A UNIX file system is built within these disk slices. The boundaries of a
disk slice are defined when a disk is formatted by using the Solaris format
utility, and the slice information for a particular disk can be viewed by
using the prtvtoc command. Each disk slice appears to the operating
system (and to the system administrator) as though it were a separate disk
drive.
Partitioning Disks
A disk consists of a small disk label, also called a volume table of
contents (VTOC), with the remainder of the disk being divided in to slices.
Once the partition is defined, a file system can be created within the
partition.
The Disk Label, or VTOC
The disk label, or VTOC, contains various geometry data about the disk,
such as sectors per track, tracks per cylinder, available cylinders, and so
on. In addition the disk label contains the partition table.
The following steps show how you can examine information stored on a
disk’s label by using the prtvtoc command:
Become superuser.
Type prtvtoc /dev/rdsk/c#t#d#s# and press Enter.
Information for the disk and slice you specify is displayed. In the
following steps, information is displayed for all of disk :
1. Become superuser.
2. Type prtvtoc /dev/rdsk/c0t3d0s2 and press Enter.
The prtvtoc command shows the number of cylinders and heads, as well
as how the disk’s slices are arranged.
Formatting Disk :
Before you can create a file system on a disk, the disk must be formatted, and you must
divide it into slices by using the Solaris format utility.
Format Utility :
The main reason a system administrator uses the format utility is to divide a disk into disk
slices.
The process of creating slices is as follows:
1.Become superuser.
2. Type format.
The system responds with this:
AVAILABLE DISK SELECTIONS:
0. c0t0d0 at scsibus0 slave 24
sd0: <SUN0207 cyl 1254 alt 2 hd 9 sec 36>.
c0t3d0 at scsibus0 slave 0: test
sd3: <SUN0207 cyl 1254 alt 2 hd 9 sec 36>3.
3. Specify the disk (enter its number).
4. Type partition at the format prompt. The partition menu is displayed.
5. Type print to display the current partition map. The system responds
with this:
partition> print
6. After you partition the disk, you must label it by typing label at the
partition prompt:
partition> label
7. After labeling the disk, type quit to exit the partition menu:
partition> quit
. The Solaris OS supports the following two disk labels:
The Sun Microsystems, Inc. (SMI) disk label:
− Is typically used in SPARC-based Solaris OSs.
− Is the SPARC volume table of contents (VTOC) label for disks
− and is often called the SMI VTOC disk label.
− Provides support for disks that are less than 1 terabyte.
− Occupies the first sector of a disk in SPARC systems
• Includes a partition table in which you can define up to eight (0
through 7) disk partitions (slices). A starting cylinder and an
ending cylinder define each slice. Whole-cylinder boundaries
determine the sizes of a slices. Slice 2 represents the entire disk.
Slice 2 maintains important data about the entire disk, such as
the size of the actual disk and the total number of cylinders
available for the storage of files and directories.
• Must be used for SPARC-based and Solaris x86/x64-based
systems boot disks.
. Solaris OS systems for the x86/x64 platforms maintain two
partition tables on each disk. The first sector of disks on
x86/x64 systems contains a fixed disk (fdisk) partition table.
The second sector of the Solaris fdisk partition on an x86/x64
system holds the partition table that defines slices within the
Solaris fdisk partition. The label that holds this table is known
as the x86/x64 VTOC.
• The fdisk partition table defines up to four fdisk partitions.
One of these fdisk partitions may be used for the Solaris OS.
Provision is made for up to sixteen slices within a Solaris fdisk
partition, but generally only ten of these are used (eight, plus
two used for platform-specific purposes).
. The extensible firmware interface (EFI) disk label:
Provides support for disks that are larger than 1 terabyte on
systems that run a 64-bit Solaris kernel.
Provides support for virtual disk volumes.
Includes a partition table in which you can define up to ten (0
through 9) disk partitions (slices).
Is compatible with the UFS. You can create a UFS that is larger
than 1 terabyte.
Solaris OS systems do not currently boot from disks that use
EFI labels.
Use either SMI or EFI labels if a disk is not being used as a boot disk.
Use either the format or prtvtoc command to check whether a
disk has an SMI VTOC or EFI label.
EFI Label and VTOC Label Comparison
The EFI disk label differs from the VTOC disk label as follows:
The EFI label provides support for disks greater than 1
terabyte.
The EFI label provides usable slices 0-6, where slice 2 is just
another slice.
Partitions (or slices) cannot overlap with the primary or backup
label, nor with any other partition. The EFI label size is usually 34
sectors, so partitions start at sector 34. This feature means that no
partition can start at sector zero
For SMI/VTOC labeled disks, you have 8 slices (0 to 7). For EFI
labeled disks, you have 10 slices (0 to 9).
The default behavior of both EFI and SMI/VTOC labeled disks
are that slice 2 always occupies the entire disk space. For EFI
labeled disks, you can resize slice 2. You cannot do this with
SMI/VTOC labeled disks.
The prtconf Command
Use the prtconf command to display the system’s configuration
information, including the total amount of memory installed and
the configuration of system peripherals, which is formatted as a
device tree.
The prtconf command lists all possible instances of devices,
whether the device is attached or not attached to the system.
Use the prtconf and grep commands to list only the attached
devices on the system.
#prtconf | grep –v not
The prtdiag command
Use the prtdiag command to display system configuration and
diagnostic information. See the prtdiag(1M) man page for more
information.
# prtdiag
Replacing a Disk:
- Save VTOC information to a file:
- #prtvtoc /dev/rdsk/c0t0d0s2 > /var/tmp/c0t0d0s2.vtoc
- replace the disk with new disk
- copy the VTOC table to the new disk
- #fmthard –s /var/tmp/c0t0d0s2.vtoc /dev/rdsk/c0t0d1s2
.
Extended VTOC:
Prior to the Solaris 10 10/09 release, the Sun disk label limited the
size of the bootable disk to less than 1 Tbyte. Now, installing and
booting from disks in the 1 to 2 Tbytes range is supported with the
64-bit Solaris kernel.
The format -e utility can be used to label a disk of any size with a
VTOC label, but the addressable space is limited to 2 Tbytes.
Unit 3
Interface Configurations
Network Configuration
UFS : The UNIX file system, The UFS file system is the default disk-based file
system used in Solaris.
HSFS : The High Sierra and ISO 9660 file system. The HSFS file system is used on
CD-ROMs and is a read-only file system.
PCFS : The PC file system, which allows read/write access to data and programs on
DOS-formatted disks written for DOS-based personal computers.
SWAPFS— The Swap file system is used by kernel to manage swap space on disks.
Swap space is used as a virtual memory storage area when the system does not have enough
physical memory to handle current processes.
PROCFS— The Process File System resides in memory. It contains the list of Active
Processes, by process number in /proc directory. Information in this directory is used by
commands such as the ps command.
TMPFS— The temporary file system uses local memory for file system reads and writes.
Because TMPFS uses physical memory and not the disk, access to files in a TMPFS file
system is typically much faster than to files in a UFS file system. Files in the temporary file
system are not permanent; they are deleted when the file system is unmounted and when the
system is shut down or rebooted. TMPFS is the default filesystem type for the /tmp
directory in the Sun OS system software. When memory is insufficient to hold everything in
the temporary file system, theTMPFS file system uses swap space as a temporary backing
store as long as adequate swap space is present.
ufs – Unix FS hsfs – High Sierra FS pcfs – PC FS for DOS FAT32 FS
udfs – Universal Disk Format FS nfs - Network FS
Pseudo FS – Memory based FS tmpfs swapfs procfs
VTOC present in the first sector in the raw disk area.
VTOC - 512 sector
Boot Block - 1-15 sector
Super Block - 16-31
First Cylinder Group - 32
Creating File Systems
# newfs /dev/rdsk/c1d0s0 ---- Creating FS
# newfs –i 16384 /dev/rdsk/c1d0s0 ----- Creating FS with data
block size 16KB
# mount /dev/dsk/c1d0s0 /p1 ----Mounting partition in /p1
directory
# fstyp –v /dev/rdsk/c1d0s0 | head
# fstyp –v /dev/rdsk/c1d0s0 | grep minfree
minfree 6% ---- To know the reserved disk space
# tunefs –m 2 /dev/rdsk/c1d0s0 --- This will reduce the reserved
space to 2%
# umount /p1 ---- To umount a partition.
Never run the fsck command on a mounted FS. The /, /usr and
/var FS should have the fsck command run on them on single user
mode
# fsck /dev/rdsk/c0td0s7 ----- To check the FS in interactive mode
Checking File Systems – using fsck
A file system can become damaged if it is corrupted from a power failure, a
software error in the kernel, a hardware failure, or an improper shutdown of the
system. The file system check program, fsck, checks the data consistency of a file
system and attempts to correct or repair any inconsistencies or damage found.
The fsck command checks and repairs any problems encountered in file systems
before they are mounted.
The fsck command makes several passes through a file system. During each pass,
the fsck command checks for several types of file system inconsistencies.
− Superblock Consistency
− Cylinder Group block Consistency
− Inode Consistency
− Data Block Consistency
The lost+found Directory --- the fsck command puts files and dirs that are allocated but
unrefrenced in the lost+found dir located in that file system. --- The inode number of
each file is assigned as the file name ---- if the lost+found dir does not exist, the fsck
command creates it.
fsck –
Non-Interactive Mode
During a normal system boot, the fsck command operates in noninteractive mode, which is often
referred to as preen, or silent mode.
In this mode, the fsck command addresses only minor inconsistency problems that can be
corrected. If a more serious inconsistency is found and a decision has to be made, the fsck
program terminates and requests the root password to enter single-user mode. Execute the fsck
command in interactive mode to continue.
Interactive Mode
In interactive mode, the fsck command lists each problem it encounters, followed by
a suggested corrective action in the form of a question that requires a yes or no
response.
Some of the common file system errors that require interactive intervention are:
− Allocated unreferenced file
− Inconsistent link count
− Free block count corruption
− Superblock corruption
# newfs –N /dev/rdsk/c0t0d0s0 --- to list all the alternatve backup superblocks in the
file system
If you use the newfs command with the -T option, the structure
created allows the file system to grow to a multi-terabyte file
system. You can view the file system parameters using this option
without actually creating the file system.
# newfs –N –T /dev/rdsk/c0t0d0s0
Dnode and znode data structures are called metadata and are stored
dynamically by the ZFS. ZFS implements the ZFS POSIX layer (ZPL)
which is a primary interface for ZFS. The ZPL allows commands you use with
the UFS to work with ZFS. ZFS emulates the UFS inode number.
56
.
Features:
1. 256 quadrillion( 1 billion ) zettabytes (Terabytes - Petabytes - Exabytes -
Zettabytes(1024 Exabytes))
2. supports RAID-0 & RAID-Z(RAID-5 with enhancements) ( 2-required
virtual devices )
3. Snapshots - read-only copies of file systems or volumes
4. Creates volumes
5. Uses Storage pools to manage storage - aggregates virtual devices
6. File systems attached to pools grow dynamically as storage is added
7. File systems may span multiple physical disks
8. ZFS is transactional -- means copy on write ( COW )
9. ZFS Pools & file systems are auto-mounted. No need to maintain
/etc/vfstab ( pool names should be unique )
57
ZFS commands
Get familiar with command structure and options
$ man zpool
$ man zfs
# cd /
# mkfile 100m disk1 disk2 disk3 disk5
# mkfile 50m disk4
# ls -l disk*
-rw------T 1 root root 104857600 Sep 11 12:15 disk1
-rw------T 1 root root 104857600 Sep 11 12:15 disk2
-rw------T 1 root root 104857600 Sep 11 12:15 disk3
-rw------T 1 root root 52428800 Sep 11 12:15 disk4
-rw------T 1 root root 104857600 Sep 11 12:15 disk5
Attempt to create a zfs pool with different size vdevs fails. Using -f options forces it to
occur but only uses space allowed by smallest device.
# zpool create myzfs mirror /disk1 /disk4
invalid vdev specification
use '-f' to override the following errors:
mirror contains devices of different sizes
59
. # zpool create myzfs mirror /disk1 /disk2 /disk3
# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
myzfs 95.5M 112K 95.4M 0% ONLINE -
# zpool status -v
pool: myzfs
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
myzfs ONLINE 0 0 0
mirror ONLINE 0 0 0
/disk1 ONLINE 0 0 0
/disk2 ONLINE 0 0 0
/disk3 ONLINE 0 0 0
Attach device to pool. This creates a two-way mirror is the pool is not already a mirror, else it adds another mirror,
in this case making it a 3 way mirror
# zpool attach myzfs /disk1 /disk3
# zpool status -v
pool: myzfs
state: ONLINE
scrub: resilver completed with 0 errors
config:
61
.
Attempt to remove a device from a pool. In this case it's a mirror, so we must use "zpool detach".
# zpool remove myzfs /disk3
cannot remove /disk3: only inactive hot spares can be removed
# zpool detach myzfs /disk3
# zpool add myzfs spare /disk3
# zpool status -v
Replace a disk in a pool with another disk, for example when a disk
fails
# zpool replace myzfs /disk1 /disk3
# zpool status -v
pool: myzfs
state: ONLINE
scrub: resilver completed with 0 errors
64
.
Create a second file system. Note that both file system show 159M available because no quotas
are set. Each "could" grow to fill the pool.
Reserve a specified amount of space for a file system ensuring that other users don't take up all
the space
# zfs set reservation=20m myzfs/colin
# zfs list -o reservation
RESERV
none
20M
none .
68
.
A snapshot is not directly addressable. A clone must be made. The target dataset can be located
anywhere in the ZFS hierarchy, and will be created as the same type as the original.
# zfs clone myzfs/colin@test myzfs/colin3
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
myzfs 20.2M 139M 21K /myzfs
myzfs/colin 18K 159M 18K /myzfs/colin
myzfs/colin@test 0 - 18K -
myzfs/colin2 18K 20.0M 18K /myzfs/colin2
myzfs/colin3 0 139M 18K /myzfs/colin3
Destroy a filesystem
# zfs destroy myzfs/colin2
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
myzfs 20.1M 139M 22K /myzfs
myzfs/colin 18K 159M 18K /myzfs/colin
myzfs/colin@test 0 - 18K -
myzfs/colin3 0 139M 18K /myzfs/colin3 69
.
Attempt to destroy a filesystem that had a child. In this case, the snapshot filesystem. We must
either remove the snapshot, or make a clone and promote the clone.
# zfs destroy myzfs/colin
cannot destroy 'myzfs/colin': filesystem has children
use '-r' to destroy the following datasets:
myzfs/colin@test
Promte a clone filesystem to no longer be a dependent on it's "origin" snapshot. This now
associates makes the snapshot a child of the cloned filesystem. We can then delete the original
filesystem.
# zfs promote myzfs/colin3
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
myzfs 20.1M 139M 21K /myzfs
myzfs/colin 0 159M 18K /myzfs/colin
myzfs/colin3 18K 139M 18K /myzfs/colin3
myzfs/colin3@test 0 - 18K -
70
.
Attempt to destroy a filesystem that had a child. In this case, the snapshot filesystem. We must
either remove the snapshot, or make a clone and promote the clone.
# zfs destroy myzfs/colin
cannot destroy 'myzfs/colin': filesystem has children
use '-r' to destroy the following datasets:
myzfs/colin@test
Promte a clone filesystem to no longer be a dependent on it's "origin" snapshot. This now
associates makes the snapshot a child of the cloned filesystem. We can then delete the original
filesystem.
# zfs promote myzfs/colin3
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
myzfs 20.1M 139M 21K /myzfs
myzfs/colin 0 159M 18K /myzfs/colin
myzfs/colin3 18K 139M 18K /myzfs/colin3
myzfs/colin3@test 0 - 18K -
71
.
Create a stream representation of the snapshot and redirect it to zfs receive. In this example I've redirected to the localhost for illustration
purposes. This can be used to backup to a remote host, or even to a local file.
# zfs send myzfs/bob@newtest | ssh localhost zfs receive myzfs/backup
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
myzfs 172K 159M 20K /myzfs
myzfs/backup 18K 159M 18K /myzfs/backup
myzfs/backup@newtest 0 - 18K -
myzfs/bob 18K 159M 18K /myzfs/bob
myzfs/bob@newtest 0 - 18K -
Display the command history of all storage pools. This can be limited to a single pool by specifying its name on the command line. The
history is only stored for existing pools. Once you've destroyed the pool, you'll no longer have access to it's history.
# zpool history
History for 'myzfs':
2012-09-11.15:35:50 zpool create myzfs mirror /disk1 /disk2 /disk3
2012-09-11.15:36:00 zpool detach myzfs /disk3
2012-09-11.15:36:10 zpool attach myzfs /disk1 /disk3
2012-09-11.15:36:53 zpool detach myzfs /disk3
2012-09-11.15:36:59 zpool add myzfs spare /disk3
74
To Create a File System
Using Format we can create a partition on the specific disks identified.
The default File System Includes
0 root
1 Swap
2 Entire Disk
3
4
5 /usr
6 /opt
7 /home
After Partition we can construct a file System using newfs or mkfs command
which will create UFS File System on a specific partition.
E.g. newfs /dev/rdsk/c0t0d0s7
To check the File System consistency use fsck
E.g : fsck –y /dev/rdsk/c0t0d0s7
Mounting The File System
mount Mounts specified file systems and remote resources.
mountall Mounts all file systems specified in a file system table (/etc/vfstab).
umount Unmounts specified file systems and remote resources.
umountall Unmounts all file systems specified in a file system table.
fstyp /dev/rdsk/c0t0d0s6
Ufs
77
Software Package Commands
All bundled and unbundled software is distributed as packages in the Solaris 2.x
environment. During installation selected software packages are added
automatically from the CDROM Devices
• Packages contain:
# unzip 110906-01.zip
# patchadd 110906-01
84
Init Levels / Run Levels
init (short for initialization) is a program for Unix-based computer operating systems that
parent of all other processes. It runs as a daemon and typically has PID 1. The boot loader
starts the kernel and the kernel starts init. If one were to delete init without a replacement, the
system would encounter a kernel panic on the next reboot.
The following lists the 6 Run Levels in Sun Solaris. These are often different mostly from
the linux run levels
0 - Open Boot prompt (OBP) also called OK prompt. The system is taken down to PROM
monitor or Security monitor state. It is safe to power off the hardware.
1,s,S - Single-User or Administrative mode where user logins are disabled. Also minimal
Kernel functions and minimal required file systems are mounted (/ and /usr).
4 - Not in use
5 - Shut-down and power OFF. Power OFF supported on Sun 4m & Sun 4u architecture.
More like a boot -a where the system is taken down to run level 0 and then an interactive
boot.
6 - Reboot. takes the system down to run level 0 and then back to the default run level (3)
Unit 12
87
Unit 13
USER Administration
88
User & Group Management
# passwd <username>
passwd: Changing password for <username>
New Password: <ENTER PASSWORD>
Re-enter new Password: <RE_ENTER PASSWD>
passwd: password successfully changed for <username>
To force a user to change his or her password at the next login, type
# passwd -f <username>
passwd: password information changed for <username>
Modifying User Accounts from the Command Line
You use the usermod command to modify existing user accounts from the command line. You
can use usermod to modify most of the options that were used when the account was originally
created.
The following is the syntax for the usermod command:
usermod [ -u uid [-o]] [-g group] [ -G group [ , group...]] [ -d dir [-m]] [-s shell] [-c comment] [-l
new_name] [-f inactive] [-e expire] [-A authorization2 [, authorization]] [-P profile [, profile]] [-R
role [, role]] [-K key=value] <loginname>
-r removes the user’s home directory from the local file system. If this option is not specified,
only the login is removed; the home directory remains intact.
Make sure you know where the user’s home directory is located before removing it. Some users
have / as their home directory, and removing their home directory would remove important
system files.
CAUTION
The following example removes the login account for nod but does not remove the home
directory:
userdel nod
Adding Group Accounts from the Command Line
You use the groupadd command to add new group accounts on the local system. This command
adds an entry to the /etc/group file. The syntax for the groupadd command is as
follows:
Option Description
-g <gid> Assigns the GID <gid> for the new group.
-o Allows the GID to be duplicated. In other words, more than one group with
group-name can share the same GID.
The following example adds to the system a new group named acct with a GID of 1000:
groupadd -g 1000 acct
Modifying Group Accounts from the Command Line
You use the groupmod command to modify the definitions of a specified group. The syntax for
the groupmod command is as follows:
The following example changes the engrg group GID from 200 to 2000:
groupmod -g 2000 engrg
Deleting Group Accounts from the Command Line
You use the groupdel command to delete a group account from the local system. The syntax
for the groupdel command is as follows:
groupdel <group-name>
Assigning a GID
If the -g option is not used to specify a GID, the GID defaults to the next available
number above the highest number currently assigned. For example, if group IDs 100, 110, and 200
are already assigned to group names, the next GID that is automatically assigned is 201.
/etc/skel --- Template files get copied once user id is created.
By default /etc/skel/.profile file don’t have any content.
Profile Order
/etc/motd file ---- Message of the day
/etc/profile
/$HOME/.profile
Unit 14
You can execute crontab if your name appears in the file /usr/lib/cron/cron.allow.
If that file does not exist, you can use
crontab if your name does not appear in the file /usr/lib/cron/cron.deny.
If only cron.deny exists and is empty, all users can use crontab. If neither file
exists, only the root user can use crontab. The allow/deny files consist of one user
name per line.
Crontab syntax :
A crontab file has five fields for specifying day , date and time followed by the command to
be run at that interval.
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
Solaris 10 Installation
Solaris 10 Installation
The computer must meet the following requirements before you can install Solaris
10 using the interactive installation method:
You can use one of seven methods to install the Solaris software:
Solaris Interactive installation using the graphical user interface
(GUI)
Solaris Interactive installation using the command line interface
(CLI)
Solaris JumpStart
Solaris Custom JumpStart
Solaris Flash Archives
Solaris WAN Boot Installation
Solaris Upgrade Method
Solaris 10 Installation
• Host IP address
• Subnet mask
• Domain name
• Root password
Solaris 10 Installation :
Software Groups :
1.reduced network support software group (SUNWCrnet)
2.core system support software group (SUNWCreq)
3.end user system support software group (SUNWCuser)
4.developer software group (SUNWCprog)
5.entire system support software group (SUNWCall)
6.entire + OEM software group (SUNWCXall)
cat /var/sadm/system/admin/CLUSTER
Unit 16
-d --- deletes the snapshot associated with the given file system
-i> displays the state of snapshot
The snapshot subsystem saves file system data in a file called a
backing-store file before the data is overwritten. Some important
aspects of a backing-store file are:
A backing-store file is a bit-mapped file that takes up disk space
until you delete the UFS snapshot.
The size of the backing-store file varies with the amount of activity on the file
system being captured.
The destination path that you specify on the fssnap command line
must have enough free space to hold the backing-store file.
The location of the backing-store file must be different from that of the file system
you want to capture in a UFS snapshot.
A backing-store file can reside on different types of file systems,
including another ufs file system or a mounted nfs file system.
The fssnap command creates the backing-store file and two read-only virtual
devices. The block virtual device, /dev/fssnap/0, can be mounted as a read-only file
system.
The raw virtual device, /dev/rfssnap/0, can be used for raw read-only access to a
file system.
These virtual devices can be backed up with any of the existing Solaris OS backup
commands. The backup created from a virtual device is a backup of the original file
system when the UFS snapshot was taken.
note – If the backing-store file runs out of disk space, the system
automatically deletes the UFS snapshot, which causes the backup
to fail.
The active ufs file system is not affected. Check the
/var/adm/messages file for possible UFS snapshot errors.
Note – You can force an unmount of an active ufs file system, for
which a snapshot exists (for example, with the umount -f
command). This action deletes the appropriate snapshot
automatically.
#umount /export/home
#ufsdump 0uf /extra/dump_export_home_0 /export/home
# mount /export/home
# cp –r /tmp /export/home --- copy new files in the /export/home
# umount /export/home
# mount /export/home
Restoring a Regular File System
When you restore an entire file system from a backup tape, the system creates a restoresymtable
file.
The ufsrestore command uses the restoresymtable file for check-pointing or passing information
between incremental restores. You can remove the restoresymtable file when the restore is
complete.
Performance Monitoring
PERFORMANCE MONITORING
iostat
sar
mpstat
prstat
vmstat
top
IOSTAT
It interactively reports cpu, disk, terminal activity & CPU utilization.
Iostat is primarily used to investigate disk activity & disk hardware
errors .
The most important headers to be observed in above o/p are %w & %b.
The above output shows that the system is having total 6 CPU’s.
For every CPU it shows the Idle time.
TOP
Displays and automatically updates information about top cpu processes.
Total processes
Sleeping processes
CPU idle state
Usr%
Iowait%
Memory
free memory
Swap in use
Swap free
Sample output of top :-
ssh
ftp
sendmail
dns
nfs
1) SSH :
/etc/ssh/sshd_config
Service : svc:/network/ssh:default
2) FTP :
/etc/ftpd/ftpusers
Service : svc:/network/ftp:default
3) SENDMAIL :
/etc/mail/sendmail.cf
Service : svc:/network/smtp:sendmail
svc:/network/sendmail-client:default
4) DNS :
/etc/resolve.conf nameserver & search
Service : svc:/network/dns/client:default
svc:/network/dns/server:default
5) NFS :
NFS - Network File System
Allows the multiple computers to use the same file, to reduce
storage cost, provide data consistency & reliability.
NFS daemon starts only when the system enters the run level 3
Command Operation
1 /etc/init.d/nfs.server start | stop To start & stop the NFS service manually
2 share –F nfs –o <ro/rw> <path> To share a file for NFS service
3 mount –F nfs <hostname>:<path> <mount point> To mount the shared file
4 unshare –F nfs <path> To unshared a file from NFS service
5 shareall -F nfs To share all resources listed in/etc/dfs/dfstab
6 unshareall –F nfs To un-share all resources listed as above
7 dfshares –F nfs <host> To display the currently shared NFS
8 dfmounts -F nfs <host> To display the NFS mounted resources
9 mountall -r -F nfs To mount all remote file resources
10 umountall -r -F nfs To un-mount all remote file resources
NFS Files Details :
1 /etc/dfs/dfstab Local resources that as to share at boot time
2 /etc/dfs/sharetab Currently shared local resources – auto
entry
3 /etc/dfs/fstypes Default file-system for remote file system
4 /etc/rmtab FS that remotely mounted by NFS – auto entry
5 /etc/dfs/nfslog.conf NFS logging configuration file
6 /etc/default/nfslogd Configuration files for the nfslogd
daemon