fs 14 KB

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