305
Операционная система FreeBSD Полное руководство 1

Учёбник По Freebsd (Полный)

Embed Size (px)

DESCRIPTION

Full book FREEBSD

Citation preview

Chapter 1

FreeBSD Chapter 1.

Table of Contents1.1. 1.2. FreeBSD!1.3. FreeBSD, Jim Mock , 17 2000.1.1.

FreeBSD! FreeBSD, , , , .

FreeBSD, 4.4BSD-Lite2, Intel (x86), DEC Alpha. . FreeBSD, . FreeBSD, . - (, , - ) , FreeBSD.

1.2. FreeBSD!

, FreeBSD . FreeBSD, .

1.2.1. FreeBSD?

, FreeBSD - , 4.4BSD-Lite2. Intel (x86) DEC Alpha.

FreeBSD Internet, :

Yahoo! Hotmail Apache Be, Inc. Blue Mountain Arts Pair Networks Whistle Communications Walnut Creek CDROM .

1.2.2. FreeBSD?

FreeBSD . :

, .

FreeBSD . , , , .

TCP/IP , SLIP, PPP, NFS, DHCP NIS. , FreeBSD , , NFS ( ) Internet WWW, FTP, ( ).

, ( ) . .

FreeBSD 32- (64 Alpha) .

X Window System (X11R6) (GUI) VGA .

, Linux, SCO, SVR4, BSDI NetBSD.

FreeBSD . - , ?

- Internet. FreeBSD Unix , , , , .

" VM/ " , , , .

(SMP) ( Intel).

: C, C++, Fortran Perl. .

, . , - ?

on-line .

- !FreeBSD 4.4BSD-Lite2 Computer Systems Research Group (CSRG) , , BSD-. CSRG, FreeBSD . PC, FreeBSD , !

FreeBSD . , ; UNIX-, FreeBSD! FreeBSD , , . .

, FreeBSD , , , , . , FreeBSD:

Internet : TCP/IP FreeBSD Internet :

FTP

World Wide Web ( , [SSL])

- NAT ("IP ").

USENET BBS

...

FreeBSD, 386 PC, Xeon RAID .

: ? , , , FreeBSD. CAD, .

: , , FreeBSD , . FreeBSD , , .

: ? (DNS)? , ? FreeBSD 386 486 PC .

X Window: FreeBSD , X-. XFree86 , X Inside. X , FreeBSD , , . FreeBSD " ", .

: FreeBSD , GNU C/C++ .

FreeBSD , CDROM FTP. FreeBSD .1.3. FreeBSD

, , , .

1.3.1. FreeBSD

Jordan K. Hubbard .

FreeBSD 1993 , " 386BSD (patchkit) ", 3- : Nate Williams, Rod Grimes .

386BSD , , patchkit . : "386BSD 0.5" "386BSD Interim".

386BSD , , . patchkit , - "" . , , .

, , , "FreeBSD" . , , , Walnut Creek CDROM FreeBSD Internet. Walnut Creek CDROM FreeBSD CD, Internet. Walnut Creek CDROM, , FreeBSD , .

, CDROM, , FreeBSD 1.0, 1993 . 4.3BSD-Lite ("Net/2") , 386BSD . , FreeBSD 1.1 RELEASE 1994 .

, Novell , . - Net/2 . , Net/2 "" , Novell, , ( ) AT&T. Novell, 4.4BSD-Lite, "" Net/2 . FreeBSD, 1994 Net/2. , FreeBSD 1.1.5.1.

FreeBSD 4.4BSD-Lite. "Lite" light () , CSRG ( ) 4.4BSD Intel . 1994 FreeBSD 2.0 CDROM ( ). FreeBSD 2.0.5 1995 .

FreeBSD 2.1.5 1996, ISP , 2.1-STABLE . FreeBSD 2.1.7.1, 1997 2.1-STABLE. , (RELENG_2_1_0).

FreeBSD 2.2 ("-CURRENT") 1996 RELENG_2_2, (2.2.1) 1997. 2.2 '97, (2.2.8) 1998. 3.0 1998, 2.2

20 1999 , 4.0-CURRENT 3.X-STABLE. 3.X-STABLE : 3.1 - 15 1999, 3.2 - 15 1999, 3.3 - 16 1999, 3.4 - 20 1999, 3.5 - 24 2000, 3.5.1, Kerberos. 3.x.

13 , 2000 4.X-STABLE 5.0-CURRENT. - 4.2-RELEASE.

5.0-CURRENT, - 5.0 CDROM (, , ).

1.3.2. FreeBSD

Jordan K. Hubbard .

FreeBSD , . ( ) , . , "" , , . , , .

, GNU (GPL) GNU (LGPL) , , . , GPL , BSD, .

1.3.3. FreeBSD

Satoshi Asami .

FreeBSD , FreeBSD , . , FreeBSD . FreeBSD FreeBSD .

, , FreeBSD , , :

CVS

FreeBSD CVS (Concurrent Version System), , FreeBSD. CVS , () . CVS, -CURRENT -STABLE, , . .

, CVS, FreeBSD ( "" cvs(1) commit, CVS ). - send-pr(1), - , .

CORE FreeBSD

CORE FreeBSD , FreeBSD . CORE , . CORE , CORE , . CORE .

CORE , , , .

Note: CORE , " ". " " , FreeBSD ! ;-)

, , , . FreeBSD ( ), .

, - , , - FreeBSD ?:-) ; - , .

, . FreeBSD, , ! , , .

, FreeBSD FreeBSD!

1.3.4. FreeBSD

FreeBSD - , 4.4BSD-Lite Intel i386, i486, Pentium, Pentium Pro, Celeron, Pentium II, Pentium III ( ) DEC Alpha. CSRG, U.C. Berkley, NetBSD, OpenBSD, 386BSD Free Software Foundation.

FreeBSD 2.0 94, , , FreeBSD . VM/ , , , 5MB . NIS ( ), TCP, "--" PPP, DHCP, SCSI, ISDN, ATM, FDDI, Fast Gigabit Ethernet (1000Mbit) , Adaptec .

, . ( ) !

, FreeBSD . 2000 3000 ! http (WWW) , , , . 50 , "" . , 1.0 . , , make install . , CDROM'a FTP , . - "", (pkg_add) .

FreeBSD /usr/share/doc FreeBSD 2.1 . HTML URL:

FreeBSD

file:/usr/share/doc/handbook/index.html FreeBSD ( )

file:/usr/share/doc/faq/index.html ( ) http://www.FreeBSD.org/.

Chapter 2. FreeBSD

Table of Contents2.1. 2.2. 2.3. 2.4. , Jim Mock , 2000 .2.1.

, FreeBSD . , , FreeBSD, ( FTP, NFS), -, , , MS-DOS .

, , . FreeBSD, , , , . , .

FreeBSD FTP, . .

FreeBSD .

, , , . , .

2.2.

FreeBSD. , - , , email FreeBSD .

2.2.1.

, ( ).

, FreeBSD. . - "" , SCSI , .., (IRQ -).

2.2.1.1.

, . , :

, , , .

MS-DOS , fdimage.exe ( - tools\) :

E:\> tools\fdimage floppies\kern.flp a: fdimage A: kern.flp (, FreeBSD floppies). , kern.flp DOS, FAT. UNIX- , :

# dd if=kern.flp of=disk_device bs=1kdisk_device /dev . FreeBSD, /dev/rfd0 A: /dev/rfd1 B:.

, kern.flp . mfsroot.flp, .

2.2.1.2. -

CDROM ( ), - MS-DOS.

FreeBSD -, Walnut Creek CDROM's, ( , , , ). - - MS-DOS, install.bat, makeflp.bat.

-, - El Torito ( , CDROM), FreeBSD CDROM . -.

MS-DOS , CDROM, install.bat -, - DOS.

Note: , - "" DOS; DOS- Windows .

view ( DOS). .

UNIX- , .

, , , - DOS, CDROM . .

, ( , FreeBSD), CDROM, :

# mount /cdrom - CDROM, . :

# umount /cdrom !

Note: , , - , CDROM, FreeBSD , , CDROM .

