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