Вы находитесь на странице: 1из 202

-

www.INTUIT.ru

Solaris 10

2008 .

1. : UNIX ............................................5
.................................................................................................... 5
UNIX ............................................................................................................. 6
Solaris .......................................................................................................................... 7
UNIX ? ................................................................................................................. 7
UNIX .................................................................................................................... 9
UNIX ................................................................................................................. 12
UNIX ............................................................................................................ 13
................................................................................................................. 17

2. : ....................21
.......................................................................................................... 21
................................................................................................................ 22
.......................................................................................................................................... 23
( ) ............................................................ 25
.................................................................................................................... 27
...................................................................................................................................... 28

3. : Solaris .................................30
.................................................................................................. 30
................................................................................................................ 31
........................................................................................................................... 31
................................................................................................................................ 34
............................................................................ 35
.................................................................................................................. 35
......................................................................................................... 35

4. : Solaris ..........................................................................36
.................................................................................................. 36
.................................................................................................................... 37
........................................................................................................... 38
Solaris ................................................................................................... 38
........................................................................................................................... 39
Solaris 10 SPARC ....................................................... 41
Solaris 10 JumpStart.................................................. 42
(upgrade) ................................................................................................................ 48

5. : ......................................................49
? ................................................................................... 49
UNIX ............................................................................................................... 49
/etc/passwd, /etc/shadow, /etc/group .......................................................................... 51
............................................................................................................... 51
.............................................................................................................................. 54
............................................................................................................................................... 61

6. : .........................................................................62
" " ..................................................................................................................... 62
UNIX ............................................................................................ 62
Solaris ........................................................................................................................ 63
Solaris .................................................................................... 64
, POSIX ....................................................................... 68

3
.............................................................................................. 73
....................................................................................................................................... 75
...................................................................................................................................... 76

7. : UFS 90
..................................................................................................................... 90
.............................................................................................................................. 91
................................................................. 92
.................................................................................................................. 92
............................................................................................................. 96
................................................................................................................... 99
..................................................................................................................... 99

8. : ,
ZFS .....................................................................................................101
ZFS ........................................................................................................................................ 101
ZFS ............................................................................................................................................ 104
ZFS (copy on write) ...................................................................... 114
......................................................................................................... 115
RAID-Z ..................................................................................................................................................... 115
.................................................................................................................. 116
ZFS ......................................................................................................................... 117
ZFS ....................................................................................................................... 117
ZFS ...................................................................................................................................... 119
( ZFS UNIX) ..................................................... 122
ZFS .................................................................................... 122

9. : ............................................................124
.................................................................................................... 124
...................................................................................................... 124
/usr/bin/xpg4 ................................................................................................. 124
.................................................................................................... 124
Solaris ................................................................................................. 125
Solaris ................................................................................................................. 126
.................................................................................................................................. 127
............................................................................................................................. 129
...................................................................................... 129
.............................................................................. 135
. Swaping ............................................................................................................ 136
................................................................................................................... 137
................................................................................................... 139
.................................................................................................................... 139
......................................................................................................................... 146
................................................................................................................................. 152

10. : ...........................157
........................................................................................................................... 158
Solaris ............................................................................................................................ 159
.................................................................................................................................. 162
FAQ........................................................................................................................................................... 162
Sun.com .................................................................................................... 162
developers.sun.ru .......................................................................................................................... 162
Opennet ........................................................................................................................................ 162
Fido7 ................................................................................................................................. 163
................................................................................................................................ 163

4
................................................................... 164
: ......................................................................... 164

11. : ..................................................167
: Solaris UNIX .......................................................... 167
........................................................................................................................ 167
........................................................................................................................... 169

12. : ...........................................................186
..................................................................................................... 186
............................................................................................................. 187
....................................................................................................................................... 188
............................................................................................................................... 189
.............................................................................................................. 189
............................................................................................................ 191
. ................................................................................................... 192
.................................................................................................... 192
....................................................................................................................... 193
...................................................................................... 194
........................................................................ 194
................................................................................................................................. 195
...................................................................................................................... 196
shell ................................................................................................................ 200
......................................................................................................................... 201
....................................................................................................................... 201
............................................................................................ 202

1. : UNIX
, , .
, , - , , Windows. ,
Linux
Windows,
, UNIX . ,
UNIX.
, , .
Linux, FreeBSD, QNX, Solaris UNIX,
, ,
, ,
.


, , , . , , ,
, , . , ,
: , , .
, ( ,
) : , , .
,
"", " ". , , .
, .
, . :
- ,
. ,
, , , ,
, . , , , , , .
. ,
, , .
,
.
, , . ,
, , -

6
, .
, - , , : , ?
"" ,
,
.
2008 -, ( Solaris
Sun Microsystems) (
Google Documents Google Maps).
Solaris , IT.

UNIX

UNIX 1969
Bell Labs AT&T (Dennis Ritchie)
(Ken Thompson). PDP-7.
1972 ,
. UNIX , .
, , PDP-11 Digital Equipment Corporation (DEC). , 90- XX , DEC
Digital, Compaq, , ,
Hewlett Packard.
70- XX UNIX
(University of California Berkeley) UNIX.
1977 Berkeley Software Distribution (BSD)
UNIX. AT&T, AT&T. BSD, , 1991 .
UNIX :
, System V Release 4 ( SVR4 " "),
AT&T.
UNIX , , UNIX , .


Solaris System V. ,
, , .
, Solaris , System V, BSD,

7
, , UNIX'.
UNIX: Solaris, FreeBSD,
Linux, QNX , UNIX Mac OS X Apple.
Linux ,
(Linus Torvalds). Linux , , linux.org. , Red Hat Linux Slackware Linux Debian Linux ,
Linux .
, UNIX, Linux, , Solaris, FreeBSD ,
, , . UNIX, POSIX. , UNIX , , , , FreeBSD Solaris .

Solaris
Solaris, , Solaris:
Solaris, Solaris Express, OpenSolaris ( Sun Microsystems) Solaris Nexenta, Belenix, Schillix, marTux Milax, Sun
. ;
, opensolaris.org.
Solaris Express ,
Solaris ,
Solaris. Solaris Express
, ,
Solaris ( Solaris 10 update 5, ,
, Solaris 10 05/08). Solaris Express
opensolaris.org, DVD- ( ,
, , developers.sun.ru). Solaris Express
Solaris Express Community Edition, SXCE Solaris Express Developer Edition,
SXDE. , ( ,
SXDE , SXCE
. 2008 Sun Solaris Express, OpenSolaris. SXDE
OpenSolaris x86, 2008
OpenSolaris SPARC.
Sun Microsystems
Solaris, Solaris Express Developer Edition. , Solaris (
).

UNIX ?
. , !
, , .
Mac Book Pro, , Mac OS X,
.

8
,
Solaris ( , Sun Grid N1
, ).
- ,
UNIX, Solaris
.
, UNIX ; , ,
.
, :
1.
2.

;
(, , , , , SAP R/3);
3.
;
4.
( ), .
. , Solaris SPARC, ,
( , , ..)
Linux, .
, Solaris , , ,
Solaris SPARC, x86, .
, ,
,
.
, ,
. UNIX.
, " " . . , ,
, .
,
.
, "
". , ,
.
, .
.
XX XXI FreeBSD, (- ..) Linux, , -

9
(, ),
Solaris. , Solaris ,
FreeBSD, Linux, . , Solaris, , .
, Solaris,
developers.sun.ru .

UNIX
UNIX , , . Solaris UNIX. Solaris ,
SPARC ( 64- ) x86 (32- 64). Sun Microsystems;
1992 , Sun SunOS,
Solaris.
Solaris .
. , ,
, , : .
.
: , , , ..
, . ,
. , NFS .
Solaris genunix unix.
. genunix Solaris , unix .
/platform/`uname i`/kernel/unix. " " (` `) , ( , ), uname i ( Solaris uname -m).
/etc/system moddir, , . ,
. :
/kernel /usr/kernel
.

/platform/<platform-name>/kernel /platform/<hardware-class-name>/
kernel /kernel /usr/kernel
platform-name
uname -i
hardware-class-name

10
uname -p
Solaris /etc/system (
system(4)),
man -s 4 system
, SPARC, unix /platform/`uname i`/kernel/sparcv9/unix. (genunix unix) ,
. .
11.
, () . UNIX
(, , daemons).
,
: , , ..
UNIX , . , Linux ext2, ext3 (
), UFS, HPFS, NTFS, FAT . Solaris,
UNIX, UFS. Solaris 10
128- ZFS. ZFS
8.
UNIX , ..
. ,
,
.
UNIX ,
. , , .
, ..
. ,
.
. , .
, .
UNIX, Solaris, . (threads). 9.
UNIX (account).
, , (UID),
(GID), , , .
, UNIX, . (User ID, UID) 0 2147483647. Solaris 100 60000,
60000 , -

11
, , .
, ;
(username). ; 1 8 .
, .
.
"" (login) "username".
.
(Group ID, GID). ,
.
, . 100 60000, .
() 0 99.
, .
, - , , , webedit,
.
, ivan, lena kira. /etc/group
:
webedit::101:ivan,lena,kira
UNIX ,
. ,
Solaris 10 /etc/group .

. UNIX ( ), , UNIX.
- login:.
password: . , .
- . ( , ..) Solaris 5.
passwd _ ( ). , .
passwd , . ( , , ) .
, .
. Solaris 6 8
. , UNIX, :
.
. UNIX

12
, , .
, -
, , qazwsx.
,
.
, .
, ,
.
/etc/passwd, ( , ) /etc/shadow ( , root).
/etc/group. /etc/passwd, /etc/shadow /etc/group,

5.

UNIX
UNIX, Solaris , . , , . -
.
. ,
. (, Linux)
( , 0 6, Solaris
s). , , ,
.
.
, , , .
. .

,
. , , .
,
boot s

b s
-.

init s

13
init S
shutdown .
, ,

(exit Ctrl-D, ).
init - ,
init 3
C (runlevels) . 1 , 3 . 0
( shutdown).
:
man init
Solaris 10 "" (milestone), - " ".
, .
, , . , ,
, ,

svcadm milestone -d milestone/single-user:default


, svcadm milestone, "single-user", "multi-user" "multi-user-server". , "all" ( , ) and "none" ( ,
svc:/system/svc/restarter:default).
.
init , . Solaris 10 init, System V.
, SMF
11.

UNIX
, . ,
? ,
, , , , ,
, , ?
UNIX (
), (
, ls <Enter>,
).


, ,

14
. Solaris ( )
, . , - . ,
- ,
.
GNOME, Solaris 10 Solaris Express. , Solaris HP-UX CDE (Common Desktop
Environment), Options .
KDE, , Solaris,
, KDE Solaris blastvawe.org. 1 " Solaris
10".


, .
. ,
, , ,
.
.
, Solaris
" " (workspace). .
, . . ,
.
.

GNOME
,
12 " Solaris 10", ,
GNOME (Desktop), , ( ). ,
, .. , (. 1.1).

15

. 1.1. Solaris
Java (
) 1) . , , , , , , ,
.. , ( root),
root.

16
. 1.2. GNOME
Solaris
Linux, FreeBSD UNIX,
Windows. , - , Solaris ( ; ,
, ).

CDE
(front panel)
. (.
1.3) , .
, Windows.
, , ,
, , (. 1.4).
( . 1.3 "", ).

. 1.3. CDE

. 1.4. ""
CDE 12 " Solaris 10".

17

. ( );
. .
(. 1.5) :
( ),
.

()

( ) -

