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