fs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  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. .TP
  270. .B trim
  271. reduces the file system's
  272. .I fsize
  273. to fit the device containing the file system.
  274. This is useful after copying a partially-full file system
  275. into a slightly smaller device.
  276. Running
  277. .B "check free"
  278. afterward will construct a new free list that contains no
  279. blocks outside the new, smaller file system.
  280. .PP
  281. .I Clean
  282. prints the block numbers in
  283. .IR file 's
  284. directory entry (direct, indirect and doubly indirect)
  285. and checks the tags of the blocks cited.
  286. If
  287. .I bno
  288. is supplied, the
  289. .IR bno 'th
  290. block number (using zero origin)
  291. is set to
  292. .I addr
  293. (defaults to zero).
  294. Note that only the block numbers in the directory entry itself
  295. are examined;
  296. .I clean
  297. does not recurse through indirect blocks.
  298. .PP
  299. .I Clri
  300. clears the internal directory entry and abandons storage
  301. associated with
  302. .IR files .
  303. It ignores the usual rules for sanity, such as checking against
  304. removing a non-empty directory.
  305. A subsequent
  306. .B check
  307. .B free
  308. will place the abandoned storage in the free list.
  309. .PP
  310. .I Cpu
  311. prints the CPU utilization and state of the processes in the file server.
  312. If the name of a process type argument is given,
  313. then CPU utilization for only those processes is printed.
  314. .PP
  315. .I Create
  316. creates a file on the current file system.
  317. .I Uid
  318. and
  319. .I gid
  320. are names or numbers from
  321. .BR /adm/users .
  322. .I Perm
  323. is the low 9 bits of the permission mode of the file, in octal.
  324. An optional final
  325. .BR l ,
  326. .BR a ,
  327. or
  328. .BR d
  329. creates a locked file, append-only file, or directory.
  330. .PP
  331. .I Cwcmd
  332. controls the cached WORM file systems,
  333. specifically the current file system.
  334. The subcommands are:
  335. .TP
  336. .BI mvstate " state1 state2 " [ platter ]
  337. States are
  338. .BR none ,
  339. .BR dirty ,
  340. .BR dump ,
  341. .BR dump1 ,
  342. .BR error ,
  343. .BR read ,
  344. and
  345. .BR write .
  346. A
  347. .B mvstate
  348. .B dump1
  349. .B dump
  350. will cause I/O errors in the last dump to be retried.
  351. A
  352. .B mvstate
  353. .B dump1
  354. .B write
  355. will cause I/O errors in the last dump to be retried in
  356. reallocated slots in the next dump.
  357. A
  358. .B mvstate
  359. .B read
  360. .B none
  361. will flush the cache associated with the WORM.
  362. A
  363. .B mvstate
  364. .B dump
  365. .B write
  366. aborts the background process dumping to WORM; as a consequence it
  367. leaves holes in the dump file system.
  368. Other uses are possible but arcane.
  369. The optional
  370. .I platter
  371. limits affected blocks to those on that platter.
  372. .TP
  373. .BR prchain " [\fIstart\fP] [\fIback-flag\fP]
  374. Print the chain of superblocks for the directory containing the
  375. roots of the dumped file systems, starting at block number
  376. .I start
  377. (default 0) going forward (backwards if
  378. .I back-flag
  379. is supplied and is non-zero).
  380. .TP
  381. .BR searchtag " [\fIstart\fP] [\fItag\fP] [\fIblocks\fP]
  382. Reads the WORM device starting at block
  383. .I start
  384. and proceeding for
  385. .I blocks
  386. blocks (default 1000)
  387. until it finds a block with numeric tag
  388. .IR tag .
  389. .TP
  390. .BR savecache " [\fIpercent\fP]
  391. Copy the block numbers, in native endian longwords, of blocks in the
  392. .B read
  393. state to the file
  394. .BR /adm/cache
  395. for use by
  396. .BR disk/exsort .
  397. If an argument is given,
  398. then that percent (most recently used) of each cache bucket
  399. is copied.
  400. .TP
  401. .BR loadcache " [\fIdskno\fP]
  402. Read
  403. .B /adm/cache
  404. and for every block there on WORM disk side
  405. .I dskno
  406. (zero-origin),
  407. read the block from WORM to the cache.
  408. If
  409. .I dskno
  410. is not supplied, all blocks in
  411. .B /adm/cache
  412. are read.
  413. .TP
  414. .BR morecache " dskno [\fIcount\fP]
  415. Read
  416. .I count
  417. blocks from the beginning of WORM disk side
  418. .I dskno
  419. to the cache.
  420. If no count is given,
  421. read all of side
  422. .IR dskno
  423. into the cache.
  424. .TP
  425. .BR startdump \ [ 01 ]
  426. Suspend
  427. .RB ( 0 )
  428. or restart
  429. .RB ( 1 )
  430. the background dump process.
  431. .TP
  432. .B touchsb
  433. Verify that the superblock on the WORM is readable, ignoring the cached copy.
  434. .TP
  435. .BR blockcmp " [\fIwbno\fP] [\fIcbno\fP]
  436. Compares the WORM block
  437. .I wbno
  438. with the cache block
  439. .I cbno
  440. and prints the first 10 differences, if any.
  441. .TP
  442. .B acct
  443. Prints how many times each user has caused the system to allocate new space on the WORM;
  444. the units are megabytes.
  445. .TP
  446. .B clearacct
  447. Clears the accounting records for
  448. .BR acct .
  449. .PP
  450. .I Date
  451. prints the current date. It may be adjusted
  452. using
  453. .BI +- seconds\f1.
  454. With no sign, it sets the date to the absolute number of seconds
  455. since 00:00 Jan 1, 1970 GMT; with a sign it trims the current
  456. time.
  457. .PP
  458. .I Disallow
  459. restores permission checking back to normal after a file system
  460. has been initialized.
  461. .PP
  462. .I Duallow
  463. sets permissions such that
  464. the named
  465. .I user
  466. can read and search any directories.
  467. This is the permission necessary to do a
  468. .IR du (1)
  469. command anywhere in the file system to discover disk usage.
  470. .PP
  471. .I Dump
  472. starts a dump to WORM immediately for
  473. the named filesystem,
  474. or the current filesystem if none is named.
  475. File service is suspended while the cache is scanned;
  476. service resumes when the copy to WORM starts.
  477. .PP
  478. .I Files
  479. prints for every connection the number of allocated fids.
  480. .PP
  481. .I Fstat
  482. prints the current status of each named
  483. .IR file ,
  484. including uid, gid, wuid (uid of the last user to modify the file),
  485. size, qid, and disk addresses.
  486. .PP
  487. .I Flag
  488. toggles flags, initially all off:
  489. .TF authdisablexx
  490. .TP
  491. .B allchans
  492. Print channels in
  493. .I who
  494. output.
  495. .TP
  496. .B arp
  497. Report ARP activity.
  498. .TP
  499. .B attach
  500. Report as connections are made to the file server.
  501. .TP
  502. .B authdebug
  503. Report authentications.
  504. .TP
  505. .B authdisable
  506. Disable authentication.
  507. .TP
  508. .B chat
  509. (Very noisy.) Print all 9P messages to and from the server.
  510. .TP
  511. .B error
  512. Report 9P errors.
  513. .TP
  514. .B il
  515. Report IL errors.
  516. .TP
  517. .B route
  518. Report received RIP packets.
  519. .TP
  520. .B ro
  521. Report I/O on the WORM device.
  522. .TP
  523. .B sntp
  524. Report SNTP activity.
  525. .PD
  526. .PP
  527. If given a second numeric
  528. .I channel
  529. argument,
  530. as reported by
  531. .IR who ,
  532. the flag is altered only on that connection.
  533. .PP
  534. .I Halt
  535. does a
  536. .B sync
  537. and halts the machine, returning to the boot ROM.
  538. .PP
  539. .I Hangup
  540. clunks all the fids on the named
  541. .IR channel ,
  542. which has the same format as in the output of the
  543. .I who
  544. command.
  545. .PP
  546. .I Newuser
  547. requires a
  548. .I name
  549. argument.
  550. With no options it adds user
  551. .IR name ,
  552. with group leader
  553. .IR name ,
  554. to
  555. .B /adm/users
  556. and makes the directory
  557. .BI /usr/ name
  558. owned by user and group
  559. .IR name .
  560. The options are
  561. .TF =leaderxx
  562. .TP
  563. .B ?
  564. Print the entry for
  565. .IR name .
  566. .TP
  567. .B :
  568. Add a group: add the name to
  569. .B /adm/users
  570. but don't create the directory.
  571. By convention, groups are numbered starting from 10000, users from 0.
  572. .TP
  573. .I newname
  574. Rename existing user
  575. .I name
  576. to
  577. .IR newname .
  578. .TP
  579. .BI = leader
  580. Change the leader of
  581. .I name
  582. to
  583. .IR leader .
  584. If
  585. .I leader
  586. is missing, remove the existing leader.
  587. .TP
  588. .BI + member
  589. Add
  590. .I member
  591. to the member list of
  592. .IR name .
  593. .TP
  594. .BI - member
  595. Remove existing
  596. .I member
  597. from the member list of
  598. .IR name .
  599. .PD
  600. .PP
  601. After a successful
  602. .I newuser
  603. command the file server overwrites
  604. .B /adm/users
  605. to reflect the internal state of the user table.
  606. .PP
  607. .I Noattach
  608. disables
  609. .IR attach (5)
  610. messages, in particular for system maintenance.
  611. Previously attached connections are unaffected.
  612. Another
  613. .I noattach
  614. will enable normal behavior.
  615. .PP
  616. .I Passwd
  617. sets the machine's password and writes it in non-volatile RAM.
  618. .PP
  619. .I Printconf
  620. prints the system configuration information.
  621. .PP
  622. .I Profile
  623. .B 1
  624. clears the profiling buffer and enables profiling;
  625. .I profile
  626. .B 0
  627. stops profiling and writes the data to
  628. .B /adm/kprofdata
  629. for use by
  630. .B kprof
  631. (see
  632. .IR prof (1)).
  633. If a number is not specified, the profiling state toggles.
  634. .PP
  635. .I Remove
  636. removes
  637. .IR files .
  638. .PP
  639. .I Route
  640. maintains an IP routing table. The
  641. .I subcommands
  642. are:
  643. .TF "add dest gate mask"
  644. .TP
  645. .B add \f2dest gate \fP[\f2mask\fP]
  646. Add a static route from IP address
  647. .I dest
  648. using gateway
  649. .I gate
  650. with an optional subnet
  651. .IR mask .
  652. .TP
  653. .B delete \f2dest\fP
  654. Delete an entry from the routing table.
  655. .TP
  656. .B print
  657. Display the contents of the routing table.
  658. .TP
  659. .B ripon
  660. Enables the table to be filled from RIP packets.
  661. .TP
  662. .B ripoff
  663. Disables the table from being updated by RIP packets.
  664. .PD
  665. .PP
  666. .I Sntp
  667. .I kick
  668. queries the SNTP server
  669. (see
  670. .IR fsconfig (8))
  671. and sets the time with its response.
  672. .PP
  673. The
  674. .I stat
  675. commands are connected with a service or device identified by the
  676. last character of the name:
  677. .BR d ,
  678. SCSI targets;
  679. .BR e ,
  680. Ethernet controllers;
  681. .BR w ,
  682. cached WORM.
  683. The
  684. .I stata
  685. command prints overall statistics about the file system.
  686. The
  687. .I stats
  688. command takes an optional argument identifying the characters
  689. of
  690. .I stat
  691. commands to run. The option is remembered and becomes the
  692. default for subsequent
  693. .I stats
  694. commands if it begins with a minus sign.
  695. .PP
  696. .I Sync
  697. writes dirty blocks in memory to the magnetic disk cache.
  698. .PP
  699. .I Time
  700. reports the time required to execute the
  701. .IR command .
  702. .PP
  703. .I Trace
  704. with no options prints the set of queue-locks held by each process in
  705. the file server. If things are quiescent, there should be no output.
  706. With an argument
  707. .I number
  708. it prints a stack traceback of that process.
  709. .PP
  710. .I Users
  711. uses the contents of
  712. .I file
  713. (default
  714. .BR /adm/users )
  715. to initialize the file server's internal representation of the users
  716. structure.
  717. Incorrectly formatted entries in
  718. .I file
  719. will be ignored.
  720. If file is explicitly
  721. .BR default ,
  722. the system builds a minimal functional users table internally;
  723. this can help recover from disasters.
  724. If the
  725. .I file
  726. cannot be read, you
  727. .I must
  728. run
  729. .IP
  730. .EX
  731. users default
  732. .EE
  733. .PP
  734. for the system to function. The
  735. .B default
  736. table looks like this:
  737. .IP
  738. .EX
  739. -1:adm:adm:
  740. 0:none:adm:
  741. 1:tor:tor:
  742. 10000:sys::
  743. 10001:map:map:
  744. 10002:doc::
  745. 10003:upas:upas:
  746. 10004:font::
  747. 10005:bootes:bootes:
  748. .EE
  749. .PP
  750. .I Version
  751. reports when the file server was last compiled and last rebooted.
  752. .PP
  753. .I Who
  754. reports, one per line, the names of users connected to the file server and the
  755. status of their connections.
  756. The first number printed on each line is the channel number of the connection.
  757. If
  758. .I users
  759. are given the output selects connections owned by those users.
  760. .PP
  761. .I Wormeject
  762. moves the WORM disk in slot
  763. .I tunit
  764. of the first jukebox to the output shelf.
  765. .PP
  766. .I Wormingest
  767. moves the WORM disk from the input shelf of the first jukebox to slot
  768. .IR tunit .
  769. .PP
  770. .I Wormoffline
  771. takes
  772. .I drive
  773. of the first jukebox out of service;
  774. .I wormonline
  775. puts it back in service.
  776. .PP
  777. .I Wormreset
  778. put discs back where the jukebox thinks they belong,
  779. and does this for all jukeboxes.
  780. .PP
  781. When the file server boots, it prints the message
  782. .IP
  783. .EX
  784. for config mode hit a key within 5 seconds
  785. .EE
  786. .PP
  787. If a character is typed within 5 seconds of the message appearing,
  788. the server will enter config mode.
  789. See
  790. .IR fsconfig (8)
  791. for the commands available in config mode.
  792. The system also enters config mode if, at boot time,
  793. the non-volatile RAM does not appear to contain a valid configuration.
  794. .PP
  795. .I Exsort
  796. is a regular command to be run on a CPU server, not on the file server
  797. console.
  798. It reads the named
  799. .I file
  800. (default
  801. .BR /adm/cache )
  802. and sorts the cache disk block numbers contained therein.
  803. It assumes the numbers are 4-byte integers and guesses the
  804. endianness by looking at the data.
  805. It then prints statistics about the cache.
  806. With option
  807. .B -w
  808. it writes the sorted data back to
  809. .IR file .
  810. .SH SEE ALSO
  811. .IR fs (4)
  812. .br
  813. Ken Thompson,
  814. ``The Plan 9 File Server''.
  815. .SH SOURCE
  816. .B /sys/src/fs
  817. .br
  818. .B /sys/src/cmd/disk/exsort.c
  819. .SH BUGS
  820. The
  821. .B worm*
  822. commands should accept an argument identifying a jukebox.