. 1.5. CDE
,
restore ( ),
move, resize, minimize,
maximize, lower ( ) close.
,
(occupy all workspaces) (occupy workspace) . "" .
(- minimize ,
(
maximize). - ( )
(restore)



, .
. .
. ( ), (.. , "" ).
, , , , .
UNIX- , , UNIX-,
UNIX . -
- .
Solaris . 9 . ,
. , ,
.
, Alt-F, . -

18
.
Ctrl-Alt-Fn .
, , , .
i386, ,
,
, . Linux FreeBSD.

. , Solaris
, CDE "console". , "console", dtconsole. "This
host", dtterm.
, - .
, (
) ()
, . UNIX- , .
(Alt-F1).
- - , UNIX-
(, dtterm CDE gnome-terminal
GNOME).
(, ) . X-Servera. X-server
X-Window 12 " Solaris 10".
.
Solaris , . , Solaris ,
, .
.
ANSI VT-100. . , " " VT-100 <Esc>[A. ( - ) /etc/termcap
/usr/share/lib/terminfo.
TERM , . , - ,
- . , . :
TERM='VT100'; export TERM
TERM
echo $TERM

19
TERM , . , Enter
[[A, .
, , ANSI VT-100. ,
. , TERM ,
.


, - (. . 1.1).
1.1.
Ctrl-C

(termination)

Ctrl-D

Ctrl-S

Ctrl-Q

Ctrl-U

Ctrl-Z

(suspend)

<backspace>
<backspace> ,
<Delete>.
<Delete> <Ctrl-C>
.
Ctrl-D ( ) . ,
(
login shell), (logout).
,
. ,
logout.

: stty
, , stty:
stty a
, , , :
stty -a
speed 9600 baud;
rows = 24; columns = 80; ypixels = 490; xpixels = 570;
csdata ?
eucw 1:0:0:0, scrw 1:0:0:0
intr = ^c; quit = ^\; erase = ^h; kill = ^u;
eof = ^d; eol = <undef>; eol2 = <undef>; swtch = <undef>;
start = ^q; stop = ^s; susp = ^z; dsusp = ^y;

20
rprnt = ^r; flush = ^o; werase = ^w; lnext = ^v;
-parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk -crtscts -crtsxoff
-parext
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl
-iuclc
ixon -ixany ixoff -imaxbel
isig icanon -xcase echo echoe echok -echonl -noflsh
-tostop echoctl -echoprt echoke -defecho -flusho -pendin iexten
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel
(. 1.1)

stty susp '^z'
stty intr '^c'
stty erase '^h'
.. (susp, intr, erase ) stty
a (man stty).

OpenSolaris 2008.05 ,
Ubuntu Linux
1)

21

2. :

, , Solaris.
.


, UNIX .
, . , . , , .
, UNIX .
( , ). . , ,
UNIX. ,
(, ..) , :
cp - copy files and directories
man. man
nroff more ( page, pg, less).
, . /usr/share/man/manN (N ), /usr/man/manN,
- /usr. man
catN. , manN, . man
-M, , .

man, .
man- , , , inetd.conf(5) inetd.conf
inetd . .
2.1 , man. BSD System V
-.
2.1.

System V

BSD

(, Perl)

(
System V )

, ,

22

UNIX , . , ,
- , , 1b.
UNIX ,
man ___
man k .
man k , . catman - . man
k apropos.
whatis.
UNIX ,
, , alias jobs. , , man , (
, sh bash).
, 10.
man, info HOWTO.
info info.
? info. man
"-": , .
HOWTO , Linux. HOWTO , . Howto html . man,
HOWTO. , , .
, man
HOWTO html. , . ,
,
.


GNOME . ;
. , ,
,
(. 2.1).
"Screen Resolution"
(. 2.2). , (gnome-terminal).

23

. 2.1. GNOME

. 2.2. GNOME


Solaris - .
. -,
/etc/hosts, /etc/resolv.conf ifconfig. , UNIX,
, , .. , , inetmenu. Solaris 10 ( Solaris 08/07 , , Solaris 10 update 4)
NWAM. 3
" Solaris 10".
, ( )
. , , , ( "", "-") - -, ,
yandex.ru. , ,
, .
, (, Mozilla Firefox Mozilla Thunderbird)
, .
, , , .
, , ,

24
ifconfig -a
, , lo0, "", "" , , ,
. .
inetmenu, .
, inetmenu.
. lo0 inetmenu . ,
. ,
. (, ), , .

(Ethernet)
, , - qme0, bge0
. inetmenu : deconfigure ( , ), DHCP ( ), Static address (, .. ) , , ,
inetmenu. - inetmenu 3 " Solaris 10". ,
; , DHCP.
, , inetmenu ifconfig ( ,
ifconfig -a), /etc/hosts /etc/resolv.conf.

(wi-fi)
802.11 (
wi-fi, wireless).
. ,
.
( )
wificonfig scan
, .
? () , . . , , .
, . , .
inetmenu (, ath0). inetmenu , , , , . , , DHCP .
DHCP.

25
inetmenu wificonfig /etc/hosts /etc/resolv.conf,
ifconfig .
ifconfig -a, - wificonfig status.
NWAM,
inetmenu, - . NWAM 3 " Solaris 10".

( )
, .. , ,
UNIX, Solaris, root
(UID), .
(superuser). .
, , UNIX , . , , , .. . :
, root
.
root , UNIX-. root . root ,
"" (su). root .


, , ,
. ,
, " " .
UNIX :
root sudo,
/etc/sudoers. , ,
.
: , -
sudo.
Solaris 8 ,
(RBAC role-based access control). ,
.
, , , .
. , useradd smc.

26
9 " Solaris 10".
, ,
, , .
, , (.. root). :
1.

root, ;
root ;
2.
root ; , root,
, ?
3.
;
:
,
, .
: . " , ", -
, . ,
. ,
, ... "", ,
. : ,
, .
, .
, (1)
, ( /etc,
.mozilla ,
, - /usr/scripts) (2)
, , ; , ,
, .
4.

root , , ;
,
, root;
5.
root , . Jrcfyf ,
,
. , ,
UNIX 8
. K?3085/j , .
, ,
;
6.
Solaris
, root ;
7.
, , root (, ,
configure root ).

27

, . . useradd , "". , .
passwd . , .
, , .
Solaris Management Console
(smc), smc & /usr/sadm/bin/smc
&
/usr/sadm/bin. GNOME /usr/bin/users-admin
Administration->Users and Groups

( root).
smc 5.


/etc/passwd /etc/group .
.
,

.
Solaris , (
Solaris 9 10, ,
Solaris 10) :
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:
gdm:x:50:50:GDM Reserved UID:/:
webservd:x:80:80:WebServer Reserved UID:/:
postgres:x:90:90:PostgreSQL Reserved UID:/:/usr/bin/pfksh
nobody:x:60001:60001:Nobody:/:
noaccess:x:60002:60002:No Access User:/:
nobody4:x:65534:65534:SunOS 4.x Nobody:/:
(
Solaris 9 10, , Solaris 10):
root::0:root
other::1:

28
bin::2:root,bin,daemon
sys::3:root,bin,sys,adm
adm::4:root,adm,daemon
uucp::5:root,uucp
mail::6:root
tty::7:root,adm
lp::8:root,lp,adm
nuucp::9:root,nuucp
staff::10:
daemon::12:root,daemon
sysadmin::14:
smmsp::25:smmsp
gdm::50:
webservd::80:
postgres::90:
nobody::60001:
noaccess::60002:
nogroup::65534:


Solaris , . ,
. - , .
- .
/etc, - "" , "." ().

Solaris
UNIX
/etc .
. . , # (), . name- (DNS) ; ( ). ,
.
, ,
, /etc,
/usr/local/etc , (,
/usr/local/apache/conf - apache).
. - ; ,
, , .

,
, , , . .
passwd user

29
smc ( ).
root. root, Solaris ,
, /etc/shadow , ( ) ,
root. , root
passwd root.
, DVD- Solaris
Solaris Express cdrom ( SPARC):
boot cdrom s
Solaris x86 ( Solaris Express
Developer Edition 1/08) Solaris
/a.
/a/etc/shadow, .

30

3. : Solaris

? BIOS, . UNIX ,
. 11.
"login:".
, , syslogd, -, .
Solaris, , UNIX-,
. , ,
, .
Solaris !
shutdown halt.
UNIX shutdown. UNIX . shutdown, , ,
, , , . Shut Down .
Solaris shutdown g ,
.
shutdown g 0
shutdown Solaris 0. , , 1.
shutdown g 0 -i 0
. . ,
root
Ctrl-D . " " 10.
, - ,
halt, .
, poweroff.
reboot.
UNIX (
shutdown halt) , ,
, .
, fsck ( scandisk Windows).

31
shutdown, reboot, poweroff root.


(login) (password). , , - .
" " , , .
.
, "" (shell).
. Solaris - .
Solaris CDE, GNOME KDE.
1 12
" Solaris 10".
logout, Exit , CDE, " "
GNOME. Ctrl-D
exit ( Ctrl-D).
, exit Ctrl-D , ,
, , .



,
. , GNOME
All Applications -> -> GNOME, gedit. gedit .

vi
, UNIX
. : vi
1976 (Bill Joy), - Sun
Microsystems. vi .. - gnome-terminal, xterm, dtterm putty (
Windows).
vi . . ,
, . vi
. vi
. vi . , . ,
, .
. : !
Vi , - - ed. - , , .

32
a, i o.
. , , ,
, , . -
, , <Esc>, . <Esc> .
(,
PgUp, PgDn, Home, End ..) , ,
, " ", vi <Esc>, [B. , , ,
. ,
. , ,
,
.

(, PgUp, PgDn, Home, End), <Ctrl-F> (forward, ), <Ctrl-B>
(backward, ). , -"" . h,j,k,l :

, ; hjkl , , -.
3.1 vi.
vi (man vi) (Arnold Robbins) "Vi Pocket
Reference"1) "Learning the vi Editor".
, ,
ed. vi .
, , , . .
vi, , , , ,
. ,
15dd
, .
3.1. vi

a

, ,

33
o

dd

yy

rn

- "" (, ,

),
Ctrl-G

( )

:s// /[g]

ZZ

:q

:q!

:w

:wq

:w!

, (,
root)

:w

; ,

<Esc>

.
/, .. "", .
. . , vi
. :s//__/. , . g.
, . , , . g, , .
ed n,m,
n,m , . , . :

34
:23,33s/black/white/g
, black white c 23 33 . , , "." "$",
. "." , "$"
. ,
:.,.+7s/black/white/g
black white , . ,
.
.,.+7

1,1+7
..
1,8

:.,$s/yellow/blue/g
yellow blue , .
.
d.
:1,.d
.
, ,
:4d
.
,

:56
56- .



.. , ( , , ) : ,
, , , ..

35
, ,
KDevelop, Sun Studio, NetBeans, IntelliJ .
C, C++ FORTRAN Linux Solaris Sun Studio , Sun Microsystems. Sun Studio , . , , , , , .
Sun Studio Solaris Express Developer Edition
sun.com.
Sun Studio Solaris ,
; , vi, gcc mdb.


Solaris
GIMP, GNOME , , eog ("eye
of GNOME" GNOME). GIMP
(/usr/bin/gimp),
Adobe Photoshop. GIMP ,
UNIX.


Solaris Mozilla Thunderbird
Mozilla Firefox .
OpenSolaris, , mozilla.org.
, flash (Adobe Flash Player plug-in)
- .


RealPlayer. Rhytmbox Totem, mplayer. .

1)

1st Edition January 1999. Series: Pocket References. ISBN: 1565924975 O'Reilly Assosiates.

36

4. : Solaris
Solaris 10 Solaris Express;
OpenSolaris 2008.05, , 2008 , ; , ZFS,
, , .
Solaris. , . Solaris , -. Solaris (, ),
, . OpenSolaris
2008 .
Solaris SPARC x86 . OpenSolaris 2008.05 x86, SPARC
OpenSolaris.


Solaris SPARC x86 (32- 64-,
AMD, VIA Intel). 4.1 .
,
,
. , ( , ,
, , , ) 1 .
, Solaris
, Solaris .
, (Hardware Compatibility List)
http://www.intuit.ru/department/os/intadmsolaris10/4/www.sun.com/bigadmin/hcl, , Sun Device Detection Tool Installation Check Tool.
x86, SPARC Sun Microsystems Solaris .
SPARC http://sun.com/solaris.
4.1. Solaris
x86

SPARC

AMD, Intel, VIA

SPARC

256 , 512

128 , 512

2 Gb , 6 Gb

2 Gb , 6 Gb

Sun Device Detection Tool (SDD Tool),


http://www.sun.com/bigadmin/hcl/hcts/device_detect.html.
SDD Tool jnlp, ,

37
Solaris. ,
OpenSolaris, ,
.
Sun Device Detection Tool JRE (Java Runtime Environment)
1.4 javaws (Java Web Start). SDD Tool .
Installation Check Tool
http://www.sun.com/bigadmin/hcl/hcts/install_check.html
Sun Device Detection Tool , Java. -
.
(CD USB-),
. Installation Chec Tool ,
,
, .
Solaris 10 x86
- Solaris x86.
-, "" Solaris . .
, , DNS NIS. ,
Solaris .
, -. ,
. (Windows, GNU/Linux). : ( , ). ( ,
), ( ) ,
. , .


Solaris 10 ; Solaris 9 Russian UTF-8. ,
, , : UTF-8 .

<Ctrl->. Sun Solaris 10 <AltGraph> ( <>).
Solaris 10 , CP-866.
,
/etc/default/init . :
TZ=Europe/Moscow
CMASK=022

38
LC_COLLATE=ru_RU.UTF-8
LC_CTYPE=ru_RU.UTF-8
LC_MESSAGES=C
LC_MONETARY=ru_RU.UTF-8
LC_NUMERIC=ru_RU.UTF-8
LC_TIME=ru_RU.UTF-8


, .
, , docs.sun.com, developers.sun.ru (
10).
768 , ,
. , Solaris , (, ),
.

Solaris
Solaris , Solaris Express Developer Edition Solaris 10 ( ) Solaris Express (). , Solaris 10 Solaris Express. Solaris Express
Solaris 10 .
F2 () F3 () ( , , -
) <Esc-2> <Esc-3>.
-. (us_EN). ,
, , .
, . 2008 .
, " ",
. ,
. , : DHCP, ,
IP-, .
NIS, NIS+, DNS LDAP.
,
/etc/nsswitch.conf (. 1 " Solaris 10") , 3 " Solaris
10".
NFS. NFS, , . NFS 7
" Solaris 10".
.

39
root.
" " ( , sys-unconfig, ). .
Standard Flash. Standard , Flash
-. , .
(
), ( ,
Solaris ). Solaris : ANSI 1251, ISO8859-5, KOI8-R UTF-8.
English,
. ? .
,
, , Solaris.


,
Solaris, . , SUNW,
, SUNWdtab.
(software package) , -
( , ). , SUNWesu , lastcomm, banner ..
(software clusters). , SUNWC, , SUNWCdtusr SUNWdtezt,
SUNWdthe, SUNWdthev, SUNWdthez, SUNWdticn, SUNWdtim ,
CDE.
(software groups), :

Reduced Networking Software Group (SUNWCrnet) Solaris 10 Reduced


Networking Meta Cluster
Core (SUNWCreq)
End User (SUNWCuser)
Developer (SUNWCprog)
Entire distribution (SUNWCall)
Entire distribution plus OEM (SUNWCxall)
,
.
Reduced Networking Solaris , Solaris 10 ( ). , ,
153 . 2 (
, swap, ).
Core .

40
Core, 700 . 2 . , ,
. Core ,
( ). ,
Core ,
(, ).
End User Core , , , CDE GNOME .
Developer End User , (include files) . !
Solaris 9 ! Solaris 10
gcc , Sun Studio .
Entire distribution Solaris,
. , , , ?
Entire distribution plus OEM Entire distribution OEM-. SPARC.
? (
, ), Entire
Distribution ,
. , ,
, , 1).
, () -
"" . , () ,
.
, , , , , ,
" " ", , ".
" " (Software Group), "" (metacluster), " "
(distribution), " " (installation cluster) Solaris. .
, , , , , "cluster" , .
,
, . .
, Solaris,
/var/sadm/system/admin/CLUSTER:
cat /var/sadm/system/admin/CLUSTER
CLUSTER=SUNWCXall

41
, . , ,
.
, ,
, Entire Distribution and OEM,
. ?
, - , . . OpenSolaris,
. -
pkg.

Solaris 10 http://docs.sun.com/app/docs/doc/8196394/6n8dmvnku?l=ru&a=view
. ,
. Solaris 10 Solaris 10 update 5 Solaris Express
ZFS,
Solaris
UNIX.
Solaris . ,
. - Solaris,
Solaris .
Solaris .
Solaris. (HDD extended partition).
Solaris . .
, 2 UNIX ,
.
, Solaris /opt
, , . /export/home , .
, . , . , " " ("begin installation", "install") . "Entire
Distribution" 40
.

Solaris 10 SPARC
SPARC x86,
,
( )
( ).
.

42
ok
ok boot cdrom text

ok boot cdrom nowin


SPARC
x86, Solaris ,
, , Sun Microsystems.

Solaris 10 JumpStart
Custom JumpStart Installation Solaris. Solaris
.
( )
. Solaris - ,
Solaris Solaris Web Start
Installation Program suninstall.
-
.
Custom JumpStart ,
( ,
Solaris ),
.
Custom JumpStart Installation ,
. ( , Custom JumpStart Installation)
http://docs-pdf.sun.com/816-7171/816-7171.pdf ( Solaris 9)
http://docs.sun.com/app/docs/doc/817-0544?a=load ( Solaris 10).
.


, , (SPARC x86), ( Entire Distribution ) . ,
, sysidcfg. , rules , ,
, ,
.
,
, , .
- , rules () .

sysidcfg.

43
:
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo

"system_locale=en_US" > sysidcfg


"timezone=US/Pacific" >> sysidcfg
"network_interface=primary {hostname=YOUR HOSTNAME" >> sysidcfg
" ip_address=YOUR HOSTS IP" >> sysidcfg
" netmask=255.255.255.0" >> sysidcfg
" protocol_ipv6=no}" >> sysidcfg
"terminal=vt100" >> sysidcfg
"security_policy=NONE" >> sysidcfg
"root_password=PASSWORD FROM SHADOW FILE" >> sysidcfg
"name_service=NONE" >> sysidcfg
"timeserver=localhost" >> sysidcfg

chmod 777 sysidcfg


sysidcfg .




Solaris . (
, DVD), , . , CD-ROM,
DVD. , Solaris ,
SPARC, Intel (x86).
2):
1.

SPARC (,
/cdrom );
2.

3.
mkdir p /export/install/sparc
4.
:
5.
cd /cdrom/Solaris_9/Tools
6.
./setup_install_server /export/install/sparc
7.
/cdrom, - ,
/cdrom
8.
:
9.
cd /cdrom/Solaris_9/Tools
10.
./add_to_install_server /export/install/sparc
11.
Solaris SPARC 9 Platform Edition Language CD_ROM
:
12.
cd /cdrom/Solaris_9/Tools
13.
./add_to_install_server /export/install/sparc
14.
Intel (,
/cdrom );
15.
x86
16.
mkdir p /export/install/intel
17.
:
18.
cd /cdrom/Solaris_9/Tools
19.
./setup_install_server /export/install/intel
20.
/cdrom, - ,
/cdrom
21.
:
22.
cd /cdrom/Solaris_9/Tools
23.
./add_to_install_server /export/install/intel
24.
Solaris INTEL 9 Platform Edition Language CD_ROM

44
:
25.
cd /cdrom/Solaris_9/Tools
26.
./add_to_install_server /export/install/intel
DVD :
1.
2.
3.
4.
5.
6.

DVD- /dvd

mkdir p /export/install/intel
cd /dvd/Solaris_9/Tools
./setup_install_server /export/install/intel
SPARC /export/install/sparc
- SPARC.
/jumpstart
/jumpstart,
, Custom JumpStart. ,
:
cp r /export/install/sparc/Solaris_9/Misc/jumpstart_sample /jumpstart
,
/etc/dfs/dfstab:
share F nfs ro,anon=0 /jumpstart
/etc/dfs/dfstab
shareall
, , . , eng_prof mark_prof,
SPARC x86 .
/jumpstart:
cat /jumpstart/eng_prof
install_type initial_install
system_type standalone
partitioning default
cluster SUNWCprog
filesystem any 512 swap
, , .
, , , , ( Developer System Support). , 512 .
cat /jumpstart/mark_prof
install_type initial_install
system_type standalone
partitioning default
cluster SUNWCuser
package SUNWaudio
, , . cluster , , , End User,

45
package .
rules
suninstall Custom JumpStart rules
, - .
rules /jumpstart. suninstall,
.
IP- , ,
, . . 4.2.
4.2. rules

arch
arch
sparc
processor_type ,
uname a
sparc i386
disksize

actual_disk_name
size_range

actual_disk_name
cxtydz, c0t3d0
rootdisk. rootdisk ,

( Factory
JumpStart), c0t3d0s0,

disksize
c0t3d0

size_range ,

250-300

domainname actual_domain_name

NIS, domainname
, - ENGNR
,
domainname

hostaddress actual_IP_address

IP-

hostaddress
192.168.1.3
hostaname
synny.pu.ru

hostname

actual_host_name

,
uname -n

installed

slice version

karch

actual_platform_group

slice cwtxdysz, installed


c0t3d0s3, rootdisk. version c0t3d0s1
Solaris_9
upgrade.
Solaris 2.1 . any
SunOS Solaris.
karch i86pc
sun4m, sun4u,
i86pc, prep. Solaris
9 Sun HardwarePlatform Guide. ,
arch
-k uname -m

memsize

physical_mem

( ),
( ) -

memsize 64-128

46
prtconf
( )
model

actual_platform_name

network

network_num

osname

Solaris_x

. - SUNW,Sun_4_50
Solaris 9 Sun
Hardware Platform Guide

uname -i
, ,
, - network
192.168.3.0
, IP- , IP DHCP .
osname
Solaris_8
Solaris

, ,
: SPARC 192.168.1.0, x86 192.168.2.0.
rules :
network 192.168.1.0 - eng_prof
network 192.168.2.0 - mark_prof
rules, check:
cd /jumpstart
./check
check , rules.ok.


, , add_install_client:
cd /export/install/sparc/Solaris_9/Tools
./add_install_client c servername:/jumpstart hostname sun4u
(servername) jumpstart,
NFS, , ,
/ ( sun4u Sun Ultra-5).
!
, x86:
cd /export/install/intel/Solaris_9/Tools
./add_install_client c servername:/jumpstart hostname i86pc
,

cd /export/install/intel/Solaris_9/Tools
./add_install_client d s bootserver:/export/install/intel \
-c installserver:/jumpstart SUNW.i86pc i86pc

47
d , DHCP, -s
, -c jumpstart (
).
SUNW.i86pc DHCP x86, i86pc
x86.


SPARC OpenBoot
boot net install
Solaris . : ( , ),
, - .
x86 :
1.
2.
3.

- DVD- ;
( BIOS );
.
: http://soldc.sun.com/support/drivers/dca_diskettes.
. ,
x86 Custom
JumpStart. , :
b install [url:ask] [dhcp] [nowin]
[] . . SPARC boot install .
url JumpStart.
:

: file://jumpstart_dir_path/compressed_config_file
NFS: nfs://server_name:IP_address/jumpstart_dir_path/compressed_config
_file

-:
http://server_name:IP_address/jumpstart_dir_path/compressed_config_file&proxy_info
sysidcfg .tar, IP , : http://131.141.2.32/jumpstart/config.tar
-,
-, IP- -:
http://www.jumpstart.company.com/jumpstart/config.tar&132.14.231.1
132.14.231.1 IP- -.

48
ask , ;
Enter, ,
.
dhcp DHCP; , /etc/bootparams NIS bootparams.
nowin , ,
.

(upgrade)
-
Upgrade .
" ", , ,
.

OpenSolaris
IPS (Image Packaging System).
2)
Solaris 9, Solaris 10 , DVD.
1)

49

5. :
?
Solaris .
. staff , ,
Solaris. (, sendmail Oracle) .
, ( ) .
staff .
useradd
other, . 1.
3.

. " ".
,
, . ,
, ,
pop3 imap4. ,
, .
/etc/passwd
: ? , - ? /etc/passwd,
, pop3. , , . , oldlamer, ?
, ,
. , , , .
.
/etc/group, . - , /etc/group,
, ,
:
sys::3:root,bin,adm,skomorox

UNIX
UNIX : , ,
.
UNIX
, , , (ACL)
,

50
TACACS RADIUS,
(pluggable authentication modules PAM). TACACS RADIUS ,
PAM 8 "
Solaris 10".
, ,
, . UNIX - : ,
.
, ,
.

, .
, .
, , ,
, , . , .


. UNIX.
, , ,
. , . ,
,
(UID), .
: , .
ivan UID, 1000, ivan UID,
2001,
"" , UID 1000,
, UID, .
UNIX , ,
, .
, , , . ,
login. root (..
root). login , .
, . "",
" ", " ", " " .. , UNIX UID (user identificator),
, GID (group identificator), , .
, , . ,
, . , , . ,
, . ,

51
.


,
. . , "
".
world (""),
" ". , , , " ".


, . , ,
, UID (user ID)
GID (group ID) . , UID
GID /etc/passwd /etc/group . ""
, "" .

/etc/passwd, /etc/shadow, /etc/group


/etc/passwd /etc/group Solaris , UNIX,
/etc/shadow System V. (
cat more):


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:/:
col:x:100:1::/home/col:/bin/sh
temp:x:101:1::/home/temp:/bin/sh
qaz:x:102:1::/home/qaz:/bin/sh
Termos:x:103:1::/home/Termos:/usr/bin/bash
,
. .
. .
Solaris 2 8 . Solaris , UNIX

52
() .
. . , ,
/etc/shadow NP.
, UID.
, GID.
( GECOS) .
( ) , ,
.
. . , (, ftpd) , , , "", .. .
, . (, ftpd) ,
, ,
. /etc/shells
, .
/etc/shells . , - , , ftpd.
GECOS .
GECOS , : .
, , ikonst34.
? ?
34? ,
, , username,
.
(, , , ) , . ,
, . :

, ( )
, bin,
, ;
, ,
, ;
;
(, , ..).
.
, . , - , , . ?
/etc/passwd?

53
, .
, /etc/passwd:
root:*:0:0:Root Michael Kruglov, room 601, 89119119111:/root:/bin/bash
ftp:*:23:1:FTP Admin, Andrei Nezvanyi, 9733333:/home/ftp:/bin/bash
apache:*:404:40:Web Master, Elena Osatanenko,1001010:/usr/local/httpd:/bin/sh
, GECOS: .
General Electric ,
GECOS (General Electric Comprehensive Operating System).
UNIX . , GECOS.
cat /etc/shadow
root::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::::::
col:9NvfZSaIQgcQk:12435::::::
temp:*LK*:::::::
qaz:v.srD227fHRx2:12448::::::
Termos:o3HzHXFopdwbU:::::::
. . :

;
, *LK* ,
(locked), NP (no password);
1 1970 ;
,
;
, ;
, ;
, ;
,
; ;
, ;
;
.
/etc/shadow Solaris, System V -

54
UNIX, , Linux.
/etc/shadow ,
.
/etc/shadow , smc, usermod, useradd, passwd. , root /etc/shadow
.


