pp, p p . pp, X, p 8 swap ; gcc (p p , , p ) .. p p p ( , ). , p . p p , p . (, pp p, p , pp pp p.) free(8) ps(1) p p . 2. , p p ( pp pp , p pp), p pp. p . ( p , swap , - 73 - p p swap , pp p p p. . swap .) p p . 3. p , p p , , p . p swap pp p . p p pp swap . ( p p UNIX p p , , p , p .) 4. swap , ( p), , p , pp, p . 6.6 p , p . p p p p. pp, p p , p pp p , , pp p p p p p . p p p p, p, p , p p . p, , , - p. , , p, p pp. p p, p p p. - 74 - p p . p, p (pp, pp , p). p p, p , p pp, p . p p, p pp. p p ( p), p p. p p , .. p (, , p p). p p , .. p . p p , p, : p p , , p p, p. p p . p pp pp p p. sync(8) p p , p, p . p UNIX pp, p, p sync 30 , p . Linux pp-, p sync p p , p sync. , p p , , p p ( Linux p 1 KB). p p p , p , p p , , , . - 75 - p p p. p p p: p p, p p p. p pp p , p p. p p , , p swap ( p ). , Linux p , p pp. Linux p - p p. p pp , p p . . - 76 - 7 p , p p p . p pp p p p, p p, p , p .. 7.1 p p p p p p p p init pp pp getty ( ). Getty p p, p p, ( , - p p). - p, getty p p ( /etc/issue) p , p p pp login pp. Login p p . p p, login , pp , p p p. init p p getty p. p, init p ( fork(2)), getty login pp p ( exec(3)). pp . getty p p p , dial-in , pp p . p pp getty init p . p - 77 - pp , p p ( Linux Software Map). 7.2 p p, p , . p p , pp, p, , p p . pp p , p pp. , p . p, pp p . p, p p , p p pp , p . p p pp, p p. p, p , p p, p . pp getty p. p, . p (.. p p p), p, p , p p p . , p . telnet rlogin. , - 78 - p p (pp, FTP, Gopher, HTTP p ). p p . p, p pp . p inetd ( p p . pp Linux). 7.3 pp login pp login p (pp p ) p pp . p p /etc/motd (p Message Of The Day - ) pp p . p, .hushlogin . /etc/nologin, p . pp shutdown(8) . pp login pp , , pp. , p p p. Login p ( p syslog). p root. , , /var/run/utmp. p p p ( ) p , p p. pp who, w - 79 - , . /var/log/wtmp. p p, p , pp, p cron , . last wtmp. (utmp wtmp) p p (. p utmp(5)) pp pp p. 7.4 X xdm : X p p xdm, xterm -ls. 7.5 p p /etc/passwd. p p p, p p /etc/shadow. p pp NIS - p p . p p p . p p, p p , p , p p . p , , p. p p p . - p p, p p pp p . p - 80 - p p p , root (p p p ). p, p pp, .. p. pp crack p p, p , p . pp , pp pp p. p pp passwd(1). p p /etc/group. p p p /etc/shadow.group. root p, , p p, /etc/securetty. p. p p p , su p root. 7.6 p p . p . p p . p . , pp, Bourne (/bin/sh) /etc/profile, ~/.profile. /etc/profile pp , , p PATH p. p ~/.profile p - 81 - . . - 82 - p A p p EXT2 p Remy Card (card@masi.ibp.fr), Theodore Ts'o (tytso@mit.edu), Stephen Tweedie (sct@dcs.ed.ac.uk), p pp ext2. p p p p p Linux, ISBN 90 367 0385 9. Linux Unix- p , p p PC-386. p p pp p Minix p p p Minix. p p: p 16 , p 64 , p p pp p 14 . pp p , p p p Linux. , "Extended File System" (Ext fs) "Second Extended File System" (Ext2fs), p p . p p Linux. p p p Unix. p p p (VFS) Linux, pp p Ext2fs p p . p p pp Linux BSD. A.1 p p Linux - 83 - p p Linux pp p Minix. p p , pp , Linus Torvalds p p Linux Minix. p pp p . p, pp Minix, , pp Linux. p p p Linux, pp p (VFS). p VFS Chris Provenzano, p Linus Torvalds p p p. pp p A.3. p VFS, p 1992 pp EXTfs (Extended File System) p Linux 0.96c. p Minix: 2 , - 255 . p Minix, p p p. p p , pp p . pp pp, p : p p ppp, p pp . p p 1993 -p : Xia EXT2fs (Second Extended File System). , Xia Minix c . p , - 84 - p p p p p . p p, EXT2fs EXTfs . p. p pp p A.4. , p p. Xia , EXT2fs, . p p p p EXT2fs, . p EXT2fs p - Linux. p p , p p . ------------------------------------------------------------------------------ Minix FS Ext FS Ext2 FS Xia FS ------------------------------------------------------------------------------ 64 2 4 2 64 2 2 64 16/30 . 255 . 255 . 248 . p p p pp pp - 85 - p ? A.2 Linux , p Unix: p pp (inode), p , p , p p p p p. A.2.1 pp p pp, pp. pp p , p , p , , p , pp, . p , ppp , p pp. p p p / , p pp p , p p , p p p /. A.2.2 pp p. p . - . , , p . p p pp . - p , p p pp. , pp p pp, pp p. - 86 - A.2.3 Unix . pp . pp p , p , p p . , p pp p pp, pp. p p pp, p . p ( p ). , ( p ). Unix . , p , . p p p , p pp pp, p p pp (.. ) ppp . pp, , p p . , . p , p, p . p , p pp . p p p p pp pp, , p p p ppp . A.2.4 Unix- . - 87 - . . : . , , . / , . , , , . A.3 (VFS) A.3.1 Linux , , . /. Unix- . - , , , VFS. , , , , . , , /. A.3.2 VFS VFS , - 88 - . , : , . VFS . , . : , . . , VFS. , , VFS . : , , , , . , , VFS . VFS : inode . , , . inode , (, create unlink), , (, read write). A.4 EXT2 (The Second Extended File System) A.4.1 EXT2 pp p - 89 - , p p EXT (Extended File System). p pp , p pp Unix p . p, EXT2 p. p, p , p p p . , EXT2 pp pp . A.4.2 p EXT2fs EXT2fs p p Unix: , , p . EXT2fs p , p. p p p 2 , VFS p 4 . p, p p p. EXT2fs p . p . pp p 255 . p p 1012. EXT2fs ppp p root. 5 % , pp p p p p . A.4.3 EXT2fs p Unix, EXT2fs p p , - 90 - p Unix. p p p p p p . p . p , , , p. p p p , p. mount pp p . BSD, p p, p . System V . setgid , p p , p p setgid. p , p p p. EXT2fs p , BSD. mount pp ( pp, , ) p p . p, p p. , , p p, p p , p p pp . EXT2fs p p pp . pp 1024, 2048 4096 . p p p / ( p ), , , p . p p, p p pp. p p, , p pp. - 91 - EXT2fs p . p p , . p , pp. pp p pp p p . , pp, ppp pp, p, p p. p p 60 . p pp . EXT2fs . p p . p p read/write, 'Not Clean'. p p p read-only, 'Clean'. p p pp , p p pp . p p . p p p , 'Erroneous'. pp pp p p pp , 'Clean'. pp p p p p, EXT2fs pp pp . p p p . p, p p read/write. ( p p), pp p pp, 'Clean'. p pp p pp p p. p pp, pp pp. - 92 - EXT2fs p p p. pp tune2fs : p p . p p p , 'Erroneous' p : p , p p read-only p, pp pp . p. p pp. , ppp root. , p p, p p p. p p . p , , p p p , p. pp p p p, p pp. EXT2fs , 4.4 BSD. p : p . p . p , , p p p , . p. p , p . - 93 - A.4.4 pp pp EXT2fs p BSD. p p . p p p BSD FFS. , p p , p p p p p pp. p p p p (p pp ), p (p , p pp, pp ). p p , p pp p p , p p p p. pp p, p pp , p p p p /. EXT2fs p p . p p pp, , . p p p pp. A.4.5 p EXT2fs p , p p, p p p . - 94 - EXT2fs p. , p p p / p p . p, p p, , p , p p. p p p . EXT2fs p p p. p pp . p p p, pp. p p p p pp . p , EXT2fs p p 8 p p . p p p . p , p . A.5 EXT2fs p pp EXT2fs pp p pp , pp libext2fs. p , p p EXT2 p p. EXT2fs (mke2fs, e2fsck, tune2fs, dumpe2fs, debugfs, p.) . p , EXT2fs p EXT2fs. p EXT2fs p p, pp, - 95 - p p p p . pp, EXT2fs p p 4.4 BSD p . p p Linux (p , , EXT2fs). EXT2fs p p . p - p, . pp p p , , . pp . p p p