fs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. .TH FS 8
  2. .SH NAME
  3. fs, exsort \- file server maintenance
  4. .SH SYNOPSIS
  5. .PD 0
  6. .B help
  7. [
  8. .I command ...
  9. ]
  10. .PP
  11. .B allow
  12. .PP
  13. .B arp
  14. .I subcommand
  15. .PP
  16. .B cfs
  17. .I filesystem
  18. .PP
  19. .B check
  20. .RI [ options ]
  21. .PP
  22. .B clean
  23. .I file
  24. [
  25. .I bno
  26. [
  27. .I addr
  28. ] ]
  29. .PP
  30. .B clri
  31. .RI [ file ...]
  32. .PP
  33. .B cpu
  34. .RI [ proc ]
  35. .PP
  36. .B create
  37. .I path uid gid perm
  38. .RB [ lad ]
  39. .PP
  40. .B cwcmd
  41. .I subcommand
  42. .PP
  43. .B date
  44. .RB [[ +- ]
  45. .IR seconds ]
  46. .PP
  47. .B disallow
  48. .PP
  49. .B duallow
  50. .RI [ uid ]
  51. .PP
  52. .B dump
  53. [
  54. .I filesystem
  55. ]
  56. .PP
  57. .B files
  58. .PP
  59. .B flag
  60. .I flag
  61. [
  62. .I channel
  63. ]
  64. .PP
  65. .B fstat
  66. [
  67. .I files
  68. ]
  69. .PP
  70. .B halt
  71. .PP
  72. .B hangup
  73. .I channel
  74. .PP
  75. .B newuser
  76. .I name
  77. .RI [ options ]
  78. .PP
  79. .B noattach
  80. .PP
  81. .B passwd
  82. .PP
  83. .B printconf
  84. .PP
  85. .B profile
  86. .RB [ 01 ]
  87. .PP
  88. .B remove
  89. .RI [ files ...]
  90. .PP
  91. .B route
  92. .I subcommand
  93. .PP
  94. .B "sntp kick"
  95. .PP
  96. .BR stat [ adesw ]
  97. .PP
  98. .B stats
  99. .RB [[ - ]
  100. .IR flags ...]
  101. .PP
  102. .B sync
  103. .PP
  104. .B time
  105. .I command
  106. .PP
  107. .B trace
  108. .RI [ number ]
  109. .PP
  110. .B users
  111. .RI [ file ]
  112. .PP
  113. .B version
  114. .PP
  115. .B who
  116. .RI [ user ...]
  117. .PP
  118. .B wormeject
  119. [
  120. .I tunit
  121. ]
  122. .PP
  123. .B wormingest
  124. [
  125. .I tunit
  126. ]
  127. .PP
  128. .B wormoffline
  129. .I drive
  130. .PP
  131. .B wormonline
  132. .I drive
  133. .PP
  134. .B wormreset
  135. .PD
  136. .PP
  137. .B disk/exsort
  138. .RB [ -w ]
  139. .RI [ file ]
  140. .SH DESCRIPTION
  141. Except for
  142. .IR exsort ,
  143. these commands are available only on the console of an
  144. .IR fs (4)
  145. file server.
  146. .\" .PP
  147. .\" The console requires the machine's password to be supplied before
  148. .\" accepting commands. Typing a control-D will cause
  149. .\" the server to request
  150. .\" the password again.
  151. .PP
  152. .I Help
  153. prints a `usage string' for the named
  154. .IR commands ,
  155. by default all commands.
  156. Also, many commands print menus of their options if given
  157. incorrect or incomplete parameters.
  158. .PP
  159. .I Allow
  160. disables permission checking and allows
  161. .BR wstat .
  162. This may help in initializing a file system.
  163. Use this with caution.
  164. .PP
  165. .I Arp
  166. has two
  167. .IR subcommands :
  168. .B print
  169. prints the contents of the ARP cache and
  170. .B flush
  171. flushes it.
  172. .PP
  173. .I Cfs
  174. changes the current file system, that is, the file tree to which
  175. commands
  176. .RB ( check ,
  177. .BR clean ,
  178. .BR clri ,
  179. .BR create ,
  180. .BR cwcmd ,
  181. .BR dump ,
  182. .BR newuser ,
  183. .BR profile ,
  184. .BR remove ,
  185. and
  186. .BR users )
  187. apply.
  188. The initial
  189. .I filesystem
  190. is
  191. .BR main .
  192. .PP
  193. .I Check
  194. verifies the consistency of the current file system.
  195. With no options it checks and reports the status.
  196. It suspends service while running.
  197. Options are:
  198. .TF touch
  199. .PD
  200. .TP
  201. .B rdall
  202. Read every block in the file system (can take a
  203. .I long
  204. time).
  205. Normally,
  206. .I check
  207. will stop short of the actual contents
  208. of a file and just verify the block addresses.
  209. .TP
  210. .B tag
  211. Fix bad
  212. .IR tags ;
  213. each block has a tag that acts as a backwards pointer for
  214. consistency checking.
  215. .TP
  216. .B ream
  217. Fix bad tags
  218. and also clear the contents
  219. of blocks that have bad tags.
  220. .TP
  221. .B pfile
  222. Print every file name.
  223. .TP
  224. .B pdir
  225. Print every directory name.
  226. .TP
  227. .B free
  228. Rebuild the list of free blocks
  229. with all blocks that are not referenced.
  230. This option is only useful on non-cache/WORM
  231. file systems.
  232. If the filesystem was modified, the summary printed
  233. at the conclusion of the check may not reflect the true
  234. state of the freelist and may also print a list of
  235. .I missing
  236. blocks.
  237. These
  238. .I missing
  239. blocks are actually on the free list and the true
  240. state of the filesystem can be determined by running
  241. .I check
  242. with no arguments.
  243. .TP
  244. .B bad
  245. Each block address that is out of range or duplicate is cleared.
  246. Note that only the second and subsequent
  247. use of a block is cleared.
  248. Often the problems in a file system are
  249. caused by one bad file that has a lot of
  250. garbage block addresses.
  251. In such a case,
  252. it is wiser to use
  253. .I check
  254. to find the bad file
  255. (by number of diagnostic messages)
  256. and then use
  257. .I clri
  258. to clear the addresses in that file.
  259. After that,
  260. .I check
  261. can be used to reclaim the free list.
  262. .TP
  263. .B touch
  264. Cause every directory and indirect block not on the current WORM disk
  265. to be advanced to the current WORM on the next dump.
  266. This is a discredited idea to try to keep operating
  267. on the knee of the cache working set.
  268. Buy more cache disk.
  269. .PP
  270. .I Clean
  271. prints the block numbers in
  272. .IR file 's
  273. directory entry (direct, indirect and doubly indirect)
  274. and checks the tags of the blocks cited.
  275. If
  276. .I bno
  277. is supplied, the
  278. .IR bno 'th
  279. block number (using zero origin)
  280. is set to
  281. .I addr
  282. (defaults to zero).
  283. Note that only the block numbers in the directory entry itself
  284. are examined;
  285. .I clean
  286. does not recurse through indirect blocks.
  287. .PP
  288. .I Clri
  289. clears the internal directory entry and abandons storage
  290. associated with
  291. .IR files .
  292. It ignores the usual rules for sanity, such as checking against
  293. removing a non-empty directory.
  294. A subsequent
  295. .B check
  296. .B free
  297. will place the abandoned storage in the free list.
  298. .PP
  299. .I Cpu
  300. prints the CPU utilization and state of the processes in the file server.
  301. If the name of a process type argument is given,
  302. then CPU utilization for only those processes is printed.
  303. .PP
  304. .I Create
  305. creates a file on the current file system.
  306. .I Uid
  307. and
  308. .I gid
  309. are names or numbers from
  310. .BR /adm/users .
  311. .I Perm
  312. is the low 9 bits of the permission mode of the file, in octal.
  313. An optional final
  314. .BR l ,
  315. .BR a ,
  316. or
  317. .BR d
  318. creates a locked file, append-only file, or directory.
  319. .PP
  320. .I Cwcmd
  321. controls the cached WORM file systems,
  322. specifically the current file system.
  323. The subcommands are:
  324. .TP
  325. .BI mvstate " state1 state2 " [ platter ]
  326. States are
  327. .BR none ,
  328. .BR dirty ,
  329. .BR dump ,
  330. .BR dump1 ,
  331. .BR error ,
  332. .BR read ,
  333. and
  334. .BR write .
  335. A
  336. .B mvstate
  337. .B dump1
  338. .B dump
  339. will cause I/O errors in the last dump to be retried.
  340. A
  341. .B mvstate
  342. .B dump1
  343. .B write
  344. will cause I/O errors in the last dump to be retried in
  345. reallocated slots in the next dump.
  346. A
  347. .B mvstate
  348. .B read
  349. .B none
  350. will flush the cache associated with the WORM.
  351. A
  352. .B mvstate
  353. .B dump
  354. .B write
  355. aborts the background process dumping to WORM; as a consequence it
  356. leaves holes in the dump file system.
  357. Other uses are possible but arcane.
  358. The optional
  359. .I platter
  360. limits affected blocks to those on that platter.
  361. .TP
  362. .BR prchain " [\fIstart\fP] [\fLback\fP]
  363. Print the chain of superblocks for the directory containing the
  364. roots of the dumped file systems, starting at block number
  365. .I start
  366. (default 0) going forward (backwards if
  367. .B back
  368. is supplied).
  369. .TP
  370. .BR searchtag " [\fIstart\fP] [\fItag\fP] [\fIblocks\fP]
  371. Reads the WORM device starting at block
  372. .I start
  373. and proceeding for
  374. .I blocks
  375. blocks (default 1000)
  376. until it finds a block with numeric tag
  377. .IR tag .
  378. .TP
  379. .BR savecache " [\fIpercent\fP]
  380. Copy the block numbers, in native endian longwords, of blocks in the
  381. .B read
  382. state to the file
  383. .BR /adm/cache
  384. for use by
  385. .BR disk/exsort .
  386. If an argument is given,
  387. then that percent (most recently used) of each cache bucket
  388. is copied.
  389. .TP
  390. .BR loadcache " [\fIdskno\fP]
  391. Read
  392. .B /adm/cache
  393. and for every block there on WORM disk side
  394. .I dskno
  395. (zero-origin),
  396. read the block from WORM to the cache.
  397. If
  398. .I dskno
  399. is not supplied, all blocks in
  400. .B /adm/cache
  401. are read.
  402. .TP
  403. .BR morecache " dskno [\fIcount\fP]
  404. Read
  405. .I count
  406. blocks from the beginning of WORM disk side
  407. .I dskno
  408. to the cache.
  409. If no count is given,
  410. read all of side
  411. .IR dskno
  412. into the cache.
  413. .TP
  414. .BR startdump \ [ 01 ]
  415. Suspend
  416. .RB ( 0 )
  417. or restart
  418. .RB ( 1 )
  419. the background dump process.
  420. .TP
  421. .B touchsb
  422. Verify that the superblock on the WORM is readable, ignoring the cached copy.
  423. .TP
  424. .BR blockcmp " [\fIwbno\fP] [\fIcbno\fP]
  425. Compares the WORM block
  426. .I wbno
  427. with the cache block
  428. .I cbno
  429. and prints the first 10 differences, if any.
  430. .TP
  431. .B acct
  432. Prints how many times each user has caused the system to allocate new space on the WORM;
  433. the units are megabytes.
  434. .TP
  435. .B clearacct
  436. Clears the accounting records for
  437. .BR acct .
  438. .PP
  439. .I Date
  440. prints the current date. It may be adjusted
  441. using
  442. .BI +- seconds\f1.
  443. With no sign, it sets the date to the absolute number of seconds
  444. since 00:00 Jan 1, 1970 GMT; with a sign it trims the current
  445. time.
  446. .PP
  447. .I Disallow
  448. restores permission checking back to normal after a file system
  449. has been initialized.
  450. .PP
  451. .I Duallow
  452. sets permissions such that
  453. the named
  454. .I user
  455. can read and search any directories.
  456. This is the permission necessary to do a
  457. .IR du (1)
  458. command anywhere in the file system to discover disk usage.
  459. .PP
  460. .I Dump
  461. starts a dump to WORM immediately for
  462. the named filesystem,
  463. or the current filesystem if none is named.
  464. File service is suspended while the cache is scanned;
  465. service resumes when the copy to WORM starts.
  466. .PP
  467. .I Files
  468. prints for every connection the number of allocated fids.
  469. .PP
  470. .I Fstat
  471. prints the current status of each named
  472. .IR file ,
  473. including uid, gid, wuid (uid of the last user to modify the file),
  474. size, qid, and disk addresses.
  475. .PP
  476. .I Flag
  477. toggles flags, initially all off:
  478. .TF authdisablexx
  479. .TP
  480. .B allchans
  481. Print channels in
  482. .I who
  483. output.
  484. .TP
  485. .B arp
  486. Report ARP activity.
  487. .TP
  488. .B attach
  489. Report as connections are made to the file server.
  490. .TP
  491. .B authdebug
  492. Report authentications.
  493. .TP
  494. .B authdisable
  495. Disable authentication.
  496. .TP
  497. .B chat
  498. (Very noisy.) Print all 9P messages to and from the server.
  499. .TP
  500. .B error
  501. Report 9P errors.
  502. .TP
  503. .B il
  504. Report IL errors.
  505. .TP
  506. .B route
  507. Report received RIP packets.
  508. .TP
  509. .B ro
  510. Report I/O on the WORM device.
  511. .TP
  512. .B sntp
  513. Report SNTP activity.
  514. .PD
  515. .PP
  516. If given a second numeric
  517. .I channel
  518. argument,
  519. as reported by
  520. .IR who ,
  521. the flag is altered only on that connection.
  522. .PP
  523. .I Halt
  524. does a
  525. .B sync
  526. and halts the machine, returning to the boot ROM.
  527. .PP
  528. .I Hangup
  529. clunks all the fids on the named
  530. .IR channel ,
  531. which has the same format as in the output of the
  532. .I who
  533. command.
  534. .PP
  535. .I Newuser
  536. requires a
  537. .I name
  538. argument.
  539. With no options it adds user
  540. .IR name ,
  541. with group leader
  542. .IR name ,
  543. to
  544. .B /adm/users
  545. and makes the directory
  546. .BI /usr/ name
  547. owned by user and group
  548. .IR name .
  549. The options are
  550. .TF =leaderxx
  551. .TP
  552. .B ?
  553. Print the entry for
  554. .IR name .
  555. .TP
  556. .B :
  557. Add a group: add the name to
  558. .B /adm/users
  559. but don't create the directory.
  560. By convention, groups are numbered starting from 10000, users from 0.
  561. .TP
  562. .I newname
  563. Rename existing user
  564. .I name
  565. to
  566. .IR newname .
  567. .TP
  568. .BI = leader
  569. Change the leader of
  570. .I name
  571. to
  572. .IR leader .
  573. If
  574. .I leader
  575. is missing, remove the existing leader.
  576. .TP
  577. .BI + member
  578. Add
  579. .I member
  580. to the member list of
  581. .IR name .
  582. .TP
  583. .BI - member
  584. Remove existing
  585. .I member
  586. from the member list of
  587. .IR name .
  588. .PD
  589. .PP
  590. After a successful
  591. .I newuser
  592. command the file server overwrites
  593. .B /adm/users
  594. to reflect the internal state of the user table.
  595. .PP
  596. .I Noattach
  597. disables
  598. .IR attach (5)
  599. messages, in particular for system maintenance.
  600. Previously attached connections are unaffected.
  601. Another
  602. .I noattach
  603. will enable normal behavior.
  604. .PP
  605. .I Passwd
  606. sets the machine's password and writes it in non-volatile RAM.
  607. .PP
  608. .I Printconf
  609. prints the system configuration information.
  610. .PP
  611. .I Profile
  612. .B 1
  613. clears the profiling buffer and enables profiling;
  614. .I profile
  615. .B 0
  616. stops profiling and writes the data to
  617. .B /adm/kprofdata
  618. for use by
  619. .B kprof
  620. (see
  621. .IR prof (1)).
  622. If a number is not specified, the profiling state toggles.
  623. .PP
  624. .I Remove
  625. removes
  626. .IR files .
  627. .PP
  628. .I Route
  629. maintains an IP routing table. The
  630. .I subcommands
  631. are:
  632. .TF "add dest gate mask"
  633. .TP
  634. .B add \f2dest gate \fP[\f2mask\fP]
  635. Add a static route from IP address
  636. .I dest
  637. using gateway
  638. .I gate
  639. with an optional subnet
  640. .IR mask .
  641. .TP
  642. .B delete \f2dest\fP
  643. Delete an entry from the routing table.
  644. .TP
  645. .B print
  646. Display the contents of the routing table.
  647. .TP
  648. .B ripon
  649. Enables the table to be filled from RIP packets.
  650. .TP
  651. .B ripoff
  652. Disables the table from being updated by RIP packets.
  653. .PD
  654. .PP
  655. .I Sntp
  656. .I kick
  657. queries the SNTP server
  658. (see
  659. .IR fsconfig (8))
  660. and sets the time with its response.
  661. .PP
  662. The
  663. .I stat
  664. commands are connected with a service or device identified by the
  665. last character of the name:
  666. .BR d ,
  667. SCSI targets;
  668. .BR e ,
  669. Ethernet controllers;
  670. .BR w ,
  671. cached WORM.
  672. The
  673. .I stata
  674. command prints overall statistics about the file system.
  675. The
  676. .I stats
  677. command takes an optional argument identifying the characters
  678. of
  679. .I stat
  680. commands to run. The option is remembered and becomes the
  681. default for subsequent
  682. .I stats
  683. commands if it begins with a minus sign.
  684. .PP
  685. .I Sync
  686. writes dirty blocks in memory to the magnetic disk cache.
  687. .PP
  688. .I Time
  689. reports the time required to execute the
  690. .IR command .
  691. .PP
  692. .I Trace
  693. with no options prints the set of queue-locks held by each process in
  694. the file server. If things are quiescent, there should be no output.
  695. With an argument
  696. .I number
  697. it prints a stack traceback of that process.
  698. .PP
  699. .I Users
  700. uses the contents of
  701. .I file
  702. (default
  703. .BR /adm/users )
  704. to initialize the file server's internal representation of the users
  705. structure.
  706. Incorrectly formatted entries in
  707. .I file
  708. will be ignored.
  709. If file is explicitly
  710. .BR default ,
  711. the system builds a minimal functional users table internally;
  712. this can help recover from disasters.
  713. If the
  714. .I file
  715. cannot be read, you
  716. .I must
  717. run
  718. .IP
  719. .EX
  720. users default
  721. .EE
  722. .PP
  723. for the system to function. The
  724. .B default
  725. table looks like this:
  726. .IP
  727. .EX
  728. -1:adm:adm:
  729. 0:none:adm:
  730. 1:tor:tor:
  731. 10000:sys::
  732. 10001:map:map:
  733. 10002:doc::
  734. 10003:upas:upas:
  735. 10004:font::
  736. 10005:bootes:bootes:
  737. .EE
  738. .PP
  739. .I Version
  740. reports when the file server was last compiled and last rebooted.
  741. .PP
  742. .I Who
  743. reports, one per line, the names of users connected to the file server and the
  744. status of their connections.
  745. The first number printed on each line is the channel number of the connection.
  746. If
  747. .I users
  748. are given the output selects connections owned by those users.
  749. .PP
  750. .I Wormeject
  751. moves the WORM disk in slot
  752. .I tunit
  753. of the first jukebox to the output shelf.
  754. .PP
  755. .I Wormingest
  756. moves the WORM disk from the input shelf of the first jukebox to slot
  757. .IR tunit .
  758. .PP
  759. .I Wormoffline
  760. takes
  761. .I drive
  762. of the first jukebox out of service;
  763. .I wormonline
  764. puts it back in service.
  765. .PP
  766. .I Wormreset
  767. put discs back where the jukebox thinks they belong,
  768. and does this for all jukeboxes.
  769. .PP
  770. When the file server boots, it prints the message
  771. .IP
  772. .EX
  773. for config mode hit a key within 5 seconds
  774. .EE
  775. .PP
  776. If a character is typed within 5 seconds of the message appearing,
  777. the server will enter config mode.
  778. See
  779. .IR fsconfig (8)
  780. for the commands available in config mode.
  781. The system also enters config mode if, at boot time,
  782. the non-volatile RAM does not appear to contain a valid configuration.
  783. .PP
  784. .I Exsort
  785. is a regular command to be run on a CPU server, not on the file server
  786. console.
  787. It reads the named
  788. .I file
  789. (default
  790. .BR /adm/cache )
  791. and sorts the cache disk block numbers contained therein.
  792. It assumes the numbers are 4-byte integers and guesses the
  793. endianness by looking at the data.
  794. It then prints statistics about the cache.
  795. With option
  796. .B -w
  797. it writes the sorted data back to
  798. .IR file .
  799. .SH SEE ALSO
  800. .IR fs (4)
  801. .br
  802. Ken Thompson,
  803. ``The Plan 9 File Server''.
  804. .SH SOURCE
  805. .B /sys/src/fs
  806. .br
  807. .B /sys/src/cmd/disk/exsort.c
  808. .SH BUGS
  809. The
  810. .B worm*
  811. commands should accept an argument identifying a jukebox.