.
. ,
; . 11. ,
(.Xsession ), (.elm, .forward ), (.history, .bash_history) . , "." ().
,
ls -a
- . Solaris /etc/skel ( skeleton , .. ).
/etc/skel . , , . .
/etc/skel ,
.
/etc/skel .
, , , , ,
.


, , /etc/group. , /etc/passwd
/etc/group (, LDAP . 8 " Solaris 10").
cat /etc/group
root::0:root
other::1:
bin::2:root,bin,daemon
sys::3:root,bin,sys,adm
adm::4:root,adm,daemon
uucp::5:root,uucp
mail::6:root
tty::7:root,adm
lp::8:root,lp,adm
nuucp::9:root,nuucp
staff::10:
daemon::12:root,daemon

55
sysadmin::14:
smmsp::25:smmsp
nobody::60001:
noaccess::60002:
nogroup::65534:
.
; - ,
, . , -
- passwd, /etc/shadow
/etc/group. Solaris newgrp.
. , ,
, newgrp .
(GID). ,
. 0 99 60001 60002 . 100 60000 .
;
. Solaris ,
15 .


smc users-admin
useradd, usermod, userdel, groupadd,
groupmod, groupdel .

Solaris Management Console


Solaris 9 ( 2002 )
admintool (. 5.1). Solaris 8 admintool .
admintool .
Solaris Management Console (SMC) , . /usr/bin/users-admin.
GNOME "-> " (. 5.2).
, smc (. 5.2).
(. 5.3), , , /etc/passwd, /etc/shadow /etc/group.
, "Add user with Wizard"
(. 5.3).

56

. 5.1. admintool
smc . Solaris
( ) useradd,
usermod, userdel.

. 5.2. users-admin

57

. 5.3. Solaris Management Console

58

. 5.4. Solaris Management Console (smc)

useradd
useradd:
useradd
other, . 1.
Solaris
/etc/passwd, /etc/shadow /etc/user_attr. .
. Solaris,
UNIX . , , , ,
,
. 9
" Solaris 10",
/etc/user_attr man user_attr.
useradd /etc/passwd
/etc/shadow. , G

59
/etc/group , . m , .
,
passwd.
8 , , , , . UNIX, Solaris , . , .
,
:

-b base_dir
, ; ,
d;

-c comment
GECOS ; , ;

-d dir
; /home ,
( lena /home/lena);

-D
, , ,
.
, , 5.1.
5.1.

other (GID =1)

/home

/bin/sh

-e expire
; , man
3C getdate; ,
; ;

-f inactive
, ; ; -

60
, , " ";

-g group
, other; - . man useradd;

-k skel_dir
- ; , - . /etc/skel;

-m
; ,
, (
7);

-o
uid, uid ; root. ,
root ,
. FreeBSD
toor (root ). , , , /bin/sh, , /usr/local/bin/bash. root , ..
, /, /usr ;

-s shell
,
; ;

-u uid
UID.
, , 13 " Solaris 10".
usermod. , .
, ,
usermod :
usermod ivan
UX: usermod: ERROR: Invalid syntax.
usage: usermod -u uid [-o] | -g group | -G group[[,group]...] |
-d dir [-m] | -s shell | -c comment |
-l new_logname | -f inactive | -e expire
-A authorization [, authorization ...] |
-P profile [, profile ...] | -R role [, role ...]
login

61
userdel.
groupadd, groupdel;
groupmod.

1.

lover useradd.
lover? /etc/group? , .
2.
lover admintool.
3.
hardworker staff admintool.
? , , , .
4.
other,
staff. - /etc/group?
/etc/shadow. - .
/etc/shadow? /etc/passwd?

62

6. :
" "
" " .
1. -, , ,
. , ,
" FAT32", " " " ".
2. -, , .
3. -, UNIX-, , , ,
(,
mount ).
, , , , , .

UNIX
UNIX 2004 , , ""
.
( , .. fdisk, format
).
, , -.

.
,
- .

, . , ,
, , . , , ,
.
, ,
, , . , Logical Volume Manager (LVM) Linux. , LVM ,
.

63
2004 , ,
,
( " ").
, ,
UNIX.
, , ,
! , (, , )
.
,
(, 250 500- , !)
ZFS, Sun Microsystems 2004 ; Solaris 10. 2008
ZFS FreeBSD Mac OS X Leopard.
UFS, ,
, UFS.
UFS ZFS .

Solaris
Solaris .
, . /dev .
UNIX. Solaris /dev "" , /devices. . "
/devices". 7 "".
:

;
.

ls :
ls -l /devices/pseudo/
...
crw-rw-rw- 1 root sys 26, 0 17 10:56 ptsl@0:ttyp0
crw-rw-rw- 1 root sys 26, 1 17 10:56 ptsl@0:ttyp1
crw-rw-rw- 1 root sys 26, 2 17 10:56 ptsl@0:ttyp2
crw-rw-rw- 1 root sys 26, 3 17 10:56 ptsl@0:ttyp3
...
ls -l /devices/pci@0,0/pci-ide@7,1/ide@0
...
brw-r----- 1 root sys 102, 0 17 10:56 cmdk@0,0:a
crw-r----- 1 root sys 102, 0 17 10:56 cmdk@0,0:a,raw
brw-r----- 1 root sys 102, 1 24 21:19 cmdk@0,0:b
crw-r----- 1 root sys 102, 1 17 10:56 cmdk@0,0:b,raw
...

64
, , ,
. ,
ls major , ,
minor . , . . ls major .
major . Major
add_drv. major
/etc/name_to_major.
Solaris : , .
, /dev.
, /devices.
,
.
.

Solaris
, ,
"", "", "", "" . , .
( Solaris slices).
. , :
1. , ;
2. ,
;
3. ,
.


Solaris ,
0 7.
/dev/dsk.
. . Solaris
: , SCSI ID (target number),
(LUN logical unit number) . IDE, SCSI ID
master/slave (, 0/1). SCSI
IDE 0. . 6.1.

65

. 6.1.
, SCSI /dev/dsk/c0t0d0s0
SCSI (c0), SCSI ID 0 (t0), 0 SCSI (d0),
(s0).
. 6.2, ,
IDE-, IDE ( ,
x86 , IDE),
( SCSI ID, . 6.1), ( d0)
( s0 .., SCSI ).

66
. 6.2. IDE-
IDE SPARC. 86 , IDE, . , fdisk, cNdMpK, , d , p fdisk. fdisk (slices),
fdisk solaris. fdisk ,
Master Boot Record (MBR), fdisk .
Solaris IDE- x86 -
Solaris fdisk ( 20 ) -
, ,
. fdisk FAT, Solaris.
(slices). SPARC,
SCSI ID: c0d0s0, c0d0s1 ..
6.1. SCSI ID IDE- IDE
IDE

IDE

primary master

primary slave

secondary master

secondary slave

/dev/dsk (raw disk)


/dev/rdsk:
# ls /dev/dsk
c0d0p0 c0d0s1
c0d0p1 c0d0s10
c0d0p2 c0d0s11
c0d0p3 c0d0s12
c0d0p4 c0d0s13
c0d0s0 c0d0s14
# ls /dev/rdsk
c0d0p0 c0d0s1
c0d0p1 c0d0s10
c0d0p2 c0d0s11
c0d0p3 c0d0s12
c0d0p4 c0d0s13
c0d0s0 c0d0s14

c0d0s15
c0d0s2
c0d0s3
c0d0s4
c0d0s5
c0d0s6

c0d0s7
c0d0s8
c0d0s9
c1t0d0p0
c1t0d0p1
c1t0d0p2

c1t0d0p3
c1t0d0p4
c1t0d0s0
c1t0d0s1
c1t0d0s10
c1t0d0s11

c1t0d0s12
c1t0d0s13
c1t0d0s14
c1t0d0s15
c1t0d0s2
c1t0d0s3

c1t0d0s4
c1t0d0s5
c1t0d0s6
c1t0d0s7
c1t0d0s8
c1t0d0s9

c0d0s15
c0d0s2
c0d0s3
c0d0s4
c0d0s5
c0d0s6

c0d0s7
c0d0s8
c0d0s9
c1t0d0p0
c1t0d0p1
c1t0d0p2

c1t0d0p3
c1t0d0p4
c1t0d0s0
c1t0d0s1
c1t0d0s10
c1t0d0s11

c1t0d0s12
c1t0d0s13
c1t0d0s14
c1t0d0s15
c1t0d0s2
c1t0d0s3

c1t0d0s4
c1t0d0s5
c1t0d0s6
c1t0d0s7
c1t0d0s8
c1t0d0s9

Solaris , 2 (slice 2) , .. , . ,
7 , ( 2) . 2 :
. , , 2,
: , ..
, .
, SCSI- SCSI ID, 6, , ( ) /dev/dsk/c0t6d0s0
/dev/dsk/c0t6d0s7, /devices/pci@1f,0/pci@1,1/scsi@6/sd@0,0:a
/devices/pci@1f,0/pci@1,1/scsi@6/sd@0,0:g.
sd6.

CD- DVD-

67
, , ,
prtconf cdrecord ( Solaris, ). ,
, , ,
/dev/dsk/c1t0d0s2,
1,0,0 cdrecord.
/opt/schily/bin/cdrecord -scanbus
Cdrecord-ProDVD-ProBD-Clone 2.01.01a40 (i386-pc-solaris2.11)
Copyright (C) 1995-2008 Jrg Schilling
Warning: Using USCSI interface.
Using libscg version 'schily-0.9'.
scsibus1:
1,0,0 100) 'MATSHITA' 'DVD-RAM UJ-85JS ' 'F100' Removable CD-ROM
1,1,0 101) *
1,2,0 102) *
1,3,0 103) *
1,4,0 104) *
1,5,0 105) *
1,6,0 106) *
1,7,0 107) *

/devices
/devices .
. /devices
. ,
, :
, (SCSI, IDE),
- . , x86
:
./pseudo
./isa
./isa/fdc@1,3f0
./isa/i8042@1,60
./pci@0,0
./pci@0,0/pci8086,7191@1
./pci@0,0/pci-ide@2,1/ide@0
./pci@0,0/pci-ide@2,1/ide@1
./pci@0,0/pci-ide@2,1
/devices Solaris, IBM
ThinkPad 390X.
, Solaris , /etc/path_to_inst.
/etc/path_to_inst (, minor ). , /etc/path_to_inst.
,
add_drv(1M) drvconfig(1M).
. prtconf:
prtconf

68
, ,
prtconf | grep v not
prtconf , "not", ,
"device not attached".
2 "
Solaris 10".

, POSIX
: , ,
POSIX ( IEEE Std 1003.1,
2004 Edition) ,
UNIX ( POSIX) : , .
, ; ,
( ), , .
: , ZFS , , , , UFS , .

. 6.3. ()

69

. 6.4.
, POSIX,
. ,
. "" mount.
. 6.3, , , , . , , . ,
, DVD- .
, "", .. , . " " ( . 6.3 ). , (
) , , , (. 6.4).
, ( ).
. (
- , ).
, (
) .
.
. ,
, .
, , mount,
UNIX . FreeBSD, Linux Solaris.
, ZFS :
, ,
, . , /var
, /etc , /.

70
, mount UNIX:
FreeBSD:
mount
/dev/ad0s1a on / (ufs, local)
/dev/ad0s1e on /var (ufs, local, soft-updates)
/dev/ad0s1f on /cache (ufs, local, soft-updates)
/dev/ad0s1g on /usr (ufs, local, soft-updates)
procfs on /proc (procfs, local)
Linux:
mount
/dev/hda1 on / type ext2 (rw)
none on /proc type proc (rw)
/dev/hda5 on /usr type ext2 (rw)
/dev/hda6 on /var type ext2 (rw)
Solaris:
/ on /dev/dsk/c0d0s0 read/write/setuid/devices/intr/largefiles/logging/
xattr/onerror=panic/dev=1980000 on . 14 23:48:38 2008
/devices on /devices read/write/setuid/devices/dev=4380000 on .
14 23:48:21 2008
/dev on /dev read/write/setuid/devices/dev=43c0000 on . 14
23:48:21 2008
/system/contract on ctfs read/write/setuid/devices/dev=4400001 on
. 14 23:48:21 2008
/proc on proc read/write/setuid/devices/dev=4440000 on . 14
23:48:21 2008
/etc/mnttab on mnttab read/write/setuid/devices/dev=4480001 on .
14 23:48:21 2008
/etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=44c0001 on
. 14 23:48:21 2008
/system/object on objfs read/write/setuid/devices/dev=4500001 on
. 14 23:48:21 2008
/usr on /dev/dsk/c0d0s6 read/write/setuid/devices/intr/largefiles/
logging/xattr/onerror=panic/dev=1980006 on . 14 23:48:38 2008
/lib/libc.so.1 on /usr/lib/libc/libc_hwcap2.so.1 read/write/setuid/
devices/dev=1980006 on . 14 23:48:35 2008
/dev/fd on fd read/write/setuid/devices/dev=4680001 on . 14
23:48:38 2008
/var on /dev/dsk/c0d0s1 read/write/setuid/devices/intr/largefiles/
logging/xattr/onerror=panic/dev=1980001 on . 14 23:48:39 2008
/tmp on swap read/write/setuid/devices/xattr/dev=44c0002 on . 14
23:48:39 2008
/var/run on swap read/write/setuid/devices/xattr/dev=44c0003 on .
14 23:48:39 2008
/opt on /dev/dsk/c0d0s5 read/write/setuid/devices/intr/largefiles/
logging/xattr/onerror=panic/dev=1980005 on . 14 23:48:44 2008
/export/home on /dev/dsk/c0d0s7 read/write/setuid/devices/intr/
largefiles/logging/xattr/onerror=panic/dev=1980007 on . 14
23:48:44 2008
/home/filip on /export/home/filip read/write/setuid/devices/dev=1980007
on . 15 14:06:53 2008
Solaris , Linux FreeBSD, , ,
mount . , :

71
mount -p | grep dsk | awk '{print $3' on '$1' ('$7')'}'
/ on /dev/dsk/c0d0s0 (rw,intr,largefiles,logging,xattr,onerror=panic)
/usr on /dev/dsk/c0d0s6 (rw,intr,largefiles,logging,xattr,onerror=panic)
/var on /dev/dsk/c0d0s1 (rw,intr,largefiles,logging,xattr,onerror=panic)
/opt on /dev/dsk/c0d0s5 (rw,intr,largefiles,logging,xattr,onerror=panic)
/export/home on /dev/dsk/c0d0s7 (rw,intr,largefiles,logging,xattr,
onerror=panic)


init -
, . /etc/vfstab1). /etc/vfstab :
#device
#to mount
#
fd
/proc
/dev/dsk/c0d0s1
/dev/dsk/c0d0s0
/dev/dsk/c0d0p0:boot
/dev/dsk/c0d0s7
swap

device
to fsck

mount
point

FS
type

fsck mount
mount
pass at boot options

/dev/rdsk/c0d0s0
/dev/rdsk/c0d0s7
-

/dev/fd
/proc
/
/boot
/export/home
/tmp

fd
proc
swap
ufs
pcfs
ufs
tmpfs

1
2
-

no
no
no
no
no
yes
yes

, mount at boot yes,


. ,
,
.
root.
mount:
mount device mount_point

mount /dev/dsk/c0d1s0 /test


, /etc/vfstab,
, . "" mount
, /etc/vfstab.
,
UFS.
ZFS ,
, ,
ZFS .
, , , , .
: ,
.
. ,
- - . " , " , ,

72
(. fuser(1M)).
- , . ,
. :
/usr , /usr/admin ,
, /usr.
umount:
umount mount_point

umount /mnt


, - Solaris vold (Volume Management daemon). , -, , , , zip- .
, vold volcheck, ,
, rmmount . rmmount
, , , .
man rmmount
rmmount /etc/rmmount.conf.
rmmount . ,
volrmmount
. man volrmmount.
vold , ,
GNOME.

, . ZFS uber-, , ZFS ZFS. UFS



, , UNIX, . UFS uber-
ZFS 7 8 .


, . , . .
: ,
, , , , ,

73
. , ,
, , . UFS 7.


UNIX'e . : , "/" (), . .. . ("" ) ,
. , , . , :, D: E:,
K:, R:, Y: , UNIX'. UNIX-, .
, , ,
, - ... , ?


("") Solaris UFS (Unix file system) ZFS
(Zettabyte File System). Solaris 10 14 ,
. 6.2. , Lustre,
CFS, Inc. ( Cluster File System). CFS Sun
Microsystems 2007 .
6.2. , Solaris 10

UFS

Solaris

ZFS

,
Solaris

smbfs

,

Windows, SMB CIFS

VxFS

Veritas Corp ( )

pcfs

MSDOS FAT FAT32

hsfs

High Sierra ( CD-ROM);


- ISO9660

tmpfs

nfs


(
Windows)

cachefs


NFS

autofs

specfs

/dev

procfs

/proc

sockfs

""

74
fifos

(pipe API)

UNIX .

. 1985 Sun Microsystems
.
,
.
: , fopen() chmod(),
(cp, mv, rm ), , , .. ,
POSIX- .
.
1985 Sun Berkeley fast filesystem (FFS).
,
UFS, FFS
. .
6.5.

. 6.5. Solaris
UFS 1985 . ,
Solaris 9 8/03 , UFS
Solaris 1 . ZFS, ZFS .
UFS, VxFS ZFS, Solaris, , . . 6.3 ,

, .
6.3. UFS, VxFS QFS

75

UFS

(block)

VxFS

(extent)

ZFS

(block)

,
( ,
) ,
.
UFS 512 8192 ,
Solaris 8192 .
Solaris (logging) UFS VxFS. . (.. ) - (,
),
, . ext3fs Linux, reiserfs FreeBSD Linux
.

. ""
1 , .
, ,
, .
UNIX?
1991 UFS , UFS2,
FreeBSD 5.0. Solaris
UFS 1 .


UNIX : ,
"/". . , .
6.4.
/bin /usr/bin: .
Solaris /exports,
,
. /opt,
( optional, ), Solaris, UNIX.
/tmp Solaris tmpfs. . , tmpfs , , . , tmpfs . ,
, tmpfs, , . , tmpfs
.

76
, tmpfs
. /tmp - .
tmpfs , .. . tmpfs :
.
, tmpfs
, /tmp , . ,
,
tmpfs .
/tmp
.
6.4. Solaris
lrwxrwxrwx

root root

drwxr-xr-x

root root

16384 1

drwxr-xr-x

root root

512

29 14:42 cdrom

drwxr-xr-x

14 root sys

3584

16 15:49 dev

drwxr-xr-x

512

22 15:03 devices

drwxr-xr-x

51 root sys

3584

16 15:49 etc

drwxr-xr-x

root other

512

28 17:38 exports

drwxr-xr-x

root nobody 512

28 16:57 floppy

dr-xr-xr-x

root root

16 15:49 home

drwxr-xr-x

12 root sys

512

22 14:56 kernel

drwx------

root root

8192

22 14:53 lost+found

drwxr-xr-x

root sys

512

22 14:54 mnt

drwxr-xr-x

root sys

512

22 15:48 opt

dr-xr-xr-x

63 root root

30912 16 15:52 proc

drwxr-xr-x

root sys

1024

22 15:51 sbin

drwxrwxrwt

root sys

368

16 15:50 tmp

drwxr-xr-x

34 root sys

1024

28 19:16 usr

drwxr-xr-x

32 root sys

512

22 15:57 var

root sys

22 14:54 bin -> ./usr/bin


1970

boot

Solaris tmpfs /tmp. -, /tmp .


: /tmp , /tmp tmpfs
!



ls l, :
#ls l /etc

