]> git.lizzy.rs Git - plan9front.git/blob - sys/man/8/fs
more stuff
[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 .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 [ admiesw ]
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 i ,
682 IDE/ATA targets;
683 .BR m ,
684 Marvell SATA targets;
685 .BR w ,
686 cached WORM.
687 The
688 .I stata
689 command prints overall statistics about the file system.
690 The
691 .I stats
692 command takes an optional argument identifying the characters
693 of
694 .I stat
695 commands to run.  The option is remembered and becomes the
696 default for subsequent
697 .I stats
698 commands if it begins with a minus sign.
699 .PP
700 .I Sync
701 writes dirty blocks in memory to the magnetic disk cache.
702 .PP
703 .I Time
704 reports the time required to execute the
705 .IR command .
706 .PP
707 .I Trace
708 with no options prints the set of queue-locks held by each process in
709 the file server.  If things are quiescent, there should be no output.
710 With an argument
711 .I number
712 it prints a stack traceback of that process.
713 .PP
714 .I Users
715 uses the contents of
716 .I file
717 (default
718 .BR /adm/users )
719 to initialize the file server's internal representation of the users
720 structure.
721 Incorrectly formatted entries in
722 .I file
723 will be ignored.
724 If file is explicitly
725 .BR default ,
726 the system builds a minimal functional users table internally;
727 this can help recover from disasters.
728 If the
729 .I file
730 cannot be read, you
731 .I must
732 run
733 .IP
734 .EX
735 users default
736 .EE
737 .PP
738 for the system to function.  The
739 .B default
740 table looks like this:
741 .IP
742 .EX
743 -1:adm:adm:
744 0:none:adm:
745 1:tor:tor:
746 10000:sys::
747 10001:map:map:
748 10002:doc::
749 10003:upas:upas:
750 10004:font::
751 10005:bootes:bootes:
752 .EE
753 .PP
754 .I Version
755 reports when the file server was last compiled and last rebooted.
756 .PP
757 .I Who
758 reports, one per line, the names of users connected to the file server and the
759 status of their connections.
760 The first number printed on each line is the channel number of the connection.
761 If
762 .I users
763 are given the output selects connections owned by those users.
764 .PP
765 .I Wormeject
766 moves the WORM disk in slot
767 .I tunit
768 of the first jukebox to the output shelf.
769 .PP
770 .I Wormingest
771 moves the WORM disk from the input shelf of the first jukebox to slot
772 .IR tunit .
773 .PP
774 .I Wormoffline
775 takes
776 .I drive
777 of the first jukebox out of service;
778 .I wormonline
779 puts it back in service.
780 .PP
781 .I Wormreset
782 put discs back where the jukebox thinks they belong,
783 and does this for all jukeboxes.
784 .PP
785 When the file server boots, it prints the message
786 .IP
787 .EX
788 for config mode hit a key within 5 seconds
789 .EE
790 .PP
791 If a character is typed within 5 seconds of the message appearing,
792 the server will enter config mode.
793 See
794 .IR fsconfig (8)
795 for the commands available in config mode.
796 The system also enters config mode if, at boot time,
797 the non-volatile RAM does not appear to contain a valid configuration.
798 .PP
799 .I Exsort
800 is a regular command to be run on a CPU server, not on the file server
801 console.
802 It reads the named
803 .I file
804 (default
805 .BR /adm/cache )
806 and sorts the cache disk block numbers contained therein.
807 It assumes the numbers are 4-byte integers and guesses the
808 endianness by looking at the data.
809 It then prints statistics about the cache.
810 With option
811 .B -w
812 it writes the sorted data back to
813 .IR file .
814 .SH SEE ALSO
815 .IR fs (4)
816 .br
817 Ken Thompson,
818 ``The Plan 9 File Server''.
819 .SH SOURCE
820 .B /sys/src/fs
821 .br
822 .B /sys/src/cmd/disk/exsort.c
823 .SH BUGS
824 The
825 .B worm*
826 commands should accept an argument identifying a jukebox.