, , FreeBSD FTP -, ( , ) ( vipw):

ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent

, , FTP ftp:// , " (Other)" FTP .

2.2.1.3.

FreeBSD ( ), , , , , .

, 1.44MB 1.2MB , bin. DOS FORMAT. Windows, format Windows File Manager.

. , , . , , - .

FreeBSD, . , FAT ( DOS). UFS ( FreeBSD) disklabel newfs, , ( 3.5" 1.44MB ):

# fdformat -f 1440 fd0.1440 # disklabel -w -r fd0.1440 floppy3 # newfs -t 2 -u 18 -l 1 -i 65536 /dev/rfd0Note: 5.25" 1.2MB , fd0.1440 fd0.1200 floppy3 floppy5 .

.

, , . , , , 1.44MB . , , a:\bin\bin.aa, a:\bin\bin.ab .

Media "Floppy".

2.2.1.4. - MS-DOS

MS-DOS ( c:\FreeBSD) ( ), , DOS xcopy. FreeBSD -:

C:\> md c:\FreeBSD C:\> xcopy /s e:\bin c:\FreeBSD\bin\ C:\> xcopy /s e:\manpages c:\FreeBSD\manpages\ C: , E: CDROM.

, ; BIN.

2.2.1.5. QIC/SCSI

FreeBSD. , 'tar' , , :

# cd /freebsd/distdir # tar cvf /dev/rwt0 dist1 ... dist2 , - ( ), . , , .

Note: , , , .

2.2.1.6.

: ( SLIP PPP), (PLIP (laplink )), Ethernet ( ethernet ( PCMCIA )).

SLIP , . , PPP, ( , SLIP ).

, PPP. , , , . , "AT-", , PPP . PAP CHAP, set authname set authkey, term. ppp FAQ . , set log local ....

FreeBSD (2.0-R ), "laplink" . , , 50 , .

, ethernet . FreeBSD PC ethernet , ( ) . PCMCIA ethernet , FreeBSD, , . , FreeBSD PCMCIA " ".

IP , . PPP-, , IP . . IP , DNS ( ). , .

2.2.1.6.1. NFS

NFS . FreeBSD , NFS , NFS, , FreeBSD.

NFS " " ( Sun), , .

, , .

, NFS , , , FreeBSD :ziggy:/usr/archive/stuff/FreeBSD, ziggy /usr/archive/stuff/FreeBSD, /usr /usr/archive/stuff.

FreeBSD -alldirs /etc/exports, . "permission denied", NFS .

2.2.1.6.2. FTP

FTP , FreeBSD. , .

FreeBSD , , DNS , ( " (Other)") IP ( DNS ) FTP , FreeBSD:

ftp://165.113.121.81/pub/FreeBSD/4.2-RELEASE FTP, : FTP.

FTP

FTP "" . , FTP , . ( ), !

FTP

FTP "" . , .

Note: , , "proxy", FTP !

, FTP , , "@". FTP , "" . , FreeBSD ftp.FreeBSD.org, foo.bar.com, 1024.

, FTP [email protected] email . : FTP ( FTP, ) ftp://foo.bar.com:1234/pub/FreeBSD.

/pub/FreeBSD ftp.FreeBSD.org foo.bar.com, foo.bar.com, , ftp.FreeBSD.org.

2.2.2. FreeBSD

, , FreeBSD!

, - , . (, ). , FreeBSD , .

FreeBSD , . , - , , . FreeBSD . ( /stand/sysinstall) , - "" , , , , :-)

, " ":

1. kern.flp , mfsroot.flp, "". ( 30 3- , ) . - , " ".

2. F1. . FreeBSD, , .

3. (Options) .

4. (Novice), (Custom) (Express) , , , , . FreeBSD, .

5. , , FreeBSD. , FreeBSD -, , . , FreeBSD c .

2.3.

FreeBSD ISA, VLB, EISA PCI , 386SX PentiumPro ( 386SX ). IDE ESDI , SCSI , .

FreeBSD 8 , 16 .

, FreeBSD. , , , ; "", .

2.3.1.

WD1003 ( MFM/RLL)

WD1007 ( IDE/ESDI)

IDE

ATA

Adaptec 1535 ISA SCSI

Adaptec 154X ISA SCSI

Adaptec 174X EISA SCSI

Adaptec 274X/284X/2920C/294X/2950/3940/3950 (Narrow/Wide/Twin) EISA/VLB/PCI SCSI Adaptec AIC-7850, AIC-7860, AIC-7880, AIC-789X on-board SCSI Adaptec 1510 ISA SCSI ( , )

Adaptec 152X ISA SCSI

Adaptec AIC-6260 AIC-6360 , AHA-152X SoundBlaster SCSI

AdvanSys SCSI ( )

BusLogic MultiMaster - "W" BT-948, BT-958, BT-9580

BusLogic MultiMaster - "C" BT-946C, BT-956C, BT-956CD, BT-445C, BT-747C, BT-757C, BT-757CD, BT-545C, BT-540CF

BusLogic MultiMaster - "S" BT-445S, BT-747S, BT-747D, BT-757S, BT-757D, BT-545S, BT-542D, BT-742A, BT-542B

BusLogic MultiMaster - "A" BT-742A, BT-542B

AMI FastDisk , BusLogic MultiMaster .

Note: BusLogic/Mylex "Flashpoint" .

DPT SmartCACHE Plus, SmartCACHE III, SmartRAID III, SmartCACHE IV SmartRAID IV SCSI/RAID . DPT SmartRAID/CACHE V .

Compaq Intelligent : IDA, IDA-2, IAES, SMART, SMART-2/E, Smart-2/P, SMART-2SL, Integrated Array Smart Arrays 3200, 3100ES, 221, 4200, 4200, 4250ES.

SymBios ( NCR) 53C810, 53C810a, 53C815, 53C820, 53C825a, 53C860, 53C875, 53C875j, 53C885 53C896 PCI SCSI ASUS SC-200, Data Technology DTC3130 ( ), Diamond FirePort (all), NCR (), SymBios (), Tekram DC390W, 390U 390F, Tyan S1365

QLogic 1020, 1040, 1040B 2100 SCSI Fibre Channel Adapters

DTC 3290 EISA SCSI 1542

SCSI , SCSI-I SCSI-II , , , (DAT 8mm Exabyte), , CDROM . WORM , CDROM, " " CDROM. WORM/CD-R/CD-RW cdrecord, .

CD-ROM :

cd - SCSI ( ProAudio Spectrum SoundBlaster SCSI)

matcd - Matsushita/Panasonic (Creative Soundblaster, 562/563)

scd - Sony ( )

wcd - ATAPI IDE

SCSI , CAM SCSI :

NCR5380/NCR53400 ("ProAudio Spectrum") SCSI UltraStor 14F, 24F 34F SCSI Seagate ST01/02 SCSI

Future Domain 8XX/950 SCSI

WD7000 SCSI

Note: UltraStor SCSI CAM, , .

; :

(Colorado/Mountain/Insight)

mcd - CD-ROM Mitsumi ( )

2.3.2.

Adaptec Duralink PCI fast ethernet , Adaptec AIC-6195 fast ethernet (), :

ANA-62011 64- 10/100baseTX

ANA-62022 64- 10/100baseTX

ANA-62044 64- 10/100baseTX

ANA-69011 32- 10/100baseTX

ANA-62020 64- 100baseFX

Allied-Telesyn AT1700 RE2000 Alteon Networks PCI ethernet , Tigon 1 Tigon 2 , Alteon AceNIC (Tigon 1 2), 3Com 3c985-SX (Tigon 1 2), Netgear GA620 (Tigon 2), Silicon Graphics Gigabit Ethernet, DEC/Compaq EtherWORKS 1000, NEC Gigabit Ethernet

AMD PCnet/PCI (79c970 53c974 79c974)

RealTek 8129/8139 fast ethernet , :

Allied-Telesyn AT2550

Allied-Telesyn AT2500TX

Genius GF100TXR (RTL8139)

NDC Communications NE100TX-E

OvisLink LEF-8129TX

OvisLink LEF-8139TX

Netronix Inc. EA-1210 NetEther 10/100

