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