77
lrwxrwxrwx
drwxr-xr-x
...
-rw-r--r--r--r--r--rw-r--r-drwxr-xr-x
prw-------rw-r--r--

1 root
2 root

root
bin

1
1
1
2
1
1

root
root
sys
sys
root
sys

root
root
root
root
root
root

4 22 14:59 aliases -> ./mail/aliases


512 22 15:53 apache
12
1825
2467
512
0
1087

23
22
22
22
16
23

08:35
15:42
15:02
14:54
15:50
08:33

defaultrouter
device.tab
devlink.tab
dfs
initpipe
inittab

ls /etc ,
. , .
UNIX ( -), (d), (c) (b) ,
(l), (p). Solaris
door (), .
,
, Windows-.
. . UNIX,
. ( ,
). , .
. , !
, ,
, . " ".
,
/dev , 6. (, ) , (, ) .
" ";
, Windows.
,
. p.
/etc , , . ( ), .
6.5 Solaris.
6.5. Solaris
d (directory)
D (door)
l (symbolic link)

78
b (block)
, (character)
p (FIFO, named pipe)
s
-


. ,
255 , (.. ) 1023 .
UNIX ,
. !
UNIX , Alliance alliance , . Solaris , UTF-8.
".", "-"
"_". (, , , ,
) , . , UNIX
( , ). ,/?*&^q-+|!
, .
UNIX'e " ", . , several.news.from.New.York UNIX
, index.html. UNIX ,
.
, , , , file:
file bad.words
English text
file /etc/magic.
, , - : (text), (C program), (executable file),
(data) ..
() . , , /usr/local/squid/etc/squid.conf.
: "/".
, , f.
"/" (), . (
, squid/etc/squid.conf), ,
, .
1023 .
, - , cd . ,

79
vi /usr/home/ivan/projects/united_states/texas/cowboys/horses/\
red/seats/sellers_training
:
cd /usr/home/ivan/projects/united_states
vi texas/cowboys/horses/red/seats/sellers_training
, : ( ) "\". , .
" ", " " " ".
"~" ()
. ,
cd ~anna/
anna, "~"
. , sh ~
, bash!


(regular) .
. -
. , - , , index.html,
. :
#cat > index.html
<HTML>
<BODY>
Hello everybody!
</BODY>
</HTML>
^D
#
touch, :
touch filename
, , ( ).
mkfile, : ,
mkfile 500m testfile
testfile 500 . mkfile Solaris (

80
Linux FreeBSD ).
cp:
cp file1 file2
mv:
mv file1 file2
mv :
mv file /usr/progs/useless/
, (, /usr/progs/useless/).
, .
- , ,
. , , , .
rm. UNIX (unerase), , , . UNIX " " (trash),
. "", , , . , Solaris CDE .
, ,
. , File Manager CDE. , CDE, ,
CDE. , rm xterm
( ), . rm CDE,
.
cat, more, less, pg, page.
cat more UNIX,
more . more
. more ,
, . "Enter"
, "" .
,
/
<Ctrl-B>, <Ctrl-F> ,
q .

"" "" (directory).


Windows- "" (folder).
UNIX "".
, :

81
, , . .
, . mkdir.
rmdir,
rm rf
,
rm rf /usr/local/squid/
/usr/local/squid, .
6.6. ls
l (long)

a (all)

, ,

i (i-nodes)
t (time)

mv, - cp Rp.
ls. ls , a. ,
. 6.6.
"." () ".." ( ).
"" , " " . .
ls , ,
"." (). -a
.
, , , "". , , .profile,
.xsession, .bashrc, .history .

cd
cd
cd ~.
pwd.

UNIX .
.

82
, . , ,
, , .
. .
ls -li file*
16852 -rw-r--r-16852 -rw-r--r--

2 root
2 root

root
root

0 Mar 20 16:11 file


0 Mar 20 16:11 file1

, ,
. , (
).
,
. , . , . , , ,
, . ,
.

, ,
. , ,
, . ,
( ), ,
, .
ln:
ln _ _
, ,
.
, UNIX. , ,
.
UNIX ,
. rm
.
find:
find _ inode ___
, . , " ",
,
:
ls l
lrwxrwxrwx 1 root root ... . qq ->/usr/home/qq
, , UNIX. (shortcut)
Windows. , -

83
, . ,
, " ", .
"" file not found, , .
ls l l, , , . , ls F. UNIX ls .

,
?
, ( ) fuser. , umount /export/home/filip Device busy. , - ""
/export/home/filip. ,
( , , ). , cd , , :
fuser /export/home/filip
/export/home/filip:
1464c
1457c
1216c
1206c
1080c
1078c
1077c
1032c
1026c
1012c
1010c
1004c
988c
957c
953c
950c
941c
939c
929c
916c
915c
910c
908c
896c
895c
894c
862c
861c
822c
729c
, .
fuser , . , , ,
, . , .


, : "" "".
, . ,
: " ", " ".
, , .
UNIX . . .
" ", , -
. ,
.
ls l ,
-rw-r--r--

1 root

root

433 Feb

2 10:30 acd.c

( ) ( -

84
). , ,
, " " .
, 12 .
: , , , ,
( other world). , :
rwx | rw- | r--|
u
g
o
, u (user), , g
, o . : (r, read), (w, write) (x, execute). ,
, , ,
" ". (. . 6.6,
rwxrw-r--):

. 6.6.
, , , , . , ,
. , , , , .
, ,
. : , ,
(, r-xrwxr--),
( r-x). , .
. , , , .

85
:

: rwxrw-r- : 111 110 100


: 7 6 4

-
755. , , rwxr-xr-x,
.
, .
, , , . ( , ..) , .
root:
.
, 8. :
su sg t r w x r w x r w x
(suid), (sgid) (t).
suid sgid .
, . . , suid,
, suid. Solaris, UNIX.
Solaris , .
, suid , . sgid,
-.
(sticky bit) UNIX , , ,
. sticky bit , , . sticky bit , , root'a, , , . UNIX
-, man sticky man
chmod.


6. , , . .
fsck.

ACL

86
UNIX
. , ,
? , , , :
chgrp _
chmod g=rw
? ,
, :
addgroup _
chgrp _
chmod g=rw
# /etc/group

vi /etc/group
, , ,
, , , ? , "" UNIX. , UNIX
(, Solaris FreeBSD) . , access control lists (ACLs).
,
UNIX. ACL , , , ,
.
ACL " ". setfacl.
, :
entry_type:[uid|gid]:perms
entry_type , uid gid , , perms .

(ACL)
, . 6.7.
6.7.
u[ser]::perms

g[roup]::perms

o[ther]:perms

m[ask]:perms

ACL

u[ser]:uid:perms

; uid
UID,

g[roup]:gid:perms ; gid GID,

87
,
. () . , r ,
, , .

(ACL)
, , , , . , , ,
.
6.8.
d[efault]:u[ser]::perms

d[efault]:g[roup]::perms

d[efault]:o[ther]:perms

d[efault]:m[ask]:perms

ACL

d[efault]:u[ser]:uid:perms

; uid UID,

d[efault]:g[roup]:gid:perms ; gid
GID,
,
,
, ACL (
6.7).
setfacl s (set).
, , setfacl.
, project07 lena
petr
setfacl m user:lena:rw-,user:petr:rw- project07
-m , . (.. , ) lena petr
, , . , , project07 , lena, petr
project07.
ls, ls l . , , "+" (""). ,
,
getfacl _

88
setfacl getfacl man.
, chmod
ACL, ACL
, .

(lofi)
Solaris .
-,
- , ,
dd.
, , lofiadm,
lofi. - .
- . ,
mount,
fsck ..
lofiadm ,
.
, - ISO, ex.iso:
lofiadm -a /home/ivan/ex.iso /dev/lofi/1
:
mount -F hsfs -o ro /dev/lofi/1 /mnt
, :
df -k /mnt
Filesystem
kbytes used
avail capacity Mounted on
/dev/lofi/1
512418 512418
0
100%
/mnt
:
umount /mnt
lofiadm -d /dev/lofi/1
(rlofi, rdsk) lofiadm a:
lofiadm -a /export/home/test
/dev/lofi/1
newfs /dev/rlofi/1
newfs: construct a new file system /dev/rlofi/1: (y/n)? y
/dev/rlofi/1:
71638 sectors in 119 cylinders of 1 tracks, 602 sectors
35.0MB in 8 cyl groups (16 c/g, 4.70MB/g, 2240 i/g) super-block
backups (for fsck -F ufs -o b=#) at: 32, 9664, 19296, 28928, ...

89
, lofiadm, . ,
, . , , .
. , , , .
/dev/lofictl.
root.

1)

! UNIX /etc/fstab

90

7. : UFS

: . ,
.
Solaris : (root), "/" (), .
,
, .
, , /usr, /export/home , , /opt.
(, /usr).
, ZFS
, 8.

. /bin, /sbin, /dev, /devices, /etc, /tmp. , /usr /opt, /export, .
Solaris ( Entire Distribution
. 3 4) 200 ( , /usr, /opt, /var
/export/home ).
300 . /usr 1400 , /var 100 . /var , ..
, .
Entire Distribution.
, , Solaris. Oracle,
() Oracle. , /var /var/mail, ,
(,
/export/home).
, , /var,
. , /var
256 ( , http-cache
ftp 10-50 ) 2-3 (
, http-cache, MySQL, - 5-10 50150 ).
- . ,
, .
( , Solaris ..) 4.
format.

91
,
SCSI- .


, , IDE primary slave .
, ( ) .
format fdisk.
x86. , format fdisk . .
Solaris, . , IDE-
, r /reconfigure .
/devices /dev. Solaris disks, Solaris 9 devfsadm.
/devices,
./dev/dsk /dev/rdsk.
, /dev/rdsk,
. format.
, fdisk. fdisk.
, ,
.
Solaris, Solaris.
"", - .
fdisk ,
format, .
fdisk, format partition>print.
(partition), 2,
, fdisk .
,
fdisk. Partition format. partition->
(, 0), .
label .
. : fdisk Solaris - solaris (slices).
UFS, . newfs.
mkfs , UFS, newfs
mkfs
UFS.
# newfs /dev/rdsk/c0d1s0

92
newfs: construct a new file system /dev/rdsk/c0d1s0: (y/n)? y
/dev/rdsk/c0d1s0:
2060352 sectors in 2044 cylinders of 16
tracks, 63 sectors
1006,0MB in 128 cyl groups (16 c/g, 7,88MB/g, 3776 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 16224, 32416, 48608, 64800, 80992, 97184, 113376, 129568,
145760, 161952, 178144, 194336, 210528, 226720, 242912, 258080,
274272, 290464, 306656, 322848, 339040, 355232, 371424, 387616,
403808, 420000, 436192, 452384, 468576, 484768, 500960, 516128,
532320, 548512, 564704, 580896, 597088, 613280, 629472, 645664,
661856, 678048, 694240, 710432, 726624, 742816, 759008, 774176,
790368, 806560, 822752, 838944, 855136, 871328, 887520, 903712,
919904, 936096, 952288, 968480, 984672, 1000864, 1017056,
1032224, 1048416, 1064608, 1080800, 1096992, 1113184, 1129376,
1145568, 1161760, 1177952, 1194144, 1210336, 1226528, 1242720,
1258912, 1275104, 1290272, 1306464, 1322656, 1338848, 1355040,
1371232, 1387424, 1403616, 1419808, 1436000, 1452192, 1468384,
1484576, 1500768, 1516960, 1533152, 1548320, 1564512, 1580704,
1596896, 1613088, 1629280, 1645472, 1661664, 1677856, 1694048,
1710240, 1726432, 1742624, 1758816, 1775008, 1791200, 1806368,
1822560, 1838752, 1854944, 1871136, 1887328, 1903520, 1919712,
1935904, 1952096, 1968288, 1984480, 2000672, 2016864, 2033056,
2049248,
/test:
# mount -F ufs /dev/dsk/c0d1s0 /test
# ls test
lost+found
: lost+found
, , ( , ) fsck .
, ( newfs mkfs)
.


UFS
-i:
newfs i nbpi raw_deivce_name

newfs i 2048 /dev/rdsk/c0d0p0


nbpi , 1),
.
mkfs newfs ,
.


.
, , , ,
(ACL access control lists), -

93
.
UFS :
, , (i-node table) . , Solaris ( 2.52), 1995 )
(ACL). ACL (shadow inodes).
System V ()
UNIX, BSD ,
. " UNIX" UNIX .
(boot block) , , (disk label). ,
. .
,
.

, , UNIX,
. , ,
. , , , fsck "clean flag is not set in superblock".

. UFS . , ,
.
(i-node table) .
, , ,
UID , GID , ,
, . "
: ".
Solaris UFS 128 .
. mkfs (, , newfs)
, ,
. ,
1000000 1000, 1000
.

:
UNIX ; UFS , .
, FFS (ext2, ext3, UFS), . ,
,
. , , -,
, -, . -

94
( metadata).
, ,

, ,
.
. . :

;
;
;
;
;
;
;
(.. ,
);
( major
minor , . " ");
, ;
;
( ,
, "", .. ; holey files );
( );
15 , ;
4 .

, UFS,
.
(.. 12 8192 = 98304
), ,
(indirect blocks), , , .
. . 2048
( 8192- ).
.
2048 , ,
2048 2 .
.
2048 , 2048 3 .
UNIX. , , . , 70%, .

95
,
. 512 , :

12 8192
= 98304 ;
2048 8192 =
16777216 ;
20482 8192 =
34359738368 ;
20483 8192 =
70368744177664 .

64 . , Solaris 9,
, 1 .
ZFS, Solaris Solaris 10.
UNIX 128- , 3 ( ), 4. .
28 , 32 , 64- . 64- UNIX 32, , " 2031 ", .. 32 UNIX. , UNIX 64 .


(i-nodes) UNIX.
Solaris : . .


(shadow i-nodes) , (ACL) . UFS Solaris, 2.5.1.
Solaris UFS (Unix File
System), NFS (Network File System 2 3), CacheFS (Cache File System).
ZFS ZFS. ,
, (FIFO).
(, setfacl), . , , , ,
.
,
. . Solaris
1024 , , 1024 .

96
. ACL
12 , . ,

, .
setfacl
getfacl, 6.


, "
".
. ,
, " ". ZFS,
,
.
Solaris, , .
, .
, , 1 , , ,
.
, , , ,
, .
. HTML, , ,
. , , . ,
, . ,
, 2006 ,
. , ,
, .

Pentium IV, (, spamasassin). , ,
sendmail
.
,
. .
.
Solaris / 3 .
. /opt, , . ( http-,
), (, http-) , .
, , ( SCSI 6 9 , 54
), "", 3).

97
, ?
df:
#df
/
/boot
/proc
/etc/mnttab
/dev/fd
/var/run
/tmp
/export/home

(/dev/dsk/c0d0s0):
(/dev/dsk/c0d0p0:boot):
(/proc
):
(mnttab
):
(fd
):
(swap
):
(swap
):
(/dev/dsk/c0d0s7
):

1787406 blocks
19452 blocks
0 blocks
0 blocks
0 blocks
1265832 blocks
1265832 blocks
7647080 blocks

419477 files
-1 files
2896 files
0 files
0 files
30240 files
30240 files
481212 files

, , df k:
#df -k
Filesystem
/dev/dsk/c0d0s0
/dev/dsk/c0d0p0:boot
/proc
mnttab
fd
swap
swap
/dev/dsk/c0d0s7

kbytes
1857844
11234
0
0
0
632924
633208
3823549

used
964142
1508
0
0
0
20
304
9

avail
837967
9736
0
0
0
632904
632904
3785305

capacity
54%
14%
0%
0%
0%
1%
1%
1%

Mounted on
/
/boot
/proc
/etc/mnttab
/dev/fd
/var/run
/tmp
/export/home