KTX-9130TX 10/100 Fast Ethernet

Accton "Cheetah" EN1027D (MPX 5030/5038; RealTek 8139 ?)

SMC EZ Card 10/100 PCI 1211-TX

Lite-On 98713, 98713A, 98715 98725 fast ethernet , LinkSys EtherFast LNE100TX, NetGear FA310-TX Rev. D1, Matrox FastNIC 10/100, Kingston KNE110TX

Macronix 98713, 98713A, 98715, 98715A 98725 fast ethernet , NDC Communications SFA100A (98713A), CNet Pro120A (98713 98713A), CNet Pro120B (98715), SVEC PN102TX (98713)

Macronix/Lite-On PNIC II LC82C115 fast ethernet , LinkSys EtherFast LNE100TX 2

Winbond W89C840F fast ethernet , Trendware TE100-PCIE

VIA Technologies VT3043 "Rhine I" VT86C100A "Rhine II" fast ethernet , Hawking Technologies PN102TX D-Link DFE-530TX

Silicon Integrated Systems SiS 900 SiS 7016 PCI fast ethernet Sundance Technologies ST201 PCI fast ethernet , D-Link DFE-550TX

SysKonnect SK-984x PCI ethernet , SK-9841 1000baseLX ( , ), SK-9842 1000baseSX ( , ), SK-9843 1000baseLX ( , ) SK-9844 1000baseSX ( , ).

Texas Instruments ThunderLAN PCI , Compaq Netelligent 10, 10/100, 10/100 Proliant, 10/100 Dual-Port, 10/100 TX Embedded UTP, 10 T PCI UTP/Coax 10/100 TX UTP, Compaq NetFlex 3P, 3P Integrated 3P w/BNC, Olicom OC-2135/2138, OC-2325, OC-2326 10/100 TX UTP Racore 8165 10/100baseTX 8148 10baseT/100baseTX/100baseFX -personality ADMtek AL981 AN985 PCI fast ethernet ASIX Electronics AX88140A PCI , Alfa Inc. GFC2204 CNet Pro110B

DEC EtherWORKS III (DE203, DE204 DE205)

DEC EtherWORKS II (DE200, DE201, DE202 DE422)

DEC DC21040, DC21041 DC21140 (SMC Etherpower 8432T, DE245 .)

DEC FDDI (DEFPA/DEFEA) Efficient ENI-155p ATM PCI

FORE PCA-200E ATM PCI

Fujitsu MB86960A/MB86965A

HP PC Lan+ ( 27247B 27252A)

Intel EtherExpress ( - )

Intel EtherExpress Pro/10

Intel EtherExpress Pro/100B PCI Fast Ethernet

Isolan AT 4141-0 (16 )

Isolink 4110 (8 )

Novell NE1000, NE2000, and NE2100 Ethernet PCI , NE2000, RealTek 8029, NetVin 5000, Winbond W89C940, Surecom NE-34, VIA VT86C926

3Com 3C501, 3C503 Etherlink II, 3C505 Etherlink/+, 3C507 Etherlink 16/TP, 3C509, 3C579, 3C589 (PCMCIA), 3C590/592/595/900/905/905B/905C PCI EISA (Fast) Etherlink III / (Fast) Etherlink XL, 3C980/3C980B Fast Etherlink XL server , 3CSOHO100-TX OfficeConnect Toshiba ethernet

PCMCIA ethernet IBM National Semiconductor

2.3.3. USB

FreeBSD USB . ( ) USB , , .

USB

USB

USB USB- -

USB

ALi Aladdin-V

Intel 82371SB (PIIX3) 82371AB EB (PIIX4)

NEC uPD 9210 -

VIA 83C572 USB -

UHCI OHCI ( ).

PCI plug-in USB -

ADS Electronics PCI plug-in (2 )

Entrega PCI plug-in (4 )

USB :

Agiler 29UO

Andromeda

Apple iMac

ATen

Belkin F4U002 Belkin

BTC BTC7935

Cherry G81-3504

Chic

Cypress

Entrega USB-to-parallel Genius Niche

Iomega USB Zip 100 MB

Kensington Mouse-in-a-Box

Logitech M2452

Logictech wheel (3 )

Logitech PS/2 / USB (3 )

MacAlly mouse (3 buttons)

MacAlly ( , 4 )

Microsoft Intellimouse (3 )

Microsoft

NEC

Trust Ami (3 )

2.3.4. ISDN ( DSS1 [Q.921/Q.931])

Asuscom I-IN100-ST-DV (, )

Asuscom ISDNlink 128K

AVM A1

AVM Fritz!Card

AVM Fritz!Card PCI

AVM Fritz!Card PCMCIA

AVM Fritz!Card PnP

Creatix ISDN-S0/8

Creatix ISDN-S0/16

Creatix ISDN-S0 PnP

Dr.Neuhaus Niccy 1008

Dr.Neuhaus Niccy 1016

Dr.Neuhaus Niccy GO@ (ISA PnP)

Dynalink IS64PH ( )

ELSA 1000pro ISA

ELSA 1000pro PCI

ELSA PCC-16

ITK ix1 micro

ITK ix1 micro V.3

Sagem Cybermod (ISA PnP, )

Sedlbauer Win Speed

Siemens I-Surf 2.0

Stollman Tina-pp ( )

Teles S0/8

Teles S0/16

Teles S0/16.3 ("c" -- &16.3c mdash; !)

Teles S0 PnP (, )

3Com/USRobotics Sportster ISDN TA intern (-PnP )

2.3.5.

AST (4 ), IRQ

ARNET (8 ), IRQ

ARNET ( Digiboard) Sync 570/i

Boca BB1004 (4 , )

Boca IOAT66 (6 , )

Boca BB1008 (8 , )

Boca BB2016 (16 , )

Cyclades Cyclom-y

STB (4 ), IRQ

SDL Communications RISCom/8

SDL Communications RISCom/N2 N2pci

Specialix SI/XIO/SX , SIHOST2.x, "" ( , JET) -; ISA, EISA PCI

Stallion : EasyIO, EasyConnection 8/32 8/64, ONboard 4/16 Brumby

Adlib, SoundBlaster, SoundBlaster Pro, ProAudioSpectrum, Gravis UltraSound Roland MPU-401 Connectix QuickCam

Matrox Meteor Video

Creative Labs Video Spigot

Cortex1

Brooktree Bt848 Bt878

HP4020, HP6020, Philips CDD2000/CDD2660 Plasmon CD-R

Bus

PS/2

PC

X-10 power

GPIB Transputer

Genius Mustek

( , )

Lucent Technologies WaveLAN/IEEE 802.11 PCMCIA ISA (2Mb/c) (6Mb/) (NCR WaveLAN/IEEE 802.11, Cabletron RoamAbout 802.11 DS)

Note: ISA PCMCIA ISA/PCMCIA , .

FreeBSD IBM microchannel (MCA).

2.4.

, , . , , FreeBSD/MS-DOS.

2.4.1. - ...

- , PC, 100%. , , .

, "" FreeBSD.

, , , . . , IRQ, DMA -. , .

, ( ). , .

Warning , , , (sc0). (), - . .

, :

, .

, .

IRQ, DMA - .

, , Q . , , . , , .

2.4.2. MS-DOS

FreeBSD , MS-DOS. , .

2.4.2.1. , ! ?2.4.2.2. MS-DOS FreeBSD?2.4.2.3. MS-DOS?2.4.2.1. , ! ? MS-DOS, , ! , FIPS, tools - FTP FreeBSD.

FIPS MS-DOS , FreeBSD . MS-DOS DOS 6.XX DEFRAG Norton Disk Tools, FIPS . FreeBSD . (Distributions) , .

2.4.2.2. MS-DOS FreeBSD?. , Stacker(tm) DoubleSpace(tm), FreeBSD , . ( ). , ! MS-DOS MS-DOS FreeBSD.

2.4.2.3. MS-DOS?. DOS FreeBSD ("slices") , , D: /dev/sd0s5, E: /dev/da0s6 . , SCSI . IDE , wd da . , DOS, :

