fsconfig 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. .TH FSCONFIG 8
  2. .SH NAME
  3. fsconfig \- configuring a file server
  4. .SH SYNOPSIS
  5. .B service
  6. .I name
  7. .PP
  8. .B config
  9. .I device
  10. .PP
  11. .B nvram
  12. .I device
  13. .PP
  14. .B filsys
  15. .I name
  16. .I device
  17. .PP
  18. .B ip
  19. .I ipaddr
  20. .PP
  21. .B ipgw
  22. .I ipaddr
  23. .PP
  24. .B ipmask
  25. .I ipaddr
  26. .PP
  27. .B ipauth
  28. .I ipaddr
  29. .PP
  30. .B ipsntp
  31. .I ipaddr
  32. .PP
  33. .B ream
  34. .I name
  35. .PP
  36. .B recover
  37. .I name
  38. .PP
  39. .B allow
  40. .PP
  41. .B readonly
  42. .PP
  43. .B noauth
  44. .PP
  45. .B noattach
  46. .PP
  47. .B copyworm
  48. .PP
  49. .B copydev
  50. .I from-dev
  51. .I to-dev
  52. .PP
  53. .B halt
  54. .PP
  55. .B end
  56. .SH DESCRIPTION
  57. When a file server's configuration has not been set,
  58. or by explicit request early in the server's initialization (see
  59. .IR fs (8)),
  60. the server enters `config mode'. The commands described here
  61. apply only in that mode. They establish configuration constants
  62. that are typically valid for the life of the server, and therefore
  63. need be run only once. If the non-volatile RAM on the server
  64. gets erased, it will be necessary to recreate the configuration.
  65. .SS Syntax
  66. In these commands,
  67. .I ipaddr
  68. is an IP address in the form
  69. .BR 111.103.94.19
  70. and
  71. .I name
  72. is a text string without white space.
  73. The syntax of a
  74. .I device
  75. is more complicated:
  76. .TP
  77. .BI w n1 . n2 . n3
  78. Defines a SCSI disk on target (unit) id
  79. .IR n2 ,
  80. controller (host adapter)
  81. .IR n1 ,
  82. and LUN (logical unit number)
  83. .IR n3 .
  84. A single number specifies a target, while two numbers specify
  85. .IB target . lun\f1,
  86. with the missing numbers defaulting to zero.
  87. Any one of the numbers may be replaced by
  88. .BI < m - n >
  89. to represent the values
  90. .I m
  91. through
  92. .I n
  93. inclusive.
  94. .I M
  95. may be greater than
  96. .IR n .
  97. For example,
  98. .B (w<1-4>)
  99. is the concatenation of SCSI targets 1 through 4.
  100. .TP
  101. .BI h n1 . n2 . n3
  102. .I H
  103. is similar to
  104. .IR w ,
  105. but for IDE or ATA disks,
  106. and the controllers must be specified in
  107. .BR plan9.ini .
  108. .I Lun
  109. is ignored.
  110. .I Target
  111. 0 is an IDE master
  112. and 1 is a slave.
  113. Instead of specifying
  114. .I controller
  115. and
  116. .IR target
  117. separately,
  118. one may omit the
  119. .I controller
  120. and specify a target of
  121. .IB controller-number *2
  122. .B +
  123. .IR target-number ,
  124. thus
  125. .B h2
  126. is equivalent to
  127. .B h1.0.0
  128. (second IDE controller, master drive).
  129. .TP
  130. .BI m n1 . n2 . n3
  131. .I M
  132. is similar to
  133. .IR h ,
  134. but for SATA drives connected to Marvell
  135. 88SX[56]0[48][01] controllers.
  136. There is no need to specify the controllers in
  137. .B plan9.ini
  138. as they are autodiscovered.
  139. Hot-swapping drives is not currently supported.
  140. Similar target naming rules apply as for IDE controllers.
  141. However the controller-number is multiplied by the number of
  142. drives the controller supports rather than 2.
  143. Thus
  144. .B m9
  145. is equivalent to
  146. .B m1.1.0
  147. (second controller, second drive),
  148. if the first controller supports 8 drives.
  149. .TP
  150. .BI l n1 . n2 . n3
  151. .TP
  152. .BI r n1 . n2 . n3
  153. The same as
  154. .BR w ,
  155. but leaving a single block at the beginning for a label
  156. .BI ( l ),
  157. or not.
  158. Only
  159. .I n2
  160. is really of interest,
  161. and refers to a side of a WORM disc.
  162. These are only really relevant when used as
  163. .I device3
  164. in the
  165. .B j
  166. device (see below).
  167. .TP
  168. .BI ( device... )
  169. A pseudo-device formed from the concatenation of the
  170. .I devices
  171. in the list. The devices are
  172. .I not
  173. blank- or comma-separated.
  174. .TP
  175. .BI [ device... ]
  176. A pseudo-device formed from the block-wise interleaving of the
  177. .I devices
  178. in the list. The size of the result is the number of devices times
  179. the size of the smallest device.
  180. .TP
  181. .BI { device... }
  182. A pseudo-device formed from the mirroring of the first
  183. .I device
  184. in the list onto all the others.
  185. The size of the result is the size of the smallest device.
  186. One might think of this as RAID 1,
  187. and
  188. .B [
  189. .B ]
  190. as RAID 0,
  191. though neither includes any fancy recovery mechanisms.
  192. Each block is written to all the devices,
  193. starting with the rightmost in the list and working leftward.
  194. A block is read from the first device that provides it without error,
  195. starting with the leftmost in the list and working rightward.
  196. .TP
  197. .BI p device . n1 . n2
  198. A partition starting at
  199. .IR n1 %
  200. from the beginning of
  201. .I device
  202. with a length
  203. .IR n2 %
  204. of the size of the device.
  205. Parenthesize
  206. .I device
  207. if it contains periods.
  208. .TP
  209. .BI x device
  210. A pseudo-device that contains the byte-swapped contents of
  211. .IR device .
  212. Since the file server writes integers to disk in its native byte order,
  213. it can be necessary to use this device to read file systems written
  214. by processors of the other byte order.
  215. .TP
  216. .BR j (\f2device1\ device2\f1...)\f2device3
  217. .I Device1
  218. is the SCSI juke box interface.
  219. The
  220. .IR device2 s
  221. are the SCSI drives in the jukebox and
  222. .I device3
  223. represents the demountable platters in the juke box.
  224. .TP
  225. .BI f device
  226. A pseudo-WORM disk: blocks on
  227. .I device
  228. can be written only once and may not be read unless written.
  229. .TP
  230. .BI c device1device2
  231. A cached WORM. The first
  232. .I device
  233. is the cache, the second the WORM.
  234. .TP
  235. .BI o
  236. (Letter o) The read-only (dump) file system
  237. of the most-recently defined cached WORM file system.
  238. .SS Configuration
  239. The
  240. .B service
  241. command sets the textual name of the server as known in
  242. the network databases.
  243. .PP
  244. The configuration information is stored in block zero on a
  245. device whose device string is written in non-volatile RAM.
  246. The
  247. .B config
  248. and
  249. .B nvram
  250. commands identify the
  251. .I device
  252. on which the information is recorded.
  253. The
  254. .B config
  255. command also erases any previous configuration.
  256. .PP
  257. The
  258. .I filsys
  259. command configures a file system on
  260. .I device
  261. and calls it
  262. .IR name .
  263. .I Name
  264. is used as the specifier in
  265. .B attach
  266. messages to connect to that file system.
  267. (The file system
  268. .B main
  269. is the one attached to if the specifier is null; see
  270. .IR attach (5)).
  271. .PP
  272. The rest of the configuration commands record IP addresses:
  273. the file server's address
  274. .RI ( ip ),
  275. the local gateway's
  276. .RI ( ipgw ),
  277. the local authentication server's
  278. .RI ( ipauth ),
  279. the local subnet mask
  280. .RI ( ipmask ),
  281. and the address of a system running an SNTP server
  282. .RI ( ipsntp ).
  283. .I Ipauth
  284. is no longer used.
  285. If the server has more than one network interface,
  286. a digit may be appended to the keywords
  287. .BR ip ,
  288. .B ipgw
  289. and
  290. .B ipmask
  291. to indicate the interface number;
  292. zero is the default.
  293. .SS "One-time actions"
  294. .PP
  295. The
  296. .I ream
  297. command initializes the named file system. It overwrites
  298. any previous file system on the same device
  299. and creates an empty root directory
  300. on the device.
  301. If
  302. .I name
  303. is
  304. .BR main ,
  305. the file server, until the next reboot,
  306. will accept
  307. .B wstat
  308. messages
  309. (see
  310. .IR stat (5))
  311. that change the owner and group of files,
  312. to enable initializing a fresh file system from a
  313. .IR mkfs (8)
  314. archive.
  315. .PP
  316. For the
  317. .I recover
  318. command, the
  319. named file system
  320. must be a cached WORM.
  321. .I Recover
  322. clears the associated magnetic cache and initializes the file
  323. system, effectively resetting its contents to the last dump.
  324. .PP
  325. .I Allow
  326. turns off all permission checking; use with caution.
  327. .PP
  328. .I Readonly
  329. disables all writing to all devices.
  330. This is useful for trying dangerous experiments.
  331. .PP
  332. .I Noauth
  333. disables authentication.
  334. .PP
  335. .I Noattach
  336. prevents attachs.
  337. .PP
  338. .I Copyworm
  339. will copy a file system named
  340. .I main
  341. to one named
  342. .IR output ,
  343. block by block,
  344. and loop.
  345. It knows how to read a fake worm file system.
  346. .PP
  347. .I Copydev
  348. will copy the device
  349. .I from-dev
  350. to the device
  351. .IR to-dev .
  352. block by block,
  353. and panic.
  354. .PP
  355. .I Halt
  356. will cause the server to
  357. .I immediately
  358. exit and reboot.
  359. .PP
  360. The various configuration commands only record what to do; they write
  361. no data to disk. The command
  362. .I end
  363. exits config mode and begins running the file server proper.
  364. The server will then perform whatever I/O is required to establish
  365. the configuration.
  366. .SH EXAMPLE
  367. Initialize a file server
  368. .B kgbsun
  369. with a single file system interleaved between SCSI targets 3 and 4.
  370. .IP
  371. .EX
  372. service kgbsun
  373. config w3
  374. filsys main [w<3-4>]
  375. ream main
  376. .EE
  377. .PP
  378. Initialize a file server
  379. .B kremvax
  380. with a single disk on target 0 partitioned as a cached pseudo-WORM
  381. file system with the cache on the third quarter of the drive
  382. and the pseudo-WORM on the interleave of the first, second, and
  383. fourth quarters.
  384. .IP
  385. .EX
  386. service kremvax
  387. config p(w0)50.1
  388. filsys main cp(w0)50.25f[p(w0)0.25p(w0)25.25p(w0)75.25]
  389. filsys dump o
  390. ream main
  391. .EE
  392. .PP
  393. A complete and complex example:
  394. initialize a file server
  395. .I fsb
  396. with a single SCSI disk on target 0 for a scratch file system,
  397. a cached WORM file system with cache disk on target 2 and
  398. an optical-disc jukebox on targets 4 (robotics) and 5 (one optical drive),
  399. and another cached WORM file system with cache disk on target 3
  400. and another optical-disc jukebox on a second SCSI bus at targets 3 and 4.
  401. Both jukeboxes contain 16 slots of optical discs.
  402. It has two Ethernet interfaces and can reach an SNTP server on the first one.
  403. .IP
  404. .EX
  405. service fsb
  406. config w0
  407. filsys main cw2j(w4w5)(l<0-31>)
  408. filsys dump o
  409. filsys hp40fx cw3j(w1.<3-4>.0)(l<0-31>)
  410. filsys hp40fxdump o
  411. filsys other w0
  412. ipauth 0.0.0.0
  413. ipsntp 10.9.0.3
  414. ip0 10.9.0.2
  415. ipgw0 10.9.0.3
  416. ipmask0 255.255.0.0
  417. ip1 10.0.0.2
  418. ipgw1 10.0.0.1
  419. ipmask1 255.255.0.0
  420. ream main
  421. ream hp40fx
  422. ream other
  423. end
  424. .EE
  425. .SH SOURCE
  426. .BR /sys/src/fs/port/config.c
  427. .SH "SEE ALSO
  428. Ken Thompson,
  429. ``The Plan 9 File Server''.