aboutsummaryrefslogtreecommitdiff
path: root/man/man4/fossil.4
blob: fd6dd0a9af70e299bf877542a20087e60664d375 (plain)
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
.TH FOSSIL 4
.SH NAME
fossil, flchk, flfmt \- archival file server
.SH SYNOPSIS
.B fossil/fossil
[
.B -Dt
]
[
.B -c
.I cmd
]...
[
.B -f
.I file
]
[
.B -m
.I free-memory-percent
]
.PP
.B fossil/flchk
[
.B -f
]
[
.B -c
.I ncache
]
[
.B -h
.I host
]
.I file
.PP
.B fossil/flfmt
[
.B -y
]
[
.B -b
.I blocksize
]
[
.B -h
.I host
]
[
.B -l
.I label
]
[
.B -v
.I score
]
.I file
.PP
.B fossil/conf
[
.B -w
]
.I file
[
.I config
]
.PP
.B fossil/last
.I file
.SH DESCRIPTION
.I Fossil
is the main file system for Plan 9.
Unlike the Plan 9 file servers of old,
.I fossil
is a collection of user-space programs that run on a standard Plan 9 kernel.
The name of the main fossil file server at Murray Hill is
.BR pie .
The Plan 9 distribution file server,
.BR sources ,
is also a fossil server.
.PP
.I Fossil
is structured as a magnetic disk write buffer
optionally backed by a Venti server for archival storage.
It serves the Plan 9 protocol via TCP.
A
.I fossil
file server conventionally presents
three trees in the root directory of each file system:
.BR active ,
.BR archive ,
and
.BR snapshot .
.B /active
is the root of a conventional file system
whose blocks are stored in a disk file.
In a typical configuration, the file server periodically
marks the entire file system copy-on-write, effectively
taking a snapshot of the file system at that moment.
This snapshot is made available in a name
created from the date and time of the snapshot:
.BI /snapshot/ yyyy / mmdd / hhmm \fR,
where
.I yyyy
is the full year,
.I mm
is the month number,
.I dd
is the day number,
.I hh
is the hour,
and
.I mm
is the minute.
The snapshots in
.B /snapshot
are ephemeral: eventually they are deleted
to reclaim the disk space they occupy.
Long-lasting snapshots stored on a Venti server
are kept in 
.B /archive
and also named from the date (though not the time) of the snapshot:
.BI /archive/ yyyy / mmdds \fR,
where
.IR yyyy ,
.IR mm ,
and
.I dd
are year, month, and day as before,
and
.I s
is a sequence number if more than one
archival snapshot is done in a day.
For the first snapshot,
.I s
is null.
For the subsequent snapshots,
.I s
is
.BR .1 ,
.BR .2 ,
.BR .3 ,
etc.
The root of the main file system that is frozen
for the first archival snapshot of December 15, 2002
will be named
.BR /archive/2002/1215/ .
.PP
The attach name used in
.I mount
(see
.MR bind (1) ,
.MR bind (2)
and
.MR attach (5) )
selects a file system to be served
and optionally a subtree,
in the format
.IB fs \fR[\fB/ dir \fR].
An empty attach name selects
.BR main/active .
.PP
.I Fossil
normally requires all users except
.L none
to provide authentication tickets on each
.MR attach (5) .
To keep just anyone from connecting,
.L none
is only allowed to attach after another user
has successfully attached on the same
connection.
The other user effectively acts as a chaperone
for
.LR none .
Authentication can be disabled using the
.B -A
flag to
.B open
or
.B srv
(see
.MR fossilcons (8) ).
.PP
The groups called
.B noworld
and
.B write
are special on the file server.
Any user belonging to
.B noworld
has attenuated access privileges.
Specifically, when checking such a user's access to files,
the file's permission bits are first ANDed
with 0770 for normal files and 0771 for directories.
The effect is to deny world access permissions to
.B noworld
users, except when walking into directories.
If the
.B write
group exists, then the file system appears read-only
to users not in the group.
This is used to make the Plan 9 distribution file server
.RI ( sources.cs.bell-labs.com )
readable by the world but writable only to the developers.
.PP
.I Fossil
starts a new instance of the fossil file server.
It is configured mainly through console commands,
documented in
.MR fossilcons (8) .
.PP
The options are:
.TF "-c\fI cmd
.PD
.TP
.B -D
Toggle the debugging flag, which is initially off.
When the flag is set, information about authentication
and all protocol messages are written to standard error.
.TP
.B -t
Start a file server console on
.BR /dev/cons .
If this option is given,
.I fossil
does not fork itself into the background.
.TP
.BI -c " cmd
Execute the console command
.IR cmd .
This option may be repeated to give multiple
commands.
Typically the only commands given on the
command line are
.RB `` ".\fI file" ,''
which executes a file containing commands,
and
.RB `` "srv -p" \fIcons \fR,''
which starts a file server console on
.BI /srv/ cons \fR.
See
.MR fossilcons (8)
for more information.
.TP
.BI -f " file
Read and execute console commands stored in the Fossil disk 
.IR file .
.I Conf
.RI ( q.v. )
reads and writes the command set stored in the disk.
.TP
.B -m
Allocate
.I free-memory-percent
percent of the available free RAM for buffers.
This overrides all other memory sizing parameters,
notably the
.B -c
option to
.BR open .
30% is a reasonable choice.
.PD
.PP
.I Flchk
checks the fossil file system stored in
.I file
for inconsistencies.
.I Flchk
is deprecated in favor of the console
.B check
command (see
.MR fossilcons (8) ).
.I Flchk
prints
.I fossil
console commands that may be
executed to take care of
bad pointers
.RB ( clrp ),
bad entries
.RB ( clre ),
bad directory entries
.RB ( clri ),
unreachable blocks
.RB ( bfree ).
Console commands are interspersed with
more detailed commentary on the file system.
The commands are distinguished by being prefixed with
sharp signs.
Note that all proposed fixes are rather drastic: offending
pieces of file system are simply chopped off.
.PP
.I Flchk
does
.I not
modify the file system, so it is safe to
run concurrently with
.IR fossil ,
though in this case
the list of unreachable
blocks and any inconsistencies involving the active file system
should be taken with a grain of salt.
.PP
The options are:
.TF "-h\fI host
.PD
.TP
.B -f
Fast mode.
By default,
.I flchk
checks the entire file system image for consistency,
which includes all the archives to Venti
and can take a very long time.
In fast mode,
.I flchk
avoids walking in Venti blocks
whenever possible.
.TP
.BI -c " ncache
Keep a cache of
.I ncache
(by default, 1000)
file system blocks in memory during the check.
.TP
.BI -h " host
Use
.I host
as the Venti server.
.PD
.PP
.I Flfmt
prepares
.I file
as a new fossil file system.
The file system is initialized with three empty directories
.BR active ,
.BR archive ,
and
.BR snapshot ,
as described above.
The options are:
.TF "-b\fI blocksize
.PD
.TP
.B -y
Yes mode.
By default,
.I flfmt
will prompt for confirmation before formatting
a file that already contains a fossil file system,
and before formatting a file that is not served
directly by a kernel device.
If the
.B -y
flag is given, no such checks are made.
.TP
.BI -b " blocksize
Set the file system block size (by default, 8192).
.TP
.BI -h " host
Use
.I host
as the Venti server.
.TP
.BI -l " label
Set the textual label on the file system to
.IR label .
The label is only a comment.
.TP
.BI -v " score
Initialize the file system using the vac file
system stored on Venti at
.IR score .
The score should have been generated by
.I fossil
rather than by
.MR vac (1) ,
so that the appropriate snapshot metadata is present.
.PD
.PP
.I Conf
reads or writes the configuration branded on the Fossil disk
.IR file .
By default, it reads the configuration from the disk and prints it to
standard output.
If the
.B -w
flag is given,
.I conf
reads a new configuration from 
.I config
(or else from standard input)
and writes it to the disk.
Inside the configuration file, the argument
.L *
may be used to stand in for the name of the disk holding the configuration.
The Plan 9 kernel boot process runs
.RB `` fossil
.B -f
.IR disk ''
to start a Fossil file server.
The disk is just a convenient place to store configuration
information.
.PP
.I Last
prints the vac score that resulted after the most recent archival snapshot 
of the fossil in
.I file.
.SH EXAMPLES
.PP
Place the root of the archive file system on
.B /n/dump
and show the modified times of the MIPS C compiler
over all dumps in December 2002:
.IP
.EX
9fs dump
ls -l /n/dump/2002/12*/mips/bin/vc
.EE
.PP
To get only one line of output for each version of the compiler:
.IP
.EX
ls -lp /n/dump/2002/12*/mips/bin/vc | uniq
.EE
.ne 14
.PP
Initialize a new file system, start the server with permission
checking turned off, create a users file, and mount the server:
.IP
.EX
fossil/flfmt /dev/sdC0/fossil
fossil/conf -w /dev/sdC0/fossil <<EOF
fsys main config
fsys main open -AWP
fsys main
create /active/adm adm sys d775
create /active/adm/users adm sys 664
users -w
srv -p fscons
srv fossil
EOF
fossil/fossil -f /dev/sdC0/fossil
mount /srv/fossil /n/fossil
.EE
.LP
See the discussion of the
.B users
and
.B uname
commands in
.MR fossilcons (8)
for more about the user table.
.ne 3
.PP
Perhaps because the disk has been corrupted or replaced,
format a new file system using the last archive score printed
on the console:
.IP
.EX
fossil/flfmt -v b9b3...5559 /dev/sdC0/fossil
.EE
.LP
Note that while
.B /snapshot
will be lost,
.B /active
and
.B /archive
will be restored to their contents at the time of the
last archival snapshot.
.ne 3
.PP
Blindly accept the changes prescribed by
.I flchk
(not recommended):
.IP
.EX
fossil/flchk /dev/sdC0/fossil | sed -n 's/^# //p' >>/srv/fscons
.EE
.LP
A better strategy is to vet the output,
filter out any suggestions you're not comfortable with,
and then use the
.I sed
command to prepare the script.
.SH SOURCE
.B \*9/src/cmd/fossil
.SH SEE ALSO
.MR yesterday (1) ,
.MR fs (3) ,
.MR fs (4) ,
.MR srv (4) ,
.MR fossilcons (8) ,
.MR loadfossil (8) ,
.MR venti (8)
.SH BUGS
It is possible that the disk format (but not the Venti format)
will change in the future, to make the disk a full cache
rather than just a write buffer.
Changing to the new format will require reformatting
the disk as in the example above,
but note that this will preserve most of the file system
(all but
.BR /snapshot )
with little effort.
.PP
The
.B -m
option currently assumes a block size of 8K bytes,
and a single file system per
.I fossil
instance.