# mount -t msdos /dev/sd0s5 /dos_dChapter 3. Unix

Table of Contents3.1. 3.2. 3.3. 3.4. 3.5. 3.6. ...3.1.

Chris Shumway , 10 2000. c FreeBSD. , , - .

3.2.

FreeBSD BSD UNIX, UNIX. , , , FreeBSD - . , , . , , .

. : , . , // // . :

0 ---

1 , --x

2 , -w-

3 , -wx

4 , r--

5 , r-x

6 , rw-

7 rwx

, ls -l. :

-rw-r--r--

: , , , . ( rw-) . , (r--). (r--) . - (.. , , ). , , . , 644.

. FreeBSD , , . /dev.

, , . , ``'' . ``'', , , ``'' .

, , , setuid- sticky- . man (chmod(1)).

3.3.

FreeBSD , . hier(7) man, .

, , , /. , .

, . - /usr, /var, /mnt /cdrom. /etc/fstab, . , /etc/fstab rc(8), noauto. fstab(5) /etc/fstab .

3.4.

FreeBSD, ( ``''), , , . , , , , . FreeBSD , , sh, Bourne Shell, csh, C-shell. , , , tcsh bash, .

? . C, , , tcsh, Linux, bash, - . , , , .

- . , (TAB), , , foobar foo.bar. , foo.bar. , rm fo[TAB].[TAB].

: rm foo[BEEP].bar.

[BEEP] - , , , . , foobar foo.bar fo, TAB foo. (.) TAB, .

, . , . , , . :

USER .

PATH, , .

DISPLAY X11, .

SHELL .

TERM () . , .

TERMCAP escape- .

OSTYPE () . , FreeBSD.

MACHTYPE ().

EDITOR .

PAGER .

MANPATH, , .

, . , csh tcsh setenv. sh bash set export. , EDITOR ( csh tcsh) /usr/local/bin/emacs, :

setenv EDITOR /usr/local/bin/emacs bash:

export EDITOR="/usr/local/bin/emacs" , , , ($) . , echo $TERM $TERM.

, , , . - *, , ?, . , , echo * , ls, * ( , , , bash * , . - ).

, , . , (\). , echo $TERM , echo \$TERM $TERM, $TERM.

3.4.1.

, , chsh. EDITOR , $EDITOR, vi. ``Shell:'' .

-s chsh. :

% chsh -s /usr/local/bin/bashNote: , , /etc/shells. , , . , .

, , bash , , /usr/local/bin. , :

# echo "/usr/local/bin/bash" >> /etc/shells chsh.

3.5.

FreeBSD , , , - . FreeBSD ; .

, -, ee, ``easy editor'', .. `` ''. - , ee filename, filename . , /etc/rc.conf, ee /etc/rc.conf. . (^) Ctrl, , ^e Ctrl e. , Esc, Enter. - , , , .

FreeBSD vi, , emacs vim, . , ! 3.6. ...

3.6.1. (man)

, FreeBSD (man). ( ), , . man:

% man commandcommand - , . , ls :

% man ls :

1. .

2. .

3. .

4. .

5. .

6. .

7. .

8. .

9. .

( ), , , . , cdmod chmod(). , , :

% man 1 chmod chmod. , , , chmod(1) chmod, chmod(2) - .

, , , . , , -k man:

% man -k mail , ``mail'' . apropos.

, /usr/bin, , ? % cd /usr/bin; man -f * % cd /usr/bin; whatis *, .

3.6.2. GNU Info Files

FreeBSD , Free Software Foundation (FSF). info , info, , , emacs, (info) .

info(1), :

% info , h. , ?.

Chapter 4. :

Table of Contents4.1. 4.2. 4.3. 4.4. Jim Mock , 22 1999. .4.1.

FreeBSD .

-, , , FreeBSD.

, UNIX- . , , " ", . , , . - FreeBSD.

, , , . , , , make install.

4.2.

.

4.2.1.

, , "". , FreeBSD. :

Makefile. Makefile , ,

files. files md5. , . - , , . - , , , .

files , , - .

patches. , FreeBSD. - , , , , - . " 10" " 26 ...". "diff-" "", diff.

pkg. , , . , , . . :

COMMENT. .

DESCR. , .

PLIST. , . .

, , , . , .

, , . , FreeBSD . . , , .

whereis. , "whereis " , , :

# whereis xchat xchat: /usr/ports/irc/xchat

# , xchat ( irc) /usr/ports/irc/xchat.

. , /usr/ports. , make search key=program-name, "program-name" - , . , xchat:

# cd /usr/ports # make search key=xchat Port:xchat-1.3.8

Path:/usr/ports/irc/xchat

Info:An X11 IRC client using the GTK+ toolkit, and optionally, GNOME

Maint:[email protected]

Index:irc

B-deps: XFree86-3.3.5 bzip2-0.9.5d gettext-0.10.35 giflib-4.1.0 glib-1.2.6 gmake-3.77 gtk-1.2.6

imlib-1.9.8 jpeg-6b png-1.0.3 tiff-3.5.1

R-deps: XFree86-3.3.5 gettext-0.10.35 giflib-4.1.0 glib-1.2.6 gtk-1.2.6 imlib-1.9.8 jpeg-6b

png-1.0.3 tiff-3.5.1

"Path:", , . , .

Note: root.

, , , .

4.2.1.1. -

, , , , , , , - FreeBSD. , FreeBSD Mall.

, - FreeBSD , /cdrom ( /cdrom), . , , , :

# cd /usr/ports/irc/xchat xchat, . ( ) . make . , , :

# make >> xchat-1.3.8.tar.bz2 doesn't seem to exist on this system.

>> Attempting to fetch from file:/cdrom/ports/distfiles/.

===> Extracting for xchat-1.3.8

>> Checksum OK for xchat-1.3.8.tar.bz2.

===> xchat-1.3.8 depends on executable: bzip2 - found

===> xchat-1.3.8 depends on executable: gmake - found

===> xchat-1.3.8 depends on shared library: gtk12.2 - found

===> xchat-1.3.8 depends on shared library: Imlib.5 - found

===> xchat-1.3.8 depends on shared library: X11.6 - found

===> Patching for xchat-1.3.8

===> Applying FreeBSD patches for xchat-1.3.8

===> Configuring for xchat-1.3.8

...

[ ]

...

===> Building for xchat-1.3.8

...

[ ]

...

#, , , . . , make, install:

# make install ===> Installing for xchat-1.3.8

===> xchat-1.3.8 depends on shared library: gtk12.2 - found

===> xchat-1.3.8 depends on shared library: Imlib.5 - found

===> xchat-1.3.8 depends on shared library: X11.6 - found

...

[ ]

...

===> Generating temporary packing list

===> Installing xchat docs in /usr/X11R6/share/doc/xchat

===> Registering installation for xchat-1.3.8

# , , .

Note: , make install make make install .

Note: , , -. , , - , , . , -, , ( ).

4.2.1.2.

, , . , -.

, -. , , -.

:

# make install >> xchat-1.3.8.tar.bz2 doesn't seem to exist on this system.

>> Attempting to fetch from http://xchat.org/files/v1.3/.

Receiving xchat-1.3.8.tar.bz2 (305543 bytes): 100%

305543 bytes transferred in 2.9 seconds (102.81 Kbytes/s)

===> Extracting for xchat-1.3.8

>> Checksum OK for xchat-1.3.8.tar.bz2.

===> xchat-1.3.8 depends on executable: bzip2 - found

===> xchat-1.3.8 depends on executable: gmake - found

===> xchat-1.3.8 depends on shared library: gtk12.2 - found

===> xchat-1.3.8 depends on shared library: Imlib.5 - found

===> xchat-1.3.8 depends on shared library: X11.6 - found

===> Patching for xchat-1.3.8

===> Applying FreeBSD patches for xchat-1.3.8

===> Configuring for xchat-1.3.8

...

[ ]

...

===> Building for xchat-1.3.8

...

[ ]

...

===> Installing for xchat-1.3.8

===> xchat-1.3.8 depends on shared library: gtk12.2 - found

===> xchat-1.3.8 depends on shared library: Imlib.5 - found