df o i
.
, UNIX
df -i
du. , , , du
s /*:
#du s /*
2 /bin
3011 /boot
87255 /cdrom
1424 /core
3068 /dev
76 /devices
6262 /etc
26 /export
6 /floppy
4 /format.log
1 /home
20702 /kernel
2 /lib
16 /lost+found
2 /Mail
2 /mnt
1 /net
2 /nsmail

98
14 /opt
3822 /platform
730131 /proc
50 /qq
2 /qqqq
34154 /sbin
640/tmp
46 /TT_DB
1811752 /usr
46138 /var
0 /vol
19 /xfn
s , , /* , . s du , "" , ..
, ...


. minfree ( free mkfs)
10% . " "
(.. ), , ,
. , ,
10% .
, minfree
1%. , Solaris 9 ThinkPad 390X 4
, minfree.
, mkfs_ufs , 10% .
:
mkfs_ufs o free=1
:
newfs m 1
tunefs.
, minfree ,
root.

, FAT, , RT-11.
FAT , RT-11 squeese, , , , . FAT
-, RT-11
,
, .

99
UFS . , 1-2% , Windows .
? - , UNIX?
, "" UNIX , FAT. UFS ,
, "" , , , . ( , ) .
, , , ,
, . UFS . "" UFS , ,
. . ,
. . 7.1.

. 7.1. UFS
,
, , .
, Windows,
UFS , , ,
, .
( UFS) , , fsck n.
( FAT), .. , ,
(., ,
http://www.eaglesoft.com/products.html SPARC)
ufsdump / ufsrestore.


UFS growfs. ,
- ,
, , .
8 "
Solaris 10".


Windows scandisk UNIX fsck. Solaris fsck ,
/etc/vfstab. fsck
:

100
fsck /dev/dsk/c0d0s7
fsck , , .
, , fsck
, , .
, fsck
. , fsck
, :
fsck /dev/dsk/c0d0s7
/dev/dsk/c0d0s7 is a mounted file system, ignored
fsck /dev/rdsk/c0d0s7
** /dev/rdsk/c0d0s7
** Currently Mounted on /export/home
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
2 files, 9 used, 3823540 free (20 frags, 477940 blocks,
0.0% fragmentation)
, - , 128 (. .).
2)
, Sun Microsystems ACL UFS
1993 Solaris Trusted Solaris,
B1.
3)
. " ".
1)

101

8. : ,
ZFS
ZFS
ZFS Sun Microsystems
. , ,
. :
1.
2.
3.
4.

;
;
;
.


- (, ls , ),
. , ? : , .
- , , DIMM . .
:
( , .. ) .
, ,
.
.
.

ZFS. , ZFS ,
, ,
, .


,
, . , ,
.
,
.
, , ,
. , ,
, .

102
, . . , ( RAIDZ, ), ,
.
, ,
. , , , .
, CERN 8 2008 [[1]].

ZFS.
,
. , , ,
ZFS, , .
, ZFS ,
256- ,
, ..
. , ,
, -
, , ,
(. 8.1).

103

. 8.1. ZFS
, , ZFS , , , ,
. : ,
, .

ZFS , . , , . , , :
, ,
; , . , fsck . . 8.1 ZFS "copy on write" (--), , , "", , .
ZFS , .
, , -

104
, ,
, , . "", .
ZFS , .


ZFS . , ,
- , .
,
, , ! ,
"ZFS " " ".

ZFS

, ZFS POSIX- . , ZFS .
ZFS ,
.
ZFS, , :

( ) ;
, , ;
, ;
, ; ,
, (access control list),
, , , ,
..;
RAID-Z , ; ZFS , ;
;
, ;
(dataset) , , .

ZFS
. , , 1).
ZFS :
1.
2.
3.
4.
5.
6.

SPA (Storage Pool Allocator)


DSL (Dataset and Snapshot Layer)
DMU (Data Management Layer2))
ZAP (ZFS Attribute Processor)
ZPL (ZFS POSIX Layer)
ZIL (ZFS Intent Log)

105
7. ZVOL (ZFS Volume)
, , . , SPA.
"ZFS on-disk specification"[[2]]
ZFS http://opensolaris.org/os/community/zfs/docs.

(vdev),


ZFS3) . (vdev)
( leaf vdev, .. " ",
) ( interior vdev, " ", ). , , .
.
, . , (root). . 8.2
, . , M1, , A
B. , M2, , D. A, B, C, D
. M1 M2 , , .

. 8.2.

106

256
, . ,
, , ,
(-, , !).
, 8.2 : , D M2. .
:
. , :
(), ( ) .

. , . , ZFS
. 8.3 , N: L0 L1
, L2 L3 .

. 8.3. , ()
N
, , ,
, ( ) ZFS ""
(, , ).

, , ,
ZFS,
. , . , , .
, :
(L0 L2). , .
, L1 L3. ,
.

107
4 : 8 , 8 , 112 "/" 128
uber-. 8.4 ,
, .

. 8.4. ( ,
, /, uber-)
ZFS VTOC, EFI . EFI , VTOC 8
. 8
.

8 .
/
112 /,
; ,
"" ( 8.2) "",""
"M1".
Uber-
/ uber-.
Uber- , , 4).
uber- , , , SHA-256.

108

. 8.5. uber-; uber-


uber-, . uber- -
uber-. uber- , uber- . Uber- . 8.5 uber-
.
Uber-
Uber- 5) :
ub_magic
, 64- , ZFS. 0x00bab10c (oo-ba-block, uberblock).
8.1 , :
8.1.
Machine Endianness Uberblock Value
Big Endian

0x00bab10c

Little Endian

0x0cb1ba00

ub_version
, .
0x1. . "version", 1.3.3.
ub_txg

109
ZFS .
. ub_txg ,
uber-. , txg, nvlist .
ub_guid_sum
.
, ZFS
GUID ( /
guid / , 1.3.3). ub_guid_sum, .
ub_timestamp
, uber- , 1 1970 . ( UTC).
ub_rootbp
ub_rootbp blkptr, MOS. MOS, blkptr
4 2 .

. blckptr_t
128- ZFS, ,
, .
. 8.6.

110

. 8.6.

(DVA Data Virtual Address)


vdev offset ; ,
vdev1 offset1 dva1. ZFS
, .
dva1, dva2 dva3 . .
6) "" : (1 DVA), (2 DVA)
(3 DVA).
vdev (32- ) DVA
, . offset (63- ) , L0 L1
, . Vdev offset
. offset (.. 512 ).

111
, (slice), offset 9 (29 = 512) 0x400000
( vdev_label ):
physical block address = (offset << 9) + 0x400000 (4MB)
GRID

Raid-Z.
GANG
(gang) , .
, . ,
, ,
. , , , "",
.
"G":
8.2. G
"G"

512 . 3 , 32- . :
typedef struct zio_gbh {
blkptr_t
zg_blkptr[SPA_GBH_NBLKPTRS];
uint64_t
zg_filler[SPA_GBH_FILLER];
zio_block_tail_t zg_tail.;
} zio_gbh_phys_t;
zg_blkptr: . 512- 3 .
zg_filler: (filler) ,
512 .
typedef struct zio_block_tail {
uint64_t zbt_magic;
zio_cksum_t
zbt_cksum;
}
zbt_magic: , ZIO. 0x210da7ab10c7a11 (ziodata-bloc-tail).
typedef zio_cksum {
uint64_t zc_word[4];
}zio_cksum_t;

112
zc_word: 8- , .
cksum ( )
ZFS - . , fletcher2, fletcher4
SHA-256 (256-bit Secure Hash Algorithm FIPS 180-2,
http://csrc.nist.gov/cryptval).
, 8- cksum .
8.3 .

8.3. cksum

fletcher2

none

SHA-256

SHA-256

zilog

fletcher2

fletcher2

fletcher2

fletcher4

fletcher4

SHA-256

SHA-256

comp ()
ZFS .
, comp :
8.4. comp

on

lzjb

off

lzjb

lzjb


: psize, lsize, and asize.
1. lsize: . ,
RAID (RAID-Z) , (gang):
2. psize: ;
3. asize: , ,
, RAID-Z.
ZFS RAID-Z, lsize, asize,
psize . 512-
, .

ZFS ,
(big endian,

113
, SPARC) (little endian,
, x86). E
( Endianness) 1 , (x86), 0
, (SPARC).
, .
, , .
8.5. E ( )
Endian

Value

Little Endian

Big Endian


, . , 8.6.
8.6.

DMU_OT_NONE

DMU_OT_OBJECT_DIRECTORY

DMU_OT_OBJECT_ARRAY

DMU_OT_PACKED_NVLIST

DMU_OT_NVLIST_SIZE

DMU_OT_BPLIST

DMU_OT_BPLIST_HDR

DMU_OT_SPACE_MAP_HEADER

DMU_OT_SPACE_MAP

DMU_OT_INTENT_LOG

DMU_OT_DNODE

10

DMU_OT_OBJSET

11

DMU_OT_DSL_DATASET

12

DMU_OT_DSL_DATASET_CHILD_MAP 13
DMU_OT_OBJSET_SNAP_MAP

14

DMU_OT_DSL_PROPS

15

DMU_OT_DSL_OBJSET

16

DMU_OT_ZNODE

17

DMU_OT_ACL

18

DMU_OT_PLAIN_FILE_CONTENTS

19

DMU_OT_DIRECTORY_CONTENTS

20

DMU_OT_MASTER_NODE

21

DMU_OT_DELETE_QUEUE

22

DMU_OT_ZVOL

23

DMU_OT_ZVOL_PROP

24

(lvl)
, .. ,

114
, .
(fill count)

(.. ). 1
, . DMU_OT_DNODE: .
(birth txg)
64- birth txg (birth transaction) ,
.
(padding)
- .

ZFS (copy on write)


, (. 8.1).
. ,
.
, ZFS :
.

.
,
. ,
, . . 8.1.
, , . ,
, . . 8.1.
,
, , ,
, .
, ,
( . 8.1).
, uber-.
, :
.
uber- : , uber-, , "" "" uber-, "".
uber- ,
, .

115

? : ,
, , PHP . ,
- . - ?
(snapshot) (
, , snapshot).
? : ; . .
, .
(
"" ), ,
.
, ,
.
: zfs
snapshot, .
filesystem@snapname:
# zfs snapshot pool/home/ahrens@friday
friday pool/home/ahrens.
-r.
; ! ,
, Solaris Express build 62
!
? ?
. 8.1, . , . , , , ,
, .

. , , , .

RAID-Z
ZFS RAID-Z RAID-
. ,
, . , RAID, ZFS

116
, , .
, ZFS ,
. , ZFS
" " (spare disks), ,
RAID-Z . ,
, .
ZFS (resilvering)
. .

. 8.7.
, - (.. ),
"" , . 8.7.
, . ( ),
, .


ZFS . , .
UFS, ,
, , ZFS .
, ZFS :

;
;
RAID (RAID-Z), "", "RAID ", "RAID
";
RAID-Z;
"" , (.. );

117

ZFS
, ZFS, 64 .
, ZFS, 264 , .. 16 .
18 (18,4 1018) , 64-
. ZFS 264 .
1000 , ZFS (248 ) 9000 . , ZFS
, !
ZFS (Jeff Bonwick) , 100%- ZFS , , . [[3]]
, (Seth Lloyd) 2000 "Ultimate physical limits to computation" [[4]]
, 1 , 1 ,
1051 1031 . 128 2128 = 2137 = 2140 . , , (2 140 ) / (1031 /) = 136 .
E=mc2
, 1.2 10 28.
, 1.2 10 28 , ,
1 , 400 000 ,
2 000 000 , 2,4 10 6 . , 2.4 10 6 / 1.4 1021 = 3.4
1027 .
, 128- ,
!
, , ,
ZFS !
, ZFS,
!

ZFS
, ZFS :
,
-, .
- . , . (LBA) , LBA: "" . , ,
write() , , read()
, , .

118
, ZFS ,
, ,
.
ZFS , copy-on-write
. ZFS . , ZFS 512 128
, .
, ZFS , , ,
. - - , ZFS ,
.
( )
,
- -.
-.
, ZFS
, .
, , .
? , 1 ,
1 , . 1
1 , , . - , . ,
ZFS: ZFS ,
, , (. . 8.8)
[[5]].

. 8.8. ( [5]). 9 ,
100% .
, ,
, , . ZFS lseek, SEEK_HOLE ( , lseek ) SEEK_DATA ( , ). Solaris ,
.

119
, : , ,
, .
, ; , ZFS . , , , . ,
, , ,
.
, , . ,
ZFS, , (2-6 ) UFS: [[6]]

, ;
() 32;

1, ;
100- .

, ZFS,
.

ZFS
,
. : ZFS , , . ZFS
.
, : ZFS, ?


giant c1t0d0 c1t1d0
# zpool create giant c1t0d0 c1t1d0
/dev/dsk, .
( , ):
# zpool create giant mirror c1d0 c2d0
RAID-Z
# zpool create giant raidz c1t0d0 c2t0d0 c3t0d0 c4t0d0

120
raidz raidz2.
zpool destroy. : ,
.
# zpool destroy giant


zpool add; ,
giant
zpool add giant mirror c2t1d0 c2t2d0
,
zfs create, ;
, : pool-name/[filesystem-name/]filesystem-name
,
. .
.
oracle giant/home.
# zfs create giant/home/oracle
, ZFS .
, zfs create. oracle /giant/home/oracle.
zpool list:
# zpool list
NAME
SIZE
dbspace 340G
samba
204G
usrdb
68G

USED
162G
134G
27.3G

AVAIL
178G
69.9G
40.7G

CAP
47%
65%
40%

HEALTH
ONLINE
ONLINE
ONLINE

ALTROOT
-

( home/archive)
# zfs set compression=on concat/archive

,
:
zfs snapshot test/opt@18Feb08
, ,
, @, . ,

.

121
c zfs list.
, , , .
, ,
"", , . ZFS (. 6 " Solaris 10").
zfs
send:
zfs send test/opt@18Feb08 > backup
backup,
, .
( )
zfs receive:
zfs receive -F test/opt@snap < backup
-F , ,
, , , .
, , zfs rollback:
zfs rollback test/opt@18Feb08
test/opt
, 18Feb08.


- ,
.
, ZFS
: .
, , oracle mail
, -
.
ZFS ( ,
; ,
):
# zfs set reservation=4G pool/home/oracle
# zfs get reservation pool/home/oracle
NAME
PROPERTY
VALUE
pool/home/oracle reservation
4.00G

SOURCE
local

122
, . zfs set reservation, .
# zfs set quota=5G pool/filesystem
# zfs set reservation=10G pool/filesystem/user1
cannot set reservation for 'pool/filesystem/user1': size is
greater than available space

( ZFS UNIX)
ZFS FreeBSD 7.0-RELEASE, Solaris [[7]]:
1. ZFS
i386; amd64 , ;
2. ZVOL iSCSI;
3. ACL ;
4. ZFS .
ZFS Linux , Linux GPL, , GPL . Solaris, ZFS, ,
CDDL. Google Summer of Code
ZFS Linux ,
(user space), (kernel space).
2.6.14 , FUSE, .
.
Mac OS X Leopard (Build 9a321), 2006 , Mac OS
ZFS.

ZFS
ZFS Best Parctices Guide:
http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide#ZFS_Management_Tool
s_.2F_Observability
Manual setup to boot ZFS on x86: http://www.opensolaris.org/os/community/zfs/boot/zfsbootmanual/
ZFS ( ):
http://dlc.sun.com/osol/g11n/downloads/docs/current/ .html-.

1. Bernd PanzerSteindel, Data integrity,


http://indico.cern.ch/getFile.py/access?contribId=3&sessionId=0&resId=1&materialId=pape
r&confId=13797
2. ZFS on-disk specification, 2006,
http://opensolaris.org/os/community/zfs/docs/ondiskformat0822.pdf
3. http://en.wikipedia.org/wiki/ZFS
4. Seth Lloyd, Ultimate physical limits to computation, 2000

123
5. Jeff Bonwick, http://blogs.sun.com/bonwick/
6. http://blogs.sun.com/roch/entry/zfs_to_ufs_performance_comparison
7. Pawel Jakub Dawidek, 2007, http://lists.freebsd.org/pipermail/freebsdcurrent/2007April/070544.html

1)
, , . ZFS
, , ,
, , , ,
, , , . (..
), .
2)
, , DMU Data
Management Unit, Layer. Layer, DML.
3)
ZFS storage pool "" " ZFS",
" " : .
4)
Uber- UFS (. .).
5)
big endian (
) "" little endian ( ) "" .
SPARC, Intel AMD.
, "" "" "" , , .
6)
2007 :
(3DVA), (2 DVA),
(1 DVA).

124

9. :

, . UNIX, Solaris. Solaris, ,
, , , 6 " Solaris 10". Solaris ,
, ,
, , , , , , 6 " Solaris 10"
, .


, Solaris ,
(, ) XPG4. (The
X/Open Portability Guide, Issue 4 XPG4) ,
, . ,
UNIX .

/usr/bin/xpg4
, Solaris XPG4,
Solaris , , XPG4,
, /usr/xpg4/bin. , , ,
XPG4- , PATH , " " . /usr/bin,
(, grep),
(, /usr/xpg4/bin/grep), /usr/bin/grep .
PATH /usr/xpg4/bin, XPG4- .
, /bin, /usr/ucb and
/usr/ccs/bin.
XPG4 IEEE Std 1003.2-1992 IEEE
Std 1003.2a-1992 ( POSIX 2).


. , , , ,
. , , .
. , ..
( , ).
,
. , , ,
, .

125
( , Solaris, Linux, UNIX Windows) .
,
, . ,
.
.
( , - .) ,
. .
, , . .
:
. (thread) , , ,
. ,

.
,
, (mutex), , . Solaris POSIX threads (libpthreads) Sun libthreads ( Solaris
).

: ,
,
, .
( , , , UltraSPARC
T2 Sun 64 ) , .

Solaris

. Solaris, , .. ( , ).
( ) , , .
Solaris (user thread), (kernel thread) (LWP, lightweight process).
Solaris . ("" , .. ). , , ,
. , ,
. 9.1 , . , , , ,
.

126

. 9.1. Solaris 10
Solaris Solaris 10,
, Solaris.
(. 9.2),
libthreads .
,
. , ,
, .

. 9.2. Solaris 9

Solaris

127
. . , ,
"", , .
Solaris (threads), . , , ,
, . threads "",
"",
" ", " ", .
"",
.
.
, " ".
Solaris .
.
. -.
, . ,
.
. . ,
, (lightweight
process, LWP), .
(LWP), . LWP
, LWP. , LWP .


, , , , . ,
.


PID (process ID). PID ( 32-- 0 65535). 0
, , , . 1 init, ,
. , init, , ,
PID, (PPID
parent process ID).
, PID PPID, eUID (effective UID ) eGID (effective GID ) . ()
, ,
, .
, (,
, , . pkill ) . .

128
. , login .
, .
- , .. , . TTYID.
,
.
-
ps ef.


UNIX (NICE)
(PRI). -20 +20. NICE, . 20 .
,
. ,
.
Solaris , . ( ) .
. , .
,
.
(scheduling class), : (timesharing), (system),
(real-time) (fair class scheduling FSS).
. , .
, , . (global scheduling priorities). , . ,
, , , , .
- -.
priocntl, .

dispadmin.


, .
; , TERM

129
, TERM
. : , -. , TERM, PATH, USER, . export:
export TERM PATH

char *env[]

.
, ,
char *argv[]

int argc


Solaris : (timesharing, TS), (interactive, IA), (system, SYS), (real-time, RT), (fixed priority, FX)
(fair share scheduling, FSS).
9.1.

159100

(0-59)

9960

590

(0-59)

.

ps cl
, ""
dispadmin.


, .
, , .
, : , , .. , , -

130
, , , ,
. , , , ,
.
: , (
) (
, ). Solaris . ,
. , , ( ).
(, ,
; Solaris 5 ).
UNIX . , :
1. "" -
- swap-;
2. (preemptable), ..
, , , ; ,
, " " (nonpreemption points).
Solaris ,
.
: Solaris , , ; , Solaris
priority lending " ":
, "" .

, .
( ) . (RUN).
, . " " (ONPROC) .
:

, ( ). .
,
( ). , ( tqexp).
. ;
- ,

131

"" (SLEEP).
, , " ";
; ,
lwait. .


, ,
, ps L :
/usr/bin/ps efcL
UID
root
root
root
root
root
root
c

PID
0
1
2
3
314
289

PPID
0
0
0
0
1
1

LWP
1
1
1
1
1
1

NLWP
1
1
1
1
1
1

CLS
SYS
TS
SYS
SYS
TS
TS

PRI
96
59
98
60
59
59

STIME
00:23:03
00:23:03
00:23:03
00:23:03
00:23:35
00:23:32

TTY
?
?
?
?
?
?

LTIME
0:03
0:00
0:00
0:00
0:00
0:00

59

00:23:22

0:00

59

00:23:23

0:00

59

00:25:23

0:00

59
59
59
59
59
59
59
59
59
59
39

00:23:25
00:23:25
00:23:25
00:23:25
00:23:25
00:23:25
00:23:25
00:23:24
00:23:24
00:23:26
00:24:42

?
?
?
?
?
?
?
?
?
?
pts/4

0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00

CMD
sched
/etc/init pageout
fsflush
/usr/lib/saf/sac -t 300
/usr/lib/snmp/snmpdx -y /etc/snmp/conf

root 182 1
1
3
TS
/usr/lib/autofs/automountd
root 182 1
2
3
TS
/usr/lib/autofs/automountd
root 182 1
3
3
TS
/usr/lib/autofs/automountd
root 207 1
3
18
TS
root 207 1
4
18
TS
root 207 1
5
18
TS
root 207 1
6
18
TS
root 207 1
7
18
TS
root 207 1
8
18
TS
root 207 1
9
18
TS
root 193 1
11 13
TS
root 193 1
12 13
TS
root 193 1
13 13
TS
root 439 419 1
1
IA

/usr/sbin/nscd
/usr/sbin/nscd
/usr/sbin/nscd
/usr/sbin/nscd
/usr/sbin/nscd
/usr/sbin/nscd
/usr/sbin/nscd
/usr/sbin/syslogd
/usr/sbin/syslogd
/usr/sbin/syslogd
bash

:
. LWP, CLS PRI, , .
( PRI),
.
, (,
/usr/lib/autofs/automountd /usr/sbin/syslogd) LWP ( NLWP LWP, ).


dispadmin.
: ,
. dispadmin.
, , dispadmin -

132
l :
dispadmin -l
CONFIGURED CLASSES ==================
SYS (System Class)
TS (Time Sharing)
FX (Fixed Priority)
IA (Interactive)
RT (Real Time)
(- TS):
dispadmin -c TS -g
# Time Sharing Dispatcher Configuration
RES=1000
ts_quantum
200
200
200
200
200
200
200
200
200
200
160
160
160
160
160
160
160
160
160
160
120
120
120
120
120
120
120
120
120
120
80
80
80
80
80
80
80
80
80
80
40
40
40
40

ts_tqexp
0
0
0
0
0
0
0
0
0
0
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

ts_slpret
50
50
50
50
50
50
50
50
50
50
51
51
51
51
51
51
51
51
51
51
52
52
52
52
52
52
52
52
52
52
53
53
53
53
53
54
54
54
54
54
55
55
55
55

ts_maxwait
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

ts_lwait
50
50
50
50
50
50
50
50
50
50
51
51
51
51
51
51
51
51
51
51
52
52
52
52
52
52
52
52
52
52
53
53
53
53
53
54
54
54
54
54
55
55
55
55

#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

PRIORITY LEVEL
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

133
40
40
40
40
40
40
40
40
40
40
40
40
40
40
40
20

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

55
56
57
58
58
58
58
58
58
58
58
58
58
58
58
59

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
32000

55
56
57
58
58
59
59
59
59
59
59
59
59
59
59
59

#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

, RES, ,
. RES
ts_quantum . 1000. . RES 0,001, , .. . ,
ts_quantum .
"" , :

ts_quantum (), , ;
ts_tqexp , ,
, ;
ts_slpret , , "", .. - ;
ts_maxwait , ,
, ;
, ts_lswait.
ts_maxwait , ( );
ts_lswait ,
.

(
). ( ) . 9.1.
,
. maxwait , 59, ,
, (
, ).
, . ,
0. ,
(ts_maxwait), 50 (ts_lwait).
(,
, , , ). 200 40 .

134
.
, (, ),
40 (ts_tqexp).
:

40

40

30

80

20

120

10

160

200

50

40

40

40

30

80

..

..


.
, , ,
,
.
,
ts_maxwait . , ,
.
(RT) :
# Real Time Dispatcher Configuration RES=1000
TIME QUANTUM(rt_quantum)
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
800
800
800
800
800
800
800
800
800
800
600
600
600

#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

PRIORITY LEVEL
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

135
600
600
600
600
600
600
600
400
400
400
400
400
400
400
400
400
400
200
200
200
200
200
200
200
200
200
200
100
100
100
100
100
100
100
100
100
100

#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

(
). , , ,
, . 9.1.


Solaris () , timesharing ( ) . , , ( , -
..), , (fair share scheduler FSS).
"" , .
, 70% -, 30%
. , . , Solaris Solaris 9 ,
- .
Solaris ( ) , , , IRIX 6.2.

136
http://docs.sun.com/db/doc/8164882/6mb2ipq5n?q=scheduling+class&a=view
5 " Solaris 10" ,
.

. Swaping

, , .
swap-, .
UNIX . , UNIX . (, ,
) , . UNIX
4 . Solaris x86 , SPARC
, .. .
Solaris pagesize.
UNIX
c "" (swaping).
.
UNIX "" (paging), ()
. , , .
, UNIX, " ".
, "" "" . ,
. , .
8
" Solaris 10".
,
swap-.
. , : swap-, , , swap-,
, .
( , swap-)
, ,
. , , - , ,
.
, , ,

. , ! , ,
( ,
swap- - , , !), ,

137
, - .
UNIX ,
, , .
, , ,
. .


, . . , , ,
(ACL).
, ,
(eUID) (eGID) . , .
, , .
, , , . , , , " ".

, ,
umask.

. , ( ) , .


- ,
. ,
, .
"", .. , .
, . ,
, .

-.
, , . , . /etc/shadow. , : ? ? ? ,
, , .
, /etc/shadow ,
passwd ( , ). , UNIX , - .
/etc/shadow root (
, chmod?),
passwd root.

138
( )
, SUID ( set User ID). ,
SUID, ,
, .
, :
su sg t r w x r w x r w x
SUID (su), SGID (sg) sticky bit (t).

Suid Sgid
suid sgid , chmod :
chmod 4755
:
chmod u+s
UNIX .
(SGID) SUID : SUID, SGID ,
, , .
ls SUID SGID ,
, "x" ( ), "s":
-r-xr-sr-x
-r-sr-sr-x

1 root
1 root

tty
sys

10040 Nov
22168 Nov

4
4

2002 /usr/sbin/wall
2002 /usr/bin/passwd

, : , SUID ( SGID, ). SUID SGID , ( ) ,


. SUID SGID ,
SUID/SGID .
ls SUID/SGID
S :
dr-Sr-xr-x
-rw-r--r--

2 root
1 root

other
other

512 May 10 01:48 enum


0 May 10 01:47 q

enum. SUID/SGID 7.
, SUID,
find / -perm u+s
SGID
find / -perm g+s

139
,
. .
passwd, , ,
, . root'a. , SUID ? suid ,
!

, ,
suid. , FreeBSD
/etc/daily, .
, .


UNIX . ,
, (foreground). mail, vi .
.
, ,
-tostop.
stty -tostop

stty tostop
- ,
tostop, SIGSTOP. , ,
( STOPPED).
: , , , . :
.
UNIX Ctrl-L,
, .
,
"&" ():
&
, ,
:
make all &


, .
,
.

140
: (stdin), (stdout) (stderr).
, ( , ). , .
:
0, 1, 2. , .
, , .


, ,
. , , find
names, ,
find / -name "some_name" > names
>
. names ,
,
.
"
" >>
find / -name "some_name" >> names
names , , ,
find .
.
, ,
, , , ,
mail @ < __
, ,
. " ".
,
( ):
mail @ <<FINAL
() $TARGETUSER,
$OVERSIZE
. , !

FINAL
, $TARGETUSER $OVERSIZE -

141
, , , . , - , , ,
.
<< ,
-, . -
: , . ,
, ,
. , "",
FINAL - .
, , .
ls more, :
ls l | more
"|" , , , .
, , , :
,
..
, httpd :
ps auxw | grep httpd | wc l
ps , , grep
, httpd, wc l ,
.
, , ,
, .

, .
Solaris , TERM, KILL
HUP. UNIX , POSIX 1.1
. . , .
, , .. . ,
root, .

kill
_ PID

142
kill _ PID
UNIX
killall:
killall _ _
Solaris , :
killall
Solaris pkill.
pkill sendmail
pkill TERM , pkill.
,
pkill HUP G other,daemon
HUP (SIGHUP) , other daemon.
. 9.2 , POSIX 1.1, . 9.3
, Solaris 9.
9.2. POSIX 1.1

SIGHUP

SIGINT

SIGQUIT

SIGILL

SIGABRT

abort - abort

SIGFPE

exception:

SIGKILL

SIGSEGV

11

13

SIGALRM

14

timer alarm

SIGTERM

15

SIGUSR1

30,10,16

SIGUSR2

31,12,17

SIGCHLD

20,17,18

SIGCONT

19,18,25 ,

SIGSTOP

17,19,23

SIGTSTP

18,20,24

SIGTTIN

21,21,26

SIGTTOU

22,22,27

143
pkill pgrep,

ps ef | grep
Solaris
pgrep
9.3. Solaris 9

SIGHUP

SIGINT

SIGQUIT

(core)

Quit (see termio(7I))

SIGILL

(core)

SIGTRAP

(core)

SIGABRT

(core)

SIGEMT

(core)

SIGFPE

(core)

arithmetic exception:

SIGKILL

SIGBUS

10

(core)

SIGSEGV

11

(core)

( )

SIGSYS

12

(core)

SIGPIPE

13

SIGALRM

14

timer alarm

SIGTERM

15

SIGUSR1

16

SIGUSR2

17

SIGCHLD

18

SIGPWR

19

SIGWINCH

20

SIGURG

21

(Urgent Socket Condition)

SIGPOLL

22

Pollable Event (see streamio(7I))

SIGSTOP

23

SIGTSTP

24

144
SIGCONT

25

SIGTTIN

26

SIGTTOU

27

SIGVTALRM

28

Virtual Timer Expired

SIGPROF

29

Profiling Timer Expired

SIGXCPU

30

(core)

(CPU time limit exceeded)

SIGXFSZ

31

(core)

- getrlimit
(see getrlimit(2))

SIGWAITING

32

SIGLWP

33

(LWP)

SIGFREEZE

34

Check point Freeze

SIGTHAW

35

Check point Thaw

SIGCANCEL

36

Cancellation signal reserved by threads library

SIGXRES

37

Resource control exceeded (see setrctl(2))

SIGRTMIN

(SIGRTMIN+1) *

(SIGRTMAX-1) *

SIGRTMAX


, UNIX . , (pipes) (sockets), , .. .
, /.
, , . , .
, ; ,
- , .
socket, . , .
. - "descriptor table", , , ,
" ". "" , , .
, , (, , ).

145
, , , .
, , . (..
), () .
socket (3).

,
. (API), :

System V IPC (inter-process communication);


BSD;
POSIX 1003.1b.

, . Oracle. Solaris 9 ( ),
/etc/system. ,
Solaris, .
Oracle8i Oracle8i Installation Guide Release 3 :
set semsys:seminfo_semmni=100
set semsys:seminfo_semmsl=<10+ PROCESSES
>
set semsys:seminfo_semmns=<, >
set semsys:seminfo_semopm=100
set semsys:seminfo_semvmx=32767
seminfo_semmns PROCESSES
, 2, 10 .
Solaris 9

sysdef | tail -25
Solaris 10 prctl, 5 "
Solaris 10".
Solaris
ipcs -sb
, . ,
- .

146
ipcrm -s semsetID
semsetID .



ps.
" " , .
ps , . ,
ps ef
BSD System V ps ,
, man ps.
, ps.
ps -ef | more
UID
root
root
root
root
root
root

PID
0
1
2
3
349
277

PPID
0
0
0
0
1
276

C
0
0
0
0
0
0

STIME
17:43:30
17:43:30
17:43:30
17:43:30
17:43:53
17:43:49

TTY
?
?
?
?
?
?

TIME
0:03
0:00
0:00
0:00
0:00
0:00

root
root
root
root
root
root
root
root
daemon
root
root
root
root
root
root

180
59
73
133
229
172
156
217
168
189
203
205
343
240
324

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

17:43:45
17:43:39
17:43:40
17:43:43
17:43:48
17:43:44
17:43:44
17:43:47
17:43:44
17:43:45
17:43:46
17:43:46
17:43:53
17:43:48
17:43:51

?
?
?
?
?
?
?
?
?
?
?
?
?
?
?

0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00

root
root
root
root
root
root
root
root
root

261
355
329
262
263
354
338
352
353

1
329
1
261
261
1
1
349
329

0
0
0
0
0
0
0
0
2

17:43:49
17:43:56
17:43:52
17:43:49
17:43:49
17:43:55
17:43:52
17:43:53
17:43:54

?
?
?
?
?
?
?
?
?

0:00
0:00
0:00
0:00
0:00
0:00
0:00
0:00
1:41

root

356

329

0 17:43:56

0:00

CMD
sched
/etc/init -s
pageout
fsflush
/usr/lib/saf/sac t 300
htt_server port 9010
syslog -message_locale C
/usr/lib/autofs/automountd
/usr/lib/sysevent/syseventd
/usr/lib/picl/picld
/usr/sbin/rpcbind
/usr/lib/power/powerd
/usr/lib/nfs/lockd
/usr/sbin/inetd -s
/usr/lib/lpsched
/usr/lib/nfs/statd
/usr/sbin/syslogd
/usr/sbin/cron
/usr/sbin/nscd
/usr/sbin/vold
/usr/lib/utmpd
/usr/lib/snmp/snmpdx y c
/etc/snmp/conf
/usr/sadm/lib/smc/bin/smcboot
/usr/dt/bin/dtlogin -daemon
/usr/dt/bin/dtlogin -daemon
/usr/sadm/lib/smc/bin/smcboot
/usr/sadm/lib/smc/bin/smcboot
/usr/lib/ssh/sshd
/usr/lib/dmi/snmpXdmid -s sunny
/usr/lib/saf/ttymon
/usr/openwin/bin/Xsun :0
nobanner auth
/var/dt/A:0-KtaiPa
/usr/openwin/bin/fbconsole d :0

147
root
root

358
337

324
1

0 17:43:57
0 17:43:52

?
?

0:00
0:00

mibiisa -r p 5248
/usr/lib/dmi/dmispd

. , ef. man ps.


UID ( f).
F flags () ; ,
.
S state () . :

O (ON PROC) ;
S (Sleeping) (, -);
R (Runnable) ;
Z (Zombie) "", , ;
T (sTopped) .

PID ,
.
PPID .
C (, ).
CLS .
PRI ; -, , .
NI NICE ( ), .
ADDR .
SZ , ,
;
4, . pagesize.
WCHAN , ;
.
STIME , , ;
.
TTY ( , ),
"?" .
TIME .
CMD , .

148
j :

PGID ;
SID .

L ,
.
:

LWP ;
NLWP .

, ,
, <defunct>.
ps UNIX top:
top
last pid: 923;
load averages: 4.56,
1.18,
0.50 17:54:22
64 processes:
63 sleeping, 1 on cpu
CPU states: 0.0% idle, 0.5% user, 99.5% kernel, 0.0% iowait, 0.0% swap
Memory: 128M real, 18M free, 101M swap in use, 499M swap free
PID USERNAME LWP PRI NICE SIZE
RES STATE TIME
CPU COMMAND
909 root
1
60 0
17M 3340K sleep 0:00 0.92% pagein
353 root
1
58 0
32M
16M sleep 0:05 0.37% Xsun
893 root
1
49 0
2228K 1172K cpu
0:00 0.15% top
753 root
1
49 0
15M 8112K sleep 0:00 0.13% dtterm
911 root
1
59 0
3352K
752K sleep 0:00 0.03% sh
912 root
1
49 0
3360K
600K sleep 0:00 0.03% sh
894 root
1
59 0
3064K 1816K sleep 0:00 0.03% dtexec
656 root
5
59 0
22M
10M sleep 0:01 0.02% dtwm
648 root
1
59 0
6644K 2280K sleep 0:00 0.02% ttsession
667 root
1
59 0
1844K
512K sleep 0:00 0.02% rpc.rstatd
277 root
29 59 0
5612K 1724K sleep 0:00 0.01% htt_server
895 root
1
59 0
3360K
756K sleep 0:00 0.01% soffice
720 root
4
49 0
42M
26M sleep 0:03 0.00% mozilla-bin
649 root
1
49 0
18M 6288K sleep 0:00 0.00% dtsession
760 root
1
49 0
4752K 1656K sleep 0:00 0.00% bash
Solaris top
prstat.
, Solaris
pgrep

ps ef | grep
pargs ,
:
pargs 2793
2793:
dtterm -name Run -xrm *menuBar: False -iconic -map -e /usr/dt/
bin/dtexec -open
argv[0]: dtterm

149
argv[1]: -e
argv[2]: /usr/dt/bin/dtexec
argv[3]: -open
argv[4]: -1
argv[5]: -ttprocid
argv[6]: 2.10fX-r 01 648 1289637086 1 1 0 192.168.5.33 5 sunny_105_1
argv[7]: /export/home/mozilla_bin/sfw/bin/mozilla
argv[8]: <NULL>
argv[9]: -open
argv[10]: -1
argv[11]: -ttprocid
argv[12]: 2.10fX-r 01 648 1289637086 1 1 0 192.168.5.33 5 sunny_105_1
argv[13]: /export/home/mozilla_bin/sfw/bin/mozilla
pargs -e 2793
2793:
dtterm -name Run -xrm *menuBar: False -iconic -map -e /usr/dt/
bin/dtexec -open
envp[0]: AB_CARDCATALOG=/usr/dt/share/answerbooks/ru_RU.UTF-8/
ab_cardcatalog
envp[1]: DISPLAY=:0.0
envp[2]: DTAPPSEARCHPATH=//.dt/appmanager:/etc/dt/appconfig/
appmanager/%L:/etc/dt/appconfig/appmanager/C:/usr/dt/appconfig/
appmanager/%L:/usr/dt/appconfig/appmanager/C
envp[3]: DTDATABASESEARCHPATH=//.dt/types,/etc/dt/appconfig/types/%L,/
etc/dt/appconfig/types/C,/usr/dt/appconfig/types/%L,/usr/dt/appconfig/
types/C
pargs , e
, dtterm, ,
.
prstat , top, :
prstat
PID USERNAME SIZE
RSS STATE PRI NICE TIME
CPU
PROCESS/NLWP
3576 root
3412K 868K run
13
0
0:00:02 6,3% find/1
353 root
45M
19M sleep 59
0
0:02:30 0,2% Xsun/1
753 root
15M 3620K run
49
0
0:00:02 0,1% dtterm/1
3577 root
6640K 4108K cpu0
49
0
0:00:00 0,1% prstat/1
205 root
2872K 624K sleep 59
0
0:00:00 0,0% nscd/18
895 root
123M
21M sleep 49
0
0:00:49 0,0% soffice.bin/4
667 root
1844K 488K sleep 59
0
0:00:00 0,0% rpc.rstatd/1
217 root
5364K 536K sleep 59
0
0:00:00 0,0% lpsched/1
324 root
4360K 196K sleep 59
0
0:00:00 0,0% snmpdx/1
240 root
1100K 288K sleep 59
0
0:00:00 0,0% utmpd/1
343 root
4892K
0K sleep 59
0
0:00:00 0,0% vold/3
276 root
3240K
0K sleep 59
0
0:00:00 0,0% htt/1
633 root
3784K
0K sleep 59
0
0:00:00 0,0% sdt_shell/1
657 root
16M 2496K sleep 49
0
0:00:00 0,0% dtfile/1
203 root
4484K 568K sleep 59
0
0:00:00 0,0% cron/1
189 root
5636K 1092K sleep 59
0
0:00:00 0,0% syslogd/13
168 daemon 2444K 820K sleep 59
0
0:00:00 0,0% statd/1
156 root
2412K 688K sleep 59
0
0:00:00 0,0% inetd/1
172 root
2160K 748K sleep 59
0
0:00:00 0,0% lockd/2
229 root
1348K
0K sleep 59
0
0:00:00 0,0% powerd/2
133 root
2212K 604K sleep 59
0
0:00:00 0,0% rpcbind/1
Total: 61 processes, 161 lwps, load averages: 0,25, 0,17, 0,27
, . root .

150
-
Solaris 9 preap, ""
(defunct), , ""
(zombie). , , (, ). ,
, . - init, - , preap, .


kill,
. , nice, .
kill KILL ;
KILL, .
, TERM,
:
kill [-] _
, sendmail :
ps auxw | grep sendmail
root
2057 0.0 0.2 2664
accepting connections

444 ? S

Jul08 3:24 sendmail:

, sendmail PID 2057. , :


kill 2057
( ):
kill 2057
kill: (2057) - No such pid
No such pid , .
kill . , .
, , /etc/inetd.conf, inetd .
, HUP ( ), , , 1.
, :
ps -ef | grep inetd
root
root

156
4555

1
760

0
0

17:43:44 ?
19:15:16 pts/5

0:00 /usr/sbin/inetd -s
0:00 grep inetd

151
, inetd. , grep
inetd grep, . ps
grep , ps " " .
, grep inetd ,
. : ,
( )
grep , , .
, grep - , ps,
, grep ( ps ). grep
.
inetd:
kill 1 156
, HUP . , , , : man .
, (root) .
KILL ( 9) :
kill 9 PID.

kill KILL PID


kill ,
: UNIX
. ,
"" Solaris.
,
pkill killall ( "" ).
.
.
, NICE
. nice,
.
Solaris :
nice -n
,
nice n 5 ls

152
"5" NICE 5, .. 5
. root nice n -4 ls.
, .. NICE 4.
renice:
renice -n PID
renice
( man renice).


( ,
).
. , jobs, bg fg
,
.
11.


, , -
. , , ( )
( ). , "" , , , .
13 !
- ? , ?
,
- . , , . . ( ) ,
() () .
, , . , UNIX at, crontab.

at
(
) at. ,
/var/spool/cron/atjobs/. Solaris , . cron, . UNIX cron , at,
- atd.
at , :
at time date

153
time HH:MM (:), midnight, noon, now,
AM PM .
_ [], MMDDYY, MM/DD/YY, DD.MM.YY.
now+ n , minutes, hours, days, weeks.
today tomorrow.
time date , time
, .
at .
at l ( atq)
at r , at l.
at r atrm. Solaris .
at.
at ,
/usr/lib/cron/at.allow. , ,
/usr/lib/cron/at.deny ( , at).
, at ,
1) solaris.jobs.user ( root).
/usr/lib/cron/at.deny , at.
at.deny at.allow .
at crontab . cron
,
, /etc/shadow.
, cron, , .
cron .
m at crontab (. ). /bin/sh
(.. , ).
. , ,
at, .
ls /var/spool/cron/atjobs/
.
date
15 2004 19:10:29
.
at 1912
at> touch /tuition
at> <Ctrl-D>
commands will be executed using /sbin/sh

154
job 1084633920.a at 15 19:12:00 2004
, , :
ls /var/spool/cron/atjobs/
1084633920.a
at l (
, , ,
, ).
at -l
user = root

1084633920.a

15 19:12:00 2004

tuition :
ls /
bin
boot
cdrom
core
dev

devices
etc
export
home
kernel

lib
lost+found
mnt
net
nsmail

opt
platform
proc
sbin
test

tmp
TT_DB
usr
var
vol

xfn

? :
date
15 2004 19:11:42
( !) /tuition ! :
date
15 2004 19:12:12
ls /
bin
boot
cdrom
core
dev

devices
etc
export
home
kernel

lib
lost+found
mnt
net
nsmail

opt
platform
proc
sbin
test

tmp
TT_DB
tuition
usr
var

vol
xfn

cron
cron ,
( Solaris 100 ). at ,
"at" , , crontab . cron.
crontab.
crontab e. ( vi), crontab. , .
crontab: , 6 :
mm

hh

dd

mo

dw

mm 0 59

command

155

hh 0 23
dd 1 31
mo 1 12
dw 0 7, 0 7 .
command , (, ).

, , ( ) .
" ", , " ".
, , , .
,
12 10 * * 0 rm -rf /var/log/*.[0-9]
, 10:12 *.[0-9] /var/log.
,
12 10 10 * 0 rm -rf /var/log/*.[0-9]
" 10:12 ",
" 10:12 , ".
at, ,
/bin/sh.
.
PATH:
PATH=/usr/bin:/usr/sbin:/usr/local/bin
, PATH.
PATH SHELL HOME, MAILTO.
HOME ( ) /etc/passwd. LOGNAME . , . BSD- USER, Solaris .
LOGNAME USER , HOME SHELL . cron
crontab, (,
). MAILTO
, cron , ,
, . MAILTO
, .
crontab :
_ =
,
.
.
crontab crontab -l,

156
crontab r. crontab
crontab __.
: - crontab, .


Solaris . ,
/var/admin/cron/ /etc/periodic/.
crontab -e
22 * * * * /var/admin/cron/hourly
22 22 * * * /var/admin/cron/daily
2 22 * * 0 /var/admin/cron/weekly
2 2 1 * * /var/admin/cron/monthly
hourly (ping),
,
(syslog, sendmail, named, sshd) ps, (log rotation), ( 1-2 ,
, - ).
daily (
mailq), (ntpdate, rdate).
weekly ( , , ; ,
?), passwd, shadow, hosts.allow hosts.deny, ftpd, sendmail, utmp wtmp .
monthly , .
, smbd samba, , SUID
.

1)

157

10. :
Solaris, , - , , , . , :
1. , ?
2. ?
" ?" ,
", ?" .
. -, man.
""1) : " !" , ( , ), man. 1, man UNIX,
.
, . , ,
. , , , man . . , 1234 , IVAN1 ivan
95% ivan. ,
IVAN1 ivan. ,
!
: , ,
man . , See Also.
, .
-, -. , http://www.intuit.ru/department/os/intadmsolaris10/10/www.sun.com. Sun
Microsystems , , .
.
-, - ,
(
http://www.intuit.ru/department/os/intadmsolaris10/10/www.google.com,
http://www.intuit.ru/department/os/intadmsolaris10/10/www.metacrawler.com). , - . , ,
, - .
, !
, , ,
Solaris. ,
( Solaris, ):

http://groups.yahoo.com/group/solarisx86/ Solaris ( );
http://www.sun.com/bigadmin/discussions/ (),
Solaris;

158

http://developers.sun.com/forums Solaris.

, , ,
, .
.
: , . , ,
.
, . Solaris,
, Solaris 9.
-, . ,
nameserver'a
(!) man named, man resolv.conf. , : " ?"
-, " ,
name-?", " ?". ,
, , . , ? " ?"
, : " ?"
-, . FreeBSD Solaris, . , FreeBSD Linux, , ( !)
Solaris 9.
, , ,
.


UNIX . Solaris /usr/share/man/
man. xman .
, . , .
Solaris ,
. , , , , , - .
Solaris, UNIX, , .
, " ?" , , -

159
:

apropos man k ;
man - SEE ALSO

Solaris
Solaris . ,
, , , .
, , , local, new public.
. ,
, , passwd (1) passwd (4), , . , passwd 1 passwd, passwd 4
/etc/passwd. man , , 1 1m,
1b, 1c, 1f, 1s. , ,
man intro. intro , intro (1) intro (9).
. , ,

man s N intro
N , ( 1 9).
10.1 Solaris.
UNIX 8, ; Solaris , , 1. 8 Solaris .
10.1. Solaris
1
2
3
4
5
6 -
7 , ,
9
,
halt(1M). (halt), (1M). -
. (
man(1).)
. , grep :
#man grep
:
Name

160
grep - search a file for a pattern
Synopsis
/usr/bin/grep [-bchilnsvw] limited-regular-expression [filename...]
/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvwx] -e pattern_
list... [-f pattern_file]... [file...]
/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvwx] [-e pattern_
list...] -f pattern_file... [file...]
/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvwx] pattern
[file...]
Description
The grep utility searches text files for a pattern and prints all
lines that contain that pattern. It uses a compact non-deterministic
algorithm.
Be careful using the characters $, *, [, ^, |, (, ), and \ in the
pattern_list because they are also meaningful to the shell. It is
safest to enclose the entire pattern_list in single quotes `... `.
If no files are specified, grep assumes standard input. Normally, each
line found is copied to standard output. The file name is printed
before each line found if there is more than one input file.
/usr/bin/grep
The /usr/bin/grep utility uses limited regular expressions like those
described on the regexp(5) manual page to match the patterns.
/usr/xpg4/bin/grep
The options -E and -F affect the way /usr/xpg4/bin/grep interprets
pattern_list. If -E is specified, /usr/xpg4/bin/grep interprets
pattern_list as a full regular expression (see -E for description). If
-F is specified, grep interprets pattern_list as a fixed string. If
neither are specified, grep interprets pattern_list as a basic regular
expression as described on regex(5) manual page.
Options
The following options are supported for both /usr/bin/grep and /usr/
xpg4/bin/grep:
-b
Precede each line by the block number on which it was found. This can
be useful in locating block numbers by context (first block is 0).
-c
Print only a count of the lines that contain the pattern.
-h
Prevents the name of the file containing the matching line from being
appended to that line. Used when searching multiple files.
-i
Large File Behavior
See largefile(5) for the description of the behavior of grep when
encountering files greater than or equal to 2 Gbyte ( 2 **31 bytes).
Examples
Example 1: Finding all uses of a word
To find all uses of the word "Posix" (in any case) in the file text.
mm, and write with line numbers:
example% /usr/bin/grep -i -n posix text.mm
Example 2: Finding all empty lines
To find all empty lines in the standard input:
example% /usr/bin/grep ^$
or
example% /usr/bin/grep -v .
Example 3: Finding lines containing strings
Both of the following commands print all lines containing strings abc
or def or both:
example% /usr/xpg4/bin/grep -E `abc def
example% /usr/xpg4/bin/grep -F `abc def
Example 4: Finding lines with matching strings
Both of the following commands print all lines matching exactly abc or

161
def:
example% /usr/xpg4/bin/grep -E `^abc$ ^def$
example% /usr/xpg4/bin/grep -F -x `abc def
Environment Variables
See environ(5) for descriptions of the following environment variables
that affect the execution of grep: LC_COLLATE, LC_CTYPE, LC_MESSAGES,
and NLSPATH.
Exit Status
The following exit values are returned:
0
One or more matches were found.
1
No matches were found.
2
Syntax errors or inaccessible files (even if matches were found).
See Also
egrep(1) , fgrep(1) , sed(1) , sh(1) , attributes(5) , environ(5) ,
largefile(5) , regex(5) , regexp(5) , XPG4(5)
Notes
/usr/bin/grep
Lines are limited only by the size of the available virtual memory. If
there is a line with embedded nulls, grep will only match up to the
first null; if it matches, it will print the entire line.
/usr/xpg4/bin/grep
The results are unspecified if input files contain lines longer than
LINE_MAX bytes or contain binary data. LINE_MAX is defined in /usr/
include/limits.h.
man grep , grep, - .
, ,
.
, Solaris grep
(/usr/bin/grep) (/usr/xpg4/bin/grep).
, , .


.
, ,
.
NAME . NAME .
SYNOPSIS
. ,
, .
DESCRIPTION . , , ,
.
OPTIONS () , , , -

162
, .
SEE ALSO (". ") ,
.
, , , man k .
.
apropos(1) , , "apropos"2).
- (
man) </> .
. (/),
.


, , Solaris: , Sun
Microsystems, ( , ), , Fidonet, .

FAQ
, Solaris. sun.com (bigadmin.sun.com, docs.sun.com
..). FAQ , , , . , FAQ : , -
.

Sun.com
Sun Microsystems .
, bigadmin.sun.com.

developers.sun.ru
2008 ,
developers.sun.ru. , Sun Microsystems .

Opennet
Solaris solaris.opennet.ru. , , , , . ; ,
, Solaris
UNIX: .
, Opennet, solaris.opennet.ru:
" 1998 gene.chat.ru ( ),

163
solaris.opennet.ru .
solaris.opennet.ru gene.chat.ru,
,
, ,
. 2001 , . , , opennet.ru,
Solaris, .
: http://web.archive.org/web/19990901211748/ http://solaris.opennet.ru/
, ,
http://solaris.opennet.ru/mp/solaris/

Fido7
Fido nntp Usenet,
www.fido7.ru, Solaris http://groups.google.com/groups?group=fido7.ru.unix.solaris.
Fidonet ( Fido) ,

. , Fido , .
, , ,
() Usenet. : .


, , google.com,
metacrawler.com, yahoo.com .
?
, , .
, , .
. , , ,
, . , ,
( ), . .
, : , , , . ,
/dev/rdsk/c0d0t3s1: can't check file system
(c0d0t3s1); , ,
. ,
.

, ,
. , -

164
" nameserver ".
, ,
Solaris, , "keyboard layout"
"language layout", "keyboard switcher".
! Solaris UNIX
++ , perl , . , !
- . , . , , Solaris ,
-, ,
Solaris -, -.
,
metacrawler.com .


, , ,
.
, , . -
, , , .
, , :

. " ?" . ""? ? ?


?
uname a. .
, .
/var/log/messages, ,

:
("
"), plain text ( UTF-8),
, , (!) , ,
-3).

:
( !) . Open Office Solaris 9.
"" , ,
CDE. ""?
-, man. - "print screen"

165
screenshot man k .
-, . "" , FAQ
. google ,
. screenshot. ,
Solaris 9 screenshot
""... ... ! "to easily and quickly capture
a screenshot" docs.sun.com. ... "SDTImage Enhancements: The SDTImage screen snapshot feature now enables users to easily and quickly capture a
screenshot image from the command line."
, , , , ! ,
CDE, Solaris 8. SDTImage?
man k sdtimage.
bash-2.05# man -k sdtimage
sdtimage
sdtimage (1)
bash-2.05#

Image viewer for CDE

, ...
sdtimage&

. 10.1. File sdtimage


... , File Snapshot!
! ...
, GNOME Solaris 10 -

166
/usr/bin/gnome-screenshot --interactive.

Paul Gallico. Jenny. UK First Edition:1950.


Apropos (.) , ; .
3)
, Solaris
. "UNIX. " , UNIX , Solaris . , , ,
,
, (.).
1)
2)

167

11. :
: Solaris UNIX
-, Solaris System V , , , ,
BSD. BSD,
System V BSD [1]
, .
-, Solaris System V
, s S. . System V (0-6) .
, , Linux, . , Solaris /etc/rc0.d, /etc/rc1.d ..,
Linux /etc/rc.d/rc0/, /etc/rc.d/rc1/ .. , , System V, man init.
-, Solaris
: shutdown, reboot, halt, poweroff, init.
, , System V init
shutdown. ,
, .
: -
UNIX System V, man init, man
shutdown.
Solaris 10, Solaris Service Management Facility (SMF),

. SMF , Solaris
. SMF - Solaris :
- , ,
, SMF.
Solaris 10 svcs, svcadm svccfg.



. , - . ,
.
, : ,
-, , , .
:
, , . ,

, , , -, ,
, .
, , , . UNIX System V, Solaris, . , ,

168
. Solaris (0-6 S s,
s S ).
(runlevel) (state) . , , ,
/etc/inittab. ,
.
/etc, , /etc/rcN.d. (N 0 6 S)
0 /etc/rc0, 1 /etc/rc1 . Solaris.

0
, (firmware) SPARC, x86 . 0
.

1
. , , , , . ,
. 1 .

s, S
s ( S) . , , , . ; , , .
, , . s , /usr . , s, ; , , s .
s /etc/inittab,
. S , , , . ,
, , , , utmpx (.. ),
. , ttymon , SAC, S.

2
. , , .

3
; , 2, -

169
( NFS).

4
. , 2 3,
.
.

5
; , , , . .

6
,
initdefault /etc/inittab.
.
touch /reconfigure
.


, UNIX, System V, Solaris Solaris 10 "" (milestone). "",
"" , .
.
" " (.. , ) ,
SMF, .. svcs, svcadm svccfg.
13 "
Solaris 10" " SMF".
,
, init,
init svc.startd. " " . ,
Solaris 10, :
1. init ( ), /etc/default/init . TIMEZONE, Solaris Express
:
2.
TZ=Europe/Moscow
3.
CMASK=022
4.
LC_COLLATE=ru_RU.UTF-8
5.
LC_CTYPE=ru_RU.UTF-8
6.
LC_MESSAGES=C
7.
LC_MONETARY=ru_RU.UTF-8
8.
LC_NUMERIC=ru_RU.UTF-8
9.
LC_TIME=ru_RU.UTF-8
10. init /etc/inittab , " -

170
" sysinit, , ;
11. init svc.startd.

Solaris 10 SPARC
(firmware)
(power-on self-test POST). , , .
, , , .
eeprom Solaris
ok,
firmware .
, , ufsboot, , inetboot, .

DHCP RARP/bootparams,
, ( DHCP
DHCP-).
boot OpenBoot ( , firmware)
:
boot net:rarp
boot net:dhcp
( ):
boot net
,
net.
RARP/bootparams
ARP- ( ARP- . 3
" Solaris 10") , , - TFTP
inetboot . TFTP- inetboot,
, ARP-,
, . inetboot
bootparams (. man bootparams ). , , NFS
.
DHCP
DHCP , MAC- , -

171
IP-, .
inetboot , inetboot , ,
, , inetboot. dhcpagent, DHCP.

: . , , .
( /),
, . /platform/platform-name. SPARC /platform/hardware-class-name. ,
, .
.
, , , , ,
, firmware boot.conf. , ", ".
OpenBoot. boot
SPARC (POST), firmware, ,
OpenBoot.
.
ok
boot OpenBoot.
boot :
boot [device] [arguments]
boot , , boot-device diag-device
(NVRAM variable). ,
bootdevice boot-file diag-device diag-file.
boot ,
OpenBoot, . boot , boot-file diag-file . ,

boot s
"-s" , boot-file diag-file .
boot net

172

boot cdrom
, boot-file diag-file
. , boot-file 64- ,
CD-ROM boot cdrom, , CD 32- .
boot , ok :
SPARC-
boot as , , ;
boot kernel/unix as 32-
( );
boot kernel/sparcv9/unix as 64- ( ).
boot man boot;
, , firmware, .

Solaris 10 x86
x86 :
. BIOS BIOS .
POST , , - USB , , , . , , . real mode , (32-bit protected mode).
Linux GRUB UFS, - NFS.
Solaris 10 1/06 . Solaris 10 3/05 DCA (device configuration assistant). DCA, .
, DCA .
DCA /etc/bootrc,
. /etc/bootrc b , i
.
boot -

173
, x86 >
b kernel/unix as
, , .

,
/platform/platform-name/ufsboot

/etc/inittab

, , init ; ,
( "initdefault")

/sbin/init

,
; init

/platform/platform-name/boot.conf,
/platform/hardware-classname/boot.conf


, .

/platform/platform-name/kernel/unix ( ) 32-
SPARC 86
/platform/platform ( ) 64-
name/kernel/sparcv9/unix
SPARC
x86 ( Solaris 10 1/06 ):
/etc/bootrc

/platform/platformname/boot/solaris/boot.bin

, x86 ufsboot

/platform/platform-name/boot

UltraSPARC
SPARC 64-
Solaris, firmware , . 64-
Solaris, ,
firmware , 32-
.
UltraSPARC-1 200 M , - 64- , . , Solaris 32- , 64-
32- .
Sun , , , , ,
,
, .
, , , ,

174
64- . /platform/platform-name/boot.conf :
ALLOW_64BIT_KERNEL_ON_UltraSPARC_1_CPU=true


, ,
. UFS, . ufsboot.
,
, ufsboot . /etc/vfstab
/sbin/init . /sbin/init, ,
, /etc/inittab, svc.startd.
Solaris 9 /etc/inittab
initdefault. Solaris 10 SMF,
, .
milestone/multi-user-server. , ,
/var/svc/profile/generic.xml, , ,
/var/svc/profile/generic_open.xml. SMF 13 " Solaris 10".
Solaris , .. ( /etc/system), ,
. .
, . , , , ,
, , .. . , . ,
, , , , , .
, ,
modinfo
/kernel /usr/kernel, /platform/`uname m`/kernel /platform/` uname
i`/kernel ( ).
, ,
/etc/system, . , .
, /etc/system , :

, , ;
, , , ;
, ( );
, ,
.

/etc/system Solaris 10 (
):

175
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

SYSTEM SPECIFICATION FILE


moddir:
Set the search path for modules. This has a format similar
to the csh path variable. If the module isn't found in the
first directory it tries the second and so on. The default
is /kernel /usr/kernel
Example:
moddir: /kernel /usr/kernel /other/modules
root device and root filesystem configuration:
The following may be used to override the defaults provided
by the boot program:
rootfs:

Set the filesystem type of the root.

rootdev:

Set the root device. This should be a


fully expanded physical pathname. The
default is the physical pathname of the
device where the boot program resides.
The physical pathname is highly platform
and configuration dependent.

Example:
rootfs:ufs
rootdev:/sbus@1,f8000000/esp@0,800000/sd@3,0:a
(Swap device configuration should be specified in /etc/vfstab.)
exclude:
Modules appearing in the moddir path which are NOT to be
loaded, even if referenced. Note that `exclude' accepts
either a module name, or a filename which includes the
directory.
Examples:
exclude: win
exclude: sys/shmsys
forceload:
Cause these modules to be loaded at boot time, (just before
mounting the root filesystem) rather than at first
reference. Note that forceload expects a filename which
includes the directory. Also note that loading a module
does not necessarily imply that it will be installed.
Example:
forceload: drv/foo
set:
Set an integer variable in the kernel or a module to a new
value. This facility should be used with caution. See
system(4).
Examples:
To set variables in 'unix':
set nautopush=32

176
*
*
*
*
*
*

set maxusers=40
To set a variable named 'debug' in the module named
'test_module'
set test_module:debug = 0x13

!
!
cp /etc/system /etc/system.bak ,
!
, ,
, .
(2) , /etc/system . , :
1. boot a ;
2. system, (,
/etc/system.bak);
3. (1) (,
!) , system /dev/null .
, /etc/system :
set =
, MAXUSERS 50 :
set maxusers = 50
, (, unix)
, , ,
:
set :=
/etc/system 80 , , "*" "#", .
, ,
sysdef, , , ( ,
20 ):
sysdef
*
* Hostid
*
0930edc1
*
* i86pc Configuration
*
*
* Devices

177
*
scsi_vhci, instance #0
isa, instance #0
i8042, instance #0
keyboard, instance #0
mouse, instance #0
motherboard (driver not attached)
asy, instance #0
lp, instance #0
asy, instance #1
pit_beep, instance #0
pci, instance #0
pci1025,10a (driver not attached)
pci1002,5a34, instance #0
display, instance #0
pci1002,5a36 (driver not attached)
pci1002,5a37 (driver not attached)
pci1002,5a38 (driver not attached)
pci1002,5a39, instance #4
pci1468,422, instance #0
pci-ide, instance #0
ide, instance #0
cmdk, instance #0
ide (driver not attached)
pci1025,10a, instance #0
pci1025,10a, instance #1
mouse, instance #2
pci1025,10a, instance #0
device, instance #0
pci1025,10a (driver not attached)
<...>
*
* Loadable Objects
*
* Loadable Object Path = /platform/i86pc/kernel
*
kmdb/amd64/cpu.generic
kmdb/amd64/cpu_ms.AuthenticAMD.15
kmdb/amd64/pcplusmp
kmdb/amd64/unix
kmdb/amd64/uppc
kmdb/cpu.generic
kmdb/cpu_ms.AuthenticAMD.15
kmdb/pcplusmp
kmdb/unix
kmdb/uppc
drv/amd64/xsvc
drv/xsvc
drv/amd64/cpc
hard link: sys/amd64/cpc
drv/cpc
hard link: sys/cpc
misc/amd64/cpr
misc/cpr
drv/amd64/nxge
drv/nxge
drv/amd64/pci-ide
drv/pci-ide
amd64/unix
cpu/amd64/cpu.generic
cpu/amd64/cpu_ms.AuthenticAMD
cpu/amd64/cpu_ms.AuthenticAMD.15
cpu/amd64/cpu_ms.GenuineIntel
<...>

178
*
* Loadable Object Path = /usr/kernel
*
drv/ncall
drv/nsctl
drv/nskern
drv/sdbc
drv/amd64/sv
drv/sv
drv/amd64/pool
drv/pool
drv/amd64/zcons
drv/zcons
drv/amd64/winlock
drv/winlock
drv/amd64/ii
drv/ii
drv/amd64/ipf
drv/ipf
misc/spuni
misc/amd64/spuni
drv/amd64/pm
drv/pm
<...>
*
* System Configuration
*
swap files
swapfile
dev
swaplo
blocks
free
/dev/dsk/c0d0s1
102,1
8
4209016 4036480
*
* Tunable Parameters
*
32006144
maximum memory allowed in buffer cache (bufhwm)
24426
maximum number of processes (v.v_proc)
99
maximum global priority in sys class (MAXCLSYSPRI)
24421
maximum processes per user id (v.v_maxup)
30
auto update time limit in seconds (NAUTOUP)
25
page stealing low water mark (GPGSLO)
1
fsflush run rate (FSFLUSHR)
25
minimum resident memory for avoiding deadlock (MINARMEM)
25
minimum swapable memory for avoiding deadlock (MINASMEM)
*
* Utsname Tunables
*
5.11 release (REL)
solaris node name (NODE)
SunOS system name (SYS)
snv_79a version (VER)
*
* Process Resource Limit Tunables (Current:Maximum)
*
0x0000000000000100:0x0000000000010000 file descriptors
*
* Streams Tunables
*
9 maximum number of pushes allowed (NSTRPUSH)
65536 maximum stream message size (STRMSGSZ)
1024 max size of ctl part of message (STRCTLSZ)
*
* IPC Messages module is not loaded
*
*
* IPC Semaphores module is not loaded

179
*
*
* IPC Shared Memory
*
* The IPC Shared Memory module no longer has system-wide limits.
* Please see the "Solaris Tunable Parameters Reference Manual" for
* information on how the old limits map to resource controls and
* the prctl(1) and getrctl(2) manual pages for information on
* observing the new limits.
*
*
* Time Sharing Scheduler Tunables
*
60 maximum time sharing user priority (TSMAXUPRI)
SYS system class name (SYS_NAME)

init /etc/inittab
init /etc/vfstab.
init , .
Solaris 10 /etc/inittab, , init ,
,
svc.startd. /etc/inittab Solrais 10:
ap::sysinit:/sbin/autopush -f /etc/iu.ap
sp::sysinit:/sbin/soconfig -f /etc/sock2path
smf::sysinit:/lib/svc/bin/svc.startd
>/dev/msglog 2<>/dev/msglog
</dev/console
p3:s1234:powerfail:/usr/sbin/shutdown -y -i5 -g0 >/dev/msglog
2<>/dev/msglog
pt:s1234:powerfail:/usr/lib/svc/method/installupdates lock
STREAMS,
, svc.startd, .
.
inittab Solaris
Solaris 10, .
/etc/inittab ,
inetconv. /etc/inittab . /etc/inittab
legacy_run , ()
SMF. , ,
/etc/inittab .


/etc/rcN.d . , .
KnnNAME SnnNAME, nn , NAME
( ).
, S (start) , , K (kill) . nn : , .

180

, , . 3, milestone/multi-user-server.
, , /etc/rcN (N
0 6 s), init. /etc/rcN /sbin/rcN (. /etc/inittab ).
, /etc/rc3.d (. . 11.1), S13kdc.master, S14kdc ( S90samba).

. 11.1. /etc/rc3.d
Solaris 10 (, , Solaris)
/etc/rcN.d, svc.startd,
. /etc/inittab
/etc/rcN.d, , " init /etc/inittab", , .

shutdown, init, poweroff, halt, reboot


, , .
Solaris :
/usr/sbin/shutdown
/sbin/init
/usr/sbin/halt
/usr/sbin/reboot
/usr/sbin/poweroff
Stop+A L1+A

181
/usr/sbin/shutdown, /sbin/init, /usr/sbin/halt
, ,
( ).
/usr/sbin/reboot
, initdefault /etc/inittab.
/usr/sbin/poweroff 5, ..
init 5.
( <Stop+A> <L1+A>) SPARC, .
, ,
, ,
.

shutdown
shutdown, UNIX'e.
Solaris :
shutdown [-y] [-g_ [-i]

shutdown y g0

. (3)
.
, 0, . , . (shutdown state).
, , , . . , , . shutdown
/etc/default/shutdown, . shutdown
,
60 . , . :

-y , ;
-g _, _ ( );
-i , ,
. s.

/etc/default/shutdown , -

182
.
shutdown - . , ,
, shutdown. , shutdown, ,
.
y, : .
, , . .
Solaris (),
.
shutdown ,
.
, shutdown , , : .
,
shutdown, , . UPS , , ,
;
, shutdown . , UPS ,
.

init
init . .
init _
, a, b, c q. a, b, c
, , init , /etc/inittab
.
init q
init /etc/inittab. , , ,
init q.
telinit init,
init.
init 1 :

183
INIT: New run level: 1
Changing to state 1.
Unmounting remote filesystems: /vol nfs done.
System services are now being stopped.
May 14 13:13:22 unknown /usr/sbin/vold[475]: problem unmounting /vol;
Interrupted system call
< - ....>
Killing user processes: done.
Change to state 1 has been completed.
Type control-d to proceed with normal startup,
(or give root password for system maintenance):
, , .
; , CtrlD, .

halt
( shutdown y g0)
halt. shutdown , . - , ,
.
halt .

reboot
reboot
. , shutdown, (/etc/rcN.d/K*)
. reboot , ,
halt.
reboot OpenBoot, ,
reboot -- -rs
, reboot , , .

poweroff
poweroff 5 init 5. , K* ,
, ,
.



reboot. , "". , , Windows 98, Solaris, ,

184
, .
"" , Stop+A L1+A ( SPARC). firmware. , , Break.
OpenBoot (
), OpenBoot .
, ,
. , USB.
:

Stop POST
(Power-on self test). SPARC POST, , POST, Stop+D.
<Stop+A> OpenBoot.
<Stop+D> ( diagswitch? OpenBoot true.
<Stop+F> Forth Monitor (, , ). Forth Monitor
Forth (), Forth Monitor
. Stop+F Forth Monitor ttya . fexit. Forth Monitor
.
<Stop+N> NVRAM .

, , /etc/default/kbd. . kbd i
.
, , , OpenBoot
.


- , Solaris Solaris 10.
Solaris 10 SMF
, . (,
init, svc.startd svc.configd). all,
none. SPARC :
ok boot -m milestone=all

ok boot -m milestone=none
.

185
.


, :
1. Stop+A L1+A ( ,
/etc/default/kbd);
2. ok, sync
( );
3. syncing file systems... done, Stop+A L1+A;
4. reset ok.
, :
# who r
run-level 3 May 9 05:29 3 0 S
, .


, , .
:
1. (, ..);
2. ;
3. ( , ).

186

12. :


. CDE , . .
Enter (
, , , ).
.
UNIX , (shell).
( ) ( , ,
).
, UNIX. Solaris ksh, csh bash.
UNIX 1976 (Steve Bourne),
Bell Laboratories AT&T. ( , 1974 .)
University of California Berkeley C-shell (csh,
" "), . Bourne again shell (bash), GNU
Korn shell (ksh) (David Korn).
-shell (University of California Berkeley) (Bill Joy), Berkeley Sun Microsystems.
UNIX vi
BSD UNIX.
1970- tcsh, csh, , . (Ken Greer) tcsh
- (Carnegie-Mellon University), (Paul
Placeway) (Ohio State). tcsh
csh
(, ,
). UNIX csh tcsh,
csh ,
.
Solaris , sh,
csh, tcsh, bash ; sh.
12.1. UNIX

Bourne
Shell

sh

,

,

C Shell

csh

- ,

187
Korn Shell

ksh

sh

csh, - ,
, (history)
,

Bourne
bash
Again Shell

ksh , ( , - )
.
- Linux, Solaris 9 ,

, ;
;
;
;
;
;
.

(. 12.2).
12.2. shell'

sh csh tcsh ksh bash

History

1)

2)

3)


(
), - ( ). . , sh ; bash.

bash
bash. .
, ( ), . /etc,
.
( login shell, , ),
login- : login- /etc, , . Login- ;

188
. :
..
login-, ; , .
,
. , , login-.
12.3.
shell

sh
csh

login-
/etc/profile, ~/.profile

/etc/csh.cshrc, ~/.cshrc /etc/csh.login, ~/.login

ksh

/etc/profile, ~/.profile

bash ~/.bashrc

/etc/profile, ~/.bash_profile ~/.profile

bash, , login-. login shell, /etc/profile,


. ~/.bash_profile.
, bash ~/.bash_login, ,
~/.profile. bash login shell,
~/.bashrc. bash sh (.. 9sh bash),
, sh.


( ).
, .
. sh, csh, tcsh ~/.history, bash
~/.bash_history, ksh ~/.shhistory, Korn Shell (public domain Korn
shell pdksh) .

. , ,
" ".
.
, , , - .
. , - lynx mysql, :
lynx ftp://user:password@URL
mysql u root p password
, - .
. , bash 500 , tcsh
1000, csh 100, sh . sh .history
, .
, ,
.

189
12.4.
shell
sh

HISTSIZE

csh

history

100

ksh

HISTSIZE

128

bash HISTFILESIZE 500


. ,
, ,
alias telent telnet
:
alias
,
:
alias ll 'ls l'
, ls
ls l
.
.
alias:
alias
sh

alias ll='ls l'

csh

alias ll 'ls l'

ksh

alias ll='ls l'

bash

alias ll='ls l'

-x

, , - , .. " " . alias. alias .



unalias .


9, , . -

190

$_.
, echo $TERM TERM. . , . ,
, "".
, ,
, .

$i=2
$j=3
expr $i \* $j
, csh,
VAR=value
csh :
set VAR=value

setenv VAR value


DISPLAY, TERMINFO .. , .
.
, .. - .
export _
, (
, ),
unset.
tsch , :
set r =.
, tcsh , , 1:
set var=(hello world)
echo {$var[1]}
hello
echo {$var[2]}
world

191
set .


, . , csh (,
, tcsh) : PATH, USER, TERM, PS1, PS2.
.
,
, ,
, , .

12.5.
, .
set
,
. $1..$9.
$0 , . , , - (symbolic
links).
12.5.

HOME

SHELL

shell

PS1

shell'a

PS2

" "

TERM

USER
LOGNAME

PATH

, ,
, , .

shift n (n ) ""
$1..$9 , .
Shift shift 1. csh "" .

12.6
12.6.

shell'a

192
*

1,2,..9

.

. ,
/var/log/messages.?, " /var/log, messages., ". , :
ls -l /var/log/messages.?
"?" , .
, .
, . regex,
-.
(
, metasymbols wildcards).
12.7.

, .

[...]

(, [avgf]) (, [az])

:
, , , .
, money.c, money.bak, money.obj wallet.x,

ls l money.*

ls l money.c money.bak money.obj



: , *.html
Siemens Nixdorf. ,
, .
Bourne Shell, :

193
for i in *.html
do
sed 's/Siemens/Nixdorf/g' <$i >tmp
mv tmp $i
done
i , ..
; , *.html.
sed Siemens Nixdorf, sed , i. tmp, mv
tmp *.html .
, *.html , ?
UNIX , :
"" , , .
, *.html ,
.
find :
find . -name "*.html"
" "
:
for i in ` find . -name "*.html" `
do
sed 's/Siemens/Nixdorf/g' <$i >tmp
mv tmp $i
done
, ` ` ( ), , . .


"" ( "") (file name completion)
<Tab>.
"" . , /usr/sadm/admin/bin/printmgr,
/usr/sa<Tab>dm/a<Tab>dmin/b<Tab>in/pr<Tab>intmgr
bash tcsh.
, , .
<Tab> .

194
, , msg: msg01.txt msg02.txt
, more msg<Tab><Tab>
bash ( tcsh) :
msg01.txt

msg02.txt

1 2, , ,
<Tab> .
<Tab> bash , :
There are 1102 possibilities. Do you really
wish to see them all? (y or n)
n: .


, -
. sh , . bash.

<backspace> <Ctrl-U>.
(, @ ,
). .
bash tcsh "", . bash Enter , ,
Enter. , ,
, Enter,
. , Enter.
ksh , Esc4).
,
VISUAL EDITOR. vi.
, :
!
csh tcsh , bash.


, ;
.
,
.
,

195
lyxn p proxy.spb.edu:3128 www.macropulos.cam.ac.uk
"command not found", lynx, . !
, " ", ,
. , csh, tcsh
bash:
^xn^nx
,
xn nx. !
csh, tcsh, bash .
:

!n (n ) n- 5)
!!
!str , str

csh tcsh - !nstr, ,


`!67r'. csh 67, r ,
tcsh 67r . tsch
, . tcsh
csh, ,
: `!\6\7r'.
bash , csh. "" "" , .
ksh r, sh fc,
sh , ,
sh .
, bash ,
<Ctrl-R> ; .


,
, . ,
, .
, . , .
(, Bourne Shell) : jobs, fg, bg.
jobs.
(PID) , ,
jobs l.
, find *.gif, -

196
~/gifs (.. , gifs):
find / -name "*.gif" > ~/gifs &
[1] 33151
jobs l
[1]+ 33151 Running
find / -name "".giff" > ~/gifs &
, [ ], .
shell'. fg (foreground):
fg

%1

# %1

. , suspend (sleeping, ):
<trl-z>
[1]+ Stopped

find / -name "".giff" > ~/gifs

bg (background):
bg

%1

. & , , !
Ctrl-Z, "" ,
bg.
bg fg -. , %, , : .


, . sh csh- . sh, ksh, bash.
csh tcsh. sh ,
UNIX, . csh
, . ,
csh,
.
,
:
#!__

#!/bin/sh
.
/bin/sh, . tcsh ,
tcsh, tcsh .

197
sh
sh . .
. ""
,
( ).

" " ( PS2
prompt2).
break ( ,
) continue ( , ). , sh, csh.
if:
if then

else

fi
bash, ksh sh elseif ( ):
if then

elseif then

fi
else

fi
case _ of
1) ; break;
2) ; break;
3) ; break;
*) ;
esac
"" (*) " ", ..
1, 2, 3.
while (, ) until ( , ):
while do

done
until do

done
, .
( ), .
, , . UNIX ,

198
. , , man.
, , test. test, test
. test
:
if test e _ then echo " !"
sh [ ] test:
if [ e _ ] then echo " !"
.
test [ ] , man test man sh, man bash.
.
. , . , pppd :
while sleep 10
do
/usr/sbin/pppd
done
sleep , pppd , , , - .
, , - .
Solaris System V , BSD-,
, pppd /etc/inittab respawn (, ).
for ( ):
for _ in do

done
for , , . , *.html :
for i in *.html
do
sed 's/otello.gif/dezdemona.gif/g' <$i>tmp
mv f tmp $i
done
sed , , tmp ( ,
) tmp , .

199
, , .
sed: $i, i, i, i.
, $i, , .
, / .
mv f, ,
" ?"
sh echo.
, .

echo n
.
sh read:
read name
echo "Name is $name"
, , ,
. man

csh
csh break ( , ) continue ( ,
) , sh.
sh csh . , :

csh ;
csh until; , sh.

csh tcsh ,
. test ,
.
if ()

if () then

else if () then

else

200

endif
elseif,
endif.
, else endif , if else .
csh switch:
switch

()
case 1:

breaksw
case 2:

breaksw
default:

breaksw

endsw
switch csh switch , breaksw
endsw.
while , while sh, :
while ()

end
for csh foreach, Perl:
foreach

_ ()

end
foreach , csh
"foreach?". , , end .
sh $< ( ):
echo " Enter your name:"
setenv name $<
echo "Name is $name"

shell
.
sh $, csh %. (root)
#.

201
PS1 PS2.
.
,
Enter :
\<Enter>
. ;
, 1024 . . >, PS2.
csh tcsh PS1 PS2 prompt prompt2. , , ksh, . PS3, PS4 .., csh prompt3 prompt4.
( , bash) , (, ). . , bash
\w, csh %/. , , , , , bash:
$PS1='\w$'
man .


, , . , . ,
,
-. . 12.8.
12.8. shell'

sh

$*?\`'"[]<>&

csh

$*?\`'"!^{}[]!%<>&

ksh

$*?\`'"!^{}[]!<>&

bash

$*?\`'"!^{}[]!%<>&

(, expr 2 \* 2,
expr , ) \
. ,
, `, $ \, .

202
:

;
( alias);
;
, ` `;
.


csh tcsh
, path,
rehash, .
, .



3)

4)
,
, TERM .
5)
() history.
tail : history | tail.
1)
2)