===> xchat-1.3.8 depends on shared library: X11.6 - found

...

[ ]

...

===> Generating temporary packing list

===> Installing xchat docs in /usr/X11R6/share/doc/xchat

===> Registering installation for xchat-1.3.8

# , , , .

. , .

4.2.2.

, , , , , , , , , . .

( xchat, ). , , , , /usr/ports/irc/xchat. xchat. make deinstall ( ?):

# cd /usr/ports/irc/xchat # make deinstall ===> Deinstalling for xchat-1.3.8

# . xchat . , , make reinstall /usr/ports/irc/xchat.

4.3.

, , , .4.3.1.

4.3.1.1. , ??!4.3.1.2. , ?4.3.1.3. , ?4.3.1.4. ?4.3.1.5. tar-?4.3.1.6. ?4.3.1.7. , , - , kermit.4.3.1.8. , , /usr/ports/distfiles, , .4.3.1.9. , /usr/ports? , /u/people/guests/wurzburger, .4.3.1.10. - FreeBSD, tar- , , . ?4.3.1.11. , , , tar- FreeBSD. , , , MASTER_SITES?4.3.1.12. , make , .4.3.1.13. ? , , control-C.4.3.1.14. , , . make extract, ?4.3.1.15. , . ? , ?4.3.1.16. , , . - ?4.3.1.17. foo, bar. , , ?4.3.1.18. grizzle , . , , . ?4.3.1.19. , . , ??4.3.1.20. , , , . -?4.3.1.21. , , distfiles. ?4.3.1.22. , . ?4.3.1.23. OK, , , , , . , . - ?4.3.1.24. , . ?4.3.1.25. frobble, , , , . ?4.3.1.26. - . , . ?4.3.1.1. , ??!, , , . "" "" () UNIX .

4.3.1.2. , ?, .

4.3.1.3. , ? :

1. . .

2. . , () .

3. , , .

4. , , , -- , , , strip , .

5. . , . , , , , , , .

. , , .

6. , , , , - (, ), .

7. , ! ;-)

4.3.1.4. ? - , , . , , , " 23", " 468" " 197 ". - , diff.

4.3.1.5. tar-? , .tar , , .tar.gz, .tar.Z, .tar.bz2 .tgz.

, (.tar) ( ) (.gz). Tape ARchives (, , tar), .

, , UNIX tar, FreeBSD, :

% tar tvzf foobar.tar.gz % tar xzvf foobar.tar.gz % tar tvf foobar.tar % tar xvf foobar.tar4.3.1.6. ? , , . , , .

4.3.1.7. , , - , kermit. # make install >> cku190.tar.gz doesn't seem to exist on this system.

>> Attempting to fetch from ftp://kermit.columbia.edu/kermit/archives/.

? -?

-, CDROM - . Kermit . tar- -, --!

, , , . MASTER_SITES ( Makefile), .

4.3.1.8. , , /usr/ports/distfiles, , . tar- /usr/ports/distfiles, , -, . , :

# make DISTDIR=/where/you/put/it install4.3.1.9. , /usr/ports? , /u/people/guests/wurzburger, . , , PORTSDIR PREFIX. ,

# make PORTSDIR=/u/people/guests/wurzburger/ports install /u/people/guests/wurzburger/ports, /usr/local.

# make PREFIX=/u/people/guests/wurzburger/local install /usr/ports /u/people/guests/wurzburger/local.

, ,

# make PORTSDIR=../ports PREFIX=../local install ( , ).

, imake(1) ( X Windows System), PREFIX, /usr/X11R6. Perl PREFIX Perl. PREFIX .

, . , .

4.3.1.10. - FreeBSD, tar- , , . ? tar- , :

# cd /usr/ports # make fetch tar- - , :

# cd /usr/ports/directory # make fetch --, , , .

4.3.1.11. , , , tar- FreeBSD. , , , MASTER_SITES?. , , , ftp.FreeBSD.org , , MASTER_SITES, :

# cd /usr/ports/directory # make MASTER_SITE_OVERRIDE= \

ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/ fetch4.3.1.12. , make , . make fetch-list , .

4.3.1.13. ? , , control-C. make extract , .

4.3.1.14. , , . make extract, ?, make patch - , . PATCH_DEBUG. , !

4.3.1.15. , . ? , ?, 2.6.3 gcc ( FreeBSD 2.1.0 2.1.5), -O2 , -fno-strength-reduce. ( -O2). :

# make CFLAGS='-O2 -fno-strength-reduce' install /etc/make.conf, , , . - make configure, Makefile , , , make-.

FreeBSD , , .

4.3.1.16. , , . - ? INDEX /usr/ports. , . , , LISP, :

% cd /usr/ports % make search key=lisp4.3.1.17. foo, bar. , , ? foo -, bar -- , foo , bar . bar , foo.

4.3.1.18. grizzle , . , , . ? , :

# pkg_delete grizzle-6.5 :

# cd /usr/ports/somewhere/grizzle # make deinstall4.3.1.19. , . , ?? , :

# pkg_info -a | grep grizzle Information for grizzle-6.5:

grizzle-6.5 - the combined piano tutorial, LOGO interpreter and shoot 'em up

arcade game.

4.3.1.20. , , , . -?, , , . :

# cd /usr/ports # make clean , .

4.3.1.21. , , distfiles. ?, , , . , make distclean.

4.3.1.22. , . ? :

# cd /usr/ports # make install , . , /usr/local/bin/plot, .

4.3.1.23. OK, , , , , . , . - ?, , , (, " A4 US letter?"), - .

4.3.1.24. , . ?OK, , / / , :

# cd /usr/ports # make -DBATCH install , . , , :

# cd /usr/ports # make -DIS_INTERACTIVE install .

4.3.1.25. frobble, , , , . ? , , , :

# cd /usr/ports/somewhere/frobble # make extract # cd work/frobble-2.8 [Apply your patches]

# cd ../.. # make package4.3.1.26. - . , . ? , bsd.port.mk bsd.port.subdir.mk make-.

(, , ...)

4.3.2. ! !

, , , , :

1. ! " " .

2. -- ! , . make maintainer Makefile, . ( $FreeBSD: Makefile) , . , send-pr .

3. . -- " ". , .

4. . "" ftp.FreeBSD.org , ! , , , , , , . pkg_add(1) .

4.4.

, , . , , .

II.

Table of Contents5. FreeBSD6. 7. 8. 9. X Window System10. Chapter 5. FreeBSD

Table of Contents5.1. 5.2. : 5.3. : 5.4. 5.5. Init: 5.6. 5.1.

FreeBSD , , ( ). .

, . , init(8), . init(8) , , , FreeBSD .

5.2. :

, , .

(), , , , , .

BIOS ( ) CMOS ( ). BIOS CMOS , , , .

. , , .

( ) , , , .

5.2.1. boot0

boot0, (Master Boot Record), , , .

boot0 , MBR , 512 .

:

Example 5-1. boot0 F1 DOS

F2 FreeBSD

F3 Linux

F4 ??

F5 Drive 1

Default: F2

5.2.2. boot1

boot1 , , boot0 MBR , .

boot1 , , 512 , FreeBSD, , , boot2.

5.2.3. boot2

boot2 , FreeBSD , .

, , boot2 , .

Example 5-2. boot2 >> FreeBSD/i386 BOOT

Default: 0:wd(0,a)/kernel

boot:

5.3. :

, , , /boot/loader.

Note: /boot/boot0, /boot/boot1 /boot/boot2 , MBR, .

, .

5.3.1.

, , . , .

/boot/loader.rc, /boot/defaults/loader.conf, /boot/loader.conf . loader.rc, .

, 10- , , , . , , , , , .

loader(8)5.3.2.

:

autoboot , . , 10 .

boot [-] [ ]

, , , .

boot-conf

, . , unload, , , kernel.

help []

/boot/loader.help. index, .

include ...

. . include.

load [-t ] , . .

ls [-l] []

, . -l, .

lsdev [-v]

, . -v, .

lsmod [-v]

. -v, .

more LINES.

reboot

.

set , set = .

unload

.

5.3.3.

.

, :

boot -s , ( ) :

unload load kernel.old kernel.GENERIC , , kernel.old ( , , , ).

Note: :

unload set kernel="kernel.old" boot-conf ( , , ):

load -t userconfig_script

/boot/kernel.conf5.4.

( ) boot2 ( ), , , .

5.4.1.

:

-a .

-C -.

-c UserConfig

-s

-v

Note: , boot(8) .

5.5. Init:

, , init, /sbin/init , init_path .

5.5.1.

. , fsck , init , .

5.5.2.

, -s boot_single .

shutdown (-r) (-h) .

console /etc/ttys insecure, root .

Example 5-3. /etc/ttys # namegetty

typestatus

comments

#

# This entry needed for asking password when init goes to single-user mode

# If you want to be asked for password, change "secure" to "insecure" here

console none

unknown off insecure

Note: insecure , , , , root, , , . , , insecure, secure.

5.5.3.

init , , , , , .

5.5.3.1. (rc)

, , /etc/defaults/rc.conf, , , /etc/rc.conf, , /etc/fstab, , , , .

rc(8) . , .

5.6.

shutdown, init /etc/rc.shutdown, , , .

Chapter 6.

Table of Contents6.1. 6.2. 6.3. FreeBSD6.4. DES, MD5, and Crypt6.5. S/Key6.6. Kerberos6.7. Firewalls6.8. OpenSSL6.9. IPsec security(7) , Matthew Dillon .6.1.

, , , , , S/Key, OpenSSL, Kerberos .

6.2.

, - . , BSD UNIX, , , , , . . UNIX , , . , .

, "" . , "", "" , . , "" , . , schg- (. chflags(1)) , , , , , , , .

, :

1. " " (D.o.S.).

2. .

3. (root) .

4. (root) .

5. ( , " ").

. " " (brute-force), . , , . "" . , (, - ). " ", . , "" , , , . , , .

, , . , telnetd, rlogind, rshd ftpd. , , . , , , - "" . , .

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

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

, , "" . :

1. .

2. , , , SUID/SGID .

3. .

4. , .

5. , raw .

6. .

7. .

.

6.3. FreeBSD

FreeBSD, .

6.3.1.

, . . , , . , , su(1). , , , /etc/ttys, insecure (), telnet rlogin. , , , sshd, . - FTP . .

, , . , . - - wheel ( /etc/group). , , su . wheel, . , staff, , , wheel, /etc/group. , kerberos, .k5login , ksu(1) - wheel. , , . , , .

, * (/etc/passwd). , , , . , , kerberos(1) ssh(1), (/). kerberos, kerberos- . / , , ssh, , ( ), , (ssh-keygen(1)). * ( , ) , , . , - ("") ( ).

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

kerberos, . , - (, ) - , . , N ! Kerberos ( , ). BASTION ROUTER FREEBSD FreeBSD, firewall-a, arp- mac- . FreeBSD - IPFW, .

, c FreeBSD 4.0, ( pipe bw). , ( vx0, IP 200.200.200.1) Internet-a, ( vx1, IP 200.200.200.2) 18 IP (subnet 200.200.200.0/28 netmask 255.255.255.240). (vx2 IP 192.168.1.1 192.168.1.0/28) 10- .)

:

135,137,139

WWW,FTP .

SYN Flood, ICMP Flood.

WWW/FTP (200.200.200.5), WWW server , IP 199.199.199.10

.

IP , , c www.playboy.com .

64Kb , 10Mb .

. 1. .

:

options IPFIREWALL ( )options IPFIREWALL_VERBOSE ( )options IPFIREEWALL_VERBOSE_LIMIT=10 ( , syslog)options TCP_DROP_SYNFIN ( TCP SYN FIN)

firewall, IP (, - , - ttyvX, ttypX =).

, TCP UDP, . - " " :

options IPFIREWALL_DEFAULT_TO_ACCEPT

/etc/defaults/rc.conf :

tcp_extensions="NO" ( "" RFC1323 TCP)tcp_drop_synfin="YES" ( SYN + FIN)icmp_drop_redirect="YES" ( ICMP )icmp_log_redirect="YES" ( logging ICMP REDIRECT)firewall_enable="YES" ( firewall)firewall_type="Company" ( firewalla rc.firewall "Company")defaultrouter="199.199.199.1" ( ISP)

2. IPFW.

IPFW. handbook man ipfw. ("Company") rc.firewall:[Cc][Oo][Mm][Pp][Aa][Nn][Yy]# fw="200.200.200.1" local="200.200.200.2" client="192.168.1.1" net="200.200.200.0/28" mask="255.255.255.255.240"

# local ${fwcmd} add pass all from any to any via lo0# ${fwcmd} add pass all from any to any via vx1# ${fwcmd} add deny icmp from any to any frag# ICMP ${fwcmd} add pass ICMP from any to any# SMTP ${fwcmd} add pass tcp from any to any 25 out${fwcmd} add pass tcp from any 25 to any out# HTTPS ${fwcmd} add pass tcp from any to any 443 out${fwcmd} add pass tcp from any 443 to any out # ${fwcmd} add pass tcp from 199.199.199.10 to 200.200.200.5 80 via vx0${fwcmd} add pass tcp from 200.200.200.5 80 to 199.199.199.10 via vx0 # ${fwcmd} add deny tcp from any to 200.200.200.5 80 in via vx0# HTTP ${fwcmd} add pass tcp from any to any 80 out via vx1${fwcmd} add pass tcp from any 80 to any out via vx1 # # ${fwcmd} add allow all from any to any via vx1 # DNS ${fwcmd} add pass udp from any to any 53${fwcmd} add pass udp from any 53 to any # NEWS ${fwcmd} add pass tcp from any to any 119${fwcmd} add pass tcp from any 119 to any # POP3 ${fwcmd} add pass tcp from any to any 110 ${fwcmd} add pass tcp from any 110 to any # FTP # 20 # TCP # ${fwcmd} add pass tcp form any 21 to any ${fwcmd} add pass tcp from any to any 21 ${fwcmd} add pass tcp from any 20 to any ${fwcmd} add pass tcp from any to any 20 # ssh # IP 200.200.200.15 ${fwcmd} add pass tcp from 200.200.200.15 22 to {isp}${fwcmd} add pass tcp from {isp} to 200.200.200.15 22 # vx2 # ${fwcmd} add deny all from 192.168.1.0/24 to ${net}:${mask} via vx1 ${fwcmd} add deny all from${net}:${mask} to 192.168.1.0/24 via vx1 # TCP vx2${fwcmd} add pass tcp from 192.168.1.0/24 to any 25 via vx2${fwcmd} add pass tcp from any 25 to 192.168.1.0/24 via vx2${fwcmd} add pass tcp from 192.168.1.0/24 to any 110 via vx2 ${fwcmd} add pass tcp from any 110 to 192.168.1.0/24 via vx2${fwcmd} add pass udp from 192.168.1.0/24 to any 53 via vx2 ${fwcmd} add pass udp from any 53 to 192.168.1.0/24 via vx2${fwcmd} add pass tcp from 192.168.1.0/24 to any 80 via vx2${fwcmd} add pass tcp from any 80 to 192.168.1.0/24 via vx2 # vx2 64 Kb.# ${fwcmd} add pipe 1 ip from any to any in via vx0 ${fwcmd} add pipe 1 config bw 64Kbit/s # vx2 64 Kb.# ${fwcmd} add pipe 2 ip from any to any out via vx0 ${fwcmd} add pipe 2 config bw 64Kbit/s

TCP/IP NMAP ( FreeBSD INSECURE.ORG), : ./nmap 200.200.200.1 ./nmap 200.200.200.2 , , ISP.

3. MAC-

IP "" TCP/IP , 200.200.200.0/28. , IP MAC ISP. , , IP , . ;)

MAC , :

petya 00:20:af:4a:3e:e3vasya 00:20:fg:3a:3e:21sasha 00:20:fg:3a:3e:21markins 00:20:fg:3a:3e:21... /etc/ethers.

Ethernet , arp -a. arp -f /etc/ethers IP MAC ARP /etc/ether "".

arpwatch ( FreeBSD), /etc/hosts name_hosts IP_adress /etc/ethers . IP , arpwatch root' arp . 4. . ipfm, FreeBSD. /usr/local/etc/ ipfm.conf. : ##### FIRST LOGGING CONFIGURATION ##### # LOG 200.200.200.0/255.255.255.240 NOT WITH 200.200.0.0/255.255.0.0# FILENAME /var/log/ipfm/local_net-%d.%m-%H.%M.%S # # TIME 7 day SORT IN RESOLVE ##### SECOND LOGGING CONFIGURATION #####NEWLOG # 192.168.1.0/24 subnet 192.168.1.0/255.255.255.0 NOT WITH 192.168.0.0/255.255.0.0# 1 FILENAME /var/log/ipfm/ipfm-%d.%m-%H.%M.%S # Log on a period of one week TIME 1 day SORT IN RESOLVE

count ipfw: # HTTP ipfw add count tcp from any to any 80 in via vx0ipfw add count tcp from any to any 80 out via vx0# HTTP :ipfw add count tcp from any to any 80 in via vx2 ipfw add count tcp from any to any 80 out via vx2ipfw add count tcp from any to any 21 in via vx2ipfw add count tcp from any to any 21 out via vx2 c IP :

ipfw add count tcp from any to 200.200.200.3 in via vx1

... 200.200.200.3 - IP , www.playboy.com . :

ipfw add log deny all from any to www.playboy.com

... .

MRTG (Multi Router Transfeer Grapheer) snmp, . , Chapter 7. Table of Contents7.1. 7.2. BIOS7.3. 7.4. 7.5. 7.6. : , Network, Memory, and File-Based Filesystems7.7. 7.1.

, , , FreeBSD.

7.2. BIOS

, FreeBSD , .

PC DOS BIOS (WINxxx), BIOS , . , " ". , , , , Ghost XCOPY. , , - , BIOS . , .

SCSI BIOS, SCSI.

, , FreeBSD. FreeBSD BIOS " BIOS". , .

FreeBSD, BIOS FreeBSD, . , , , .

: Wintel- FreeBSD . SCSI SCSI FreeBSD.

, , SCSI , .

, , SCSI "" . , SCSI , . , , , , , SCSI BIOS SCSI . FreeBSD .

, , -- FreeBSD. SCSI , , "". FreeBSD SCSI FTP . .

FreeBSD , ... . SCSI ( FreeBSD). , SCSI .

?

SCSI SCSI , " ". SCSI BIOS, SCSI , . FreeBSD SCSI . BIOS , BIOS, FreeBSD, BIOS , FreeBSD . SCSI , , SCSI . , SCSI , .

, . SCSI ( , ).

SCSI, IDE.

7.3.

, IDE SCSI; , RAID-, . , .

Table 7-1. ,

IDEad 4.0-RELEASE, wd 4.0-RELEASE.

IDE CDROMacd, 3.1-RELEASE, wcd 4.0-RELEASE.

SCSIda, 3.0-RELEASE, sd 3.0-RELEASE.

SCSI CDROMcd

CDROMmcd Mitsumi CD-ROM, scd Sony CD-ROM, matcd Matsushita/Panasonic CD-ROM

fd

SCSIsa, 3.0-RELEASE, st 3.0-RELEASE.

IDEast, 4.0-RELEASE, wst 4.0-RELEASE.

-fla - DiskOnChip, 3.3-RELEASE.

RAIDmyxd Mylex amrd AMI MegaRAID, idad Compaq Smart RAID, 4.0-RELEASE. id 3.2-RELEASE 4.0-RELEASE.

7.3.1.

, , "dangerously dedicated". s: "da0s1".

, , "dangerously dedicated", , a h. b , c , . Section 7.5>.

7.4.

, , , /. /dev, /usr , , , /usr/local .

. /var , , . , /var / .

, , CDROM.

7.4.1. fstab

, /etc/fstab, ( noauto).

/etc/fstab :

device /mount-point fstype options dumpfreq passnodevice ( ) , .

mount-point ( ), .

fstype mount(8). FreeBSD ufs.

options rw , -, ro , , , . noauto , . mount(8).

dumpfreq , passno , .

7.4.2. mount

mount(8) , .

:

# mount device mountpoint mount(8), , :

mount-a , /etc/fstab, -t, .

-d , .

-f .

-r .

-t fstype , , -a.

"ufs".

-u .

-v .

-w , .

-o , :

nodev

. , .

noexec

. , .

nosuid

. , .

7.4.3. umount

umount , , -a -A.

-f -v .

-a -A , , -t. -A .

7.5.

David O'Brien 26 1998 , SCSI , . , . - ..

root. , , /var/run/dmesg.boot, , . , da1 /1 ( IDE, wd1 , 4.0, ad1 4.X).

FreeBSD IBM-PC , PC BIOS. BSD. PC BIOS. FreeBSD, dedicated. FreeBSD PC BIOS. FreeBSD PC BIOS , BSD. , FreeBSD, , . , fdisk .

/dev/da1s1e. : SCSI, 1 ( SCSI), 1 ( PC BIOS 1), BSD e. /dev/da1e.

7.5.1. sysinstall

/stand/sysinstall . root su. /stand/sysinstall Configure. FreeBSD Configuration Menu, Partition. . da1, dmesg /var/run/dmesg.boot.

da1, FDISK. A , FreeBSD . , " ", YES. W. FDISK q. . , None.

Disk Label Editor. BSD. , a-h. . a (/). (, , ), a. b , . c FreeBSD . .

sysinstall e . C. , (FS) , FS (, /mnt). , sysinstall /etc/fstab, .

. , W. sysinstall . sysinstall.

/etc/fstab .

7.5.2.

7.5.2.1.

, , fdisk . . !

# dd if=/dev/zero of=/dev/rda1 bs=1k count=1 # fdisk -BI da1 # .

# disklabel -B -w -r da1s1 auto # .

# disklabel -e da1s1 # .

# mkdir -p /1 # newfs /dev/da1s1e # .

# mount -t ufs /dev/da1s1e /1 # ()

# vi /etc/fstab # / /etc/fstab.

IDE, ad da. 4.x wd.

7.5.2.2.

, . , Microsoft; . OS/2 IBM " " , .

# dd if=/dev/zero of=/dev/rda1 bs=1k count=1 # disklabel -Brw da1 auto # disklabel -e da1

# create the `e' partition

# newfs -d0 /dev/rda1e # mkdir -p /1 # vi /etc/fstab

# add an entry for /dev/da1e

# mount /1 :

# dd if=/dev/zero of=/dev/rda1 count=2 # disklabel /dev/rda1 | disklabel -BrR da1 /dev/stdin # newfs /dev/rda1e # mkdir -p /1 # vi /etc/fstab

# add an entry for /dev/da1e

# mount /17.6. : , Network, Memory, and File-Based Filesystems

, ; , -, , FreeBSD - .

, , Network Filesystem Coda, , , md , vnconfig.

7.6.1. vnconfig:

vnconfig(8) - vnode. vnode . , vnconfig(8) . -, .

:

Example 7-1. vnconfig # vnconfig vn0 diskimage # mount /dev/vn0c /mnt vnconfig:

Example 7-2. vnconfig # dd if=/dev/zero of=newimage bs=1k count=5k 5120+0 records in

5120+0 records out

# vnconfig -s labels -c vn0 newimage # disklabel -r -w vn0 auto # newfs vn0c Warning: 2048 sector(s) in last cylinder unallocated

/dev/rvn0c:10240 sectors in 3 cylinders of 1 tracks, 4096 sectors

5.0MB in 1 cyl groups (16 c/g, 32.00MB/g, 1280 i/g)

super-block backups (for fsck -b #) at:

32

# mount /dev/vn0c /mnt # df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on

/dev/vn0c 4927 1 4532 0% /mnt

7.6.2. md:

md .

, , , vnconfig(8) :

Example 7-3. md # dd if=newimage of=/dev/md0 5120+0 records in

5120+0 records out

# mount /dev/md0c /mnt # df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on

/dev/md0c 4927 1 4532 0% /mnt

7.7.

- , / . , , . , .

7.7.1.

, , , . :

options QUOTA

GENERIC , , . , FreeBSD .

/etc/rc.conf. :

enable_quotas="YES" . , quotacheck. quotacheck . , . , :

check_quotas="NO" FreeBSD 3.2-RELEASE, , . /etc/rc.conf:

check_quotas="YES", /etc/fstab . , , .

, userquota , , /etc/fstab. :

/dev/da1s2g /home ufs rw,userquota 1 2

, groupquota userquota. , , :

/dev/da1s2g /homeufs rw,userquota,groupquota 1 2

quota.user quota.group . man fstab. , , , .

. /etc/rc , /etc/fstab, .

quotacheck, quotaon quotaoff. .

7.7.2.

, , . :

# quota -v , , .

edquota.

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

. , . , 500 490 , 10 . 11 .

, . , . , , . , , , .

, edquota. edquota, , EDITOR, vi, EDITOR , .

# edquota -u test Quotas for user test:

/usr: blocks in use: 65, limits (soft = 50, hard = 75)

inodes in use: 7, limits (soft = 50, hard = 60)

/usr/var: blocks in use: 0, limits (soft = 50, hard = 75)

inodes in use: 0, limits (soft = 50, hard = 60)

, , . , inode. , 50 75, 500 600, :

/usr: blocks in use: 65, limits (soft = 50, hard = 75)

:

/usr: blocks in use: 65, limits (soft = 500, hard = 600)

.

. -p edquota. -, , edquota -p protouser startuid-enduid. , test , 10000 19999 :

# edquota -p test 10000-19999 man edquota .

7.7.3.

quota repquota. quota , , . . repquota .

quota -v , .

Disk quotas for user test (uid 1002):

Filesystem blocks quota limit grace files quota limit grace

/usr 65* 50 75 5days 7 50 60

/usr/var 0 50 75 0 50 60

/usr 50 15 5 . *, .

, , , quota, . -v , , , /usr/var .

7.7.4. NFS NFS

NFS. rpc.rquotad(8) quota(1) NFS, .

rpc.rquotad /etc/inetd.conf :

rquotad/1 dgram rpc/udp wait root /usr/libexec/rpc.rquotad rpc.rquotad

inetd:

# kill -HUP `cat /var/run/inetd.pid`Chapter 8. Table of Contents8.1. 8.2. 8.3. 8.4. ?8.1.

. - , FreeBSD .

8.2.

4 8, QIC, - DLT.

8.2.1. 4 (DDS: Digital Data Storage)

4 QIC . Conner Archive, QIC . 4 , , 8. (3 x 2 x 0.5 , 76 x 51 x 12 ), 8-. 4, 8, , (helical scan).

~150kB/s, ~500kB/s. 1.3 GB 2.0 GB. , , . 6 . 240 GB.

DDS-3 12GB ( 24GB ).

4, 8, . 4, 8 .

, 2000 , 100 .

8.2.2. 8 (Exabyte)

8 SCSI-; . , 8. , . (4.8 x 3.3 x 0.6 ; 122 x 84 x 15 ). 8 - .

~250kB/s ~500kB/s. 300 7. , , . , 6 120 . . , 840 .

Exabyte "Mammoth" 12 (25 ) , .

, ( 6 ). 270 , . . , .

8.2.3. QIC

QIC-150, , . QIC "" . . QIC 8 4 , . , QIC . QIC . QIC - . QIC ( ) . QIC . , , . QIC (6 x 4 x 0.7 ; 15.2 x 10.2 x 1.7 ). -, 1/4", . .

~150kB/s ~500kB/s. 40 15 . QIC. QIC ; DAT.

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

5,000 .

8.2.4. * -

8.2.5. DLT

DLT . 1/2" (12.5) (4 x 4 x 1 ; 100 x 100 x 25 ). . , . , "" . . , ( 9- ), , .

1.5MB/s, 4, 8 QIC. 10 20 . , , , 5 900 1 20 , 50 9.

DLT Type IV 70 .

, ( , QIC). . / ; , .

8.2.6. AIT

AIT - Sony, 50 ( ) . , . , , , . , SAMS:Alexandria, AIT, , , , , .

$20,000, .

8.2.7.

, , , . :

sa0(ncr1:4:0): NOT READY asc:4,1

sa0(ncr1:4:0):Logical unit is in process of becoming ready

( 0). QIC-525 QIC (Identifier Block). :

mt fsf 1 .

.

dump(8) .

dump(8) DUMP: End of tape detected, : HARDWARE FAILURE info:280 asc:80,96 : mt rewind .

8.3.

dump(8), tar(1) cpio(1).

8.3.1. Dump Restore

dump(8) restore(8) Unix . , , , . dump(8) , , , ln(1) . dump(8) , , . dump(8) , Version 6 ATT Unix ( 1975). , , 9- (6250 bpi), ( 62,182 ftpi). .

rdump(8) rrestore(8) , . rcmd(3) ruserok(3) . , , rhosts. rdump(8) rrestore(8) . (, rdump FreeBSD Exabyte, Sun komodo, : /sbin/rdump 0dsbfu 54000 13000 126 komodo:/dev/nrsa8 /dev/rda0a 2>&1) : rhosts. .

8.3.2. Tar

tar(1) Version 6 ATT Unix ( 1975). tar(1) ; tar(1) . tar(1) , cpio(1), , cpio(1).

tar(1) . GNU tar(1), FreeBSD, , rdump(8). Exabyte, Sun komodo, : /usr/bin/tar cf komodo:/dev/nrsa8 . 2>&1. , rsh(1) .

# tar cf - . | rsh hostname dd of=tape-device obs=20b , rsh(1) ssh(1).

8.3.3. Cpio

cpio(1) Unix . cpio(1) ( ), , . cpio(1) . cpio(1) , , stdin.

cpio(1) . rsh(1) . (XXX )

8.3.4. Pax

pax(1) IEEE/POSIX tar(1) cpio(1). tar(1) cpio(1) . , , POSIX . pax(1) cpio(1) tar(1), , , . cpio(1), tar(1).

8.3.5. Amanda

Amanda (Advanced Maryland Network Disk Archiver) / , . Amanda , Amanda Amanda. , , , . Amanda . Amanda " " . Amanda " ": , , Amanda. " " ( ) . .

, Amanda. Amanda . Amanda , , .

8.3.6.

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

, " " . , Unix , , , .

" " /usr/obj , . , - SGML. HTML . SGML .

8.3.7. ?

dump(8) . Elizabeth D. Zwicky , . Unix dump(8). , ( ) , . : , , , , , , , . LISA V 1991 . torture-testing Backup and Archive Programs.

8.3.8.

8.3.8.1. ,

, .

-, (, disklabel da0 | lpr), (/etc/fstab) , , .

-, , (boot.flp fixit.flp). , . , .

, , . : fdisk(8), disklabel(8), newfs(8), mount(8) - . . dump(8), restore(8).

-, . , , . .

-, ( boot.flp fixit.flp, , ) . . , . , , ( ? tar xvf /dev/rsa0 tar cvf /dev/rsa0 ).

, . - , . . .

:

#!/bin/sh

#

# create a restore floppy

#

# format the floppy

#

PATH=/bin:/sbin:/usr/sbin:/usr/bin

fdformat -q fd0

if [ $? -ne 0 ]

then

echo "Bad floppy, please use a new one"

exit 1

fi

# place boot blocks on the floppy

#

disklabel -w -B /dev/rfd0c fd1440

#

# newfs the one and only partition

#

newfs -t 2 -u 18 -l 1 -c 40 -i 5120 -m 5 -o space /dev/rfd0a

#

# mount the new floppy

#

mount /dev/fd0a /mnt

#

# create required directories

#

mkdir /mnt/dev

mkdir /mnt/bin

mkdir /mnt/sbin

mkdir /mnt/etc

mkdir /mnt/root

mkdir /mnt/mnt

# for the root partition

mkdir /mnt/tmp

mkdir /mnt/var

#

# populate the directories

#

if [ ! -x /sys/compile/MINI/kernel ]

then

cat