fossil 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. .TH FOSSIL 4
  2. .SH NAME
  3. fossil \- archival file server
  4. .SH SYNOPSIS
  5. .B fossil/fossil
  6. [
  7. .B -Dt
  8. ]
  9. [
  10. .B -c
  11. .I cmd
  12. ]...
  13. [
  14. .B -f
  15. .I file
  16. ]
  17. [
  18. .B -m
  19. .I free-memory%
  20. ]
  21. .PP
  22. .B fossil/flchk
  23. [
  24. .B -f
  25. ]
  26. [
  27. .B -c
  28. .I ncache
  29. ]
  30. [
  31. .B -h
  32. .I host
  33. ]
  34. .I file
  35. .PP
  36. .B fossil/flfmt
  37. [
  38. .B -y
  39. ]
  40. [
  41. .B -b
  42. .I blocksize
  43. ]
  44. [
  45. .B -h
  46. .I host
  47. ]
  48. [
  49. .B -l
  50. .I label
  51. ]
  52. [
  53. .B -v
  54. .I score
  55. ]
  56. .I file
  57. .PP
  58. .B fossil/conf
  59. [
  60. .B -w
  61. ]
  62. .I file
  63. [
  64. .I config
  65. ]
  66. .PP
  67. .B fossil/last
  68. .I file
  69. .SH DESCRIPTION
  70. .I Fossil
  71. is the main file system for Plan 9.
  72. Unlike the Plan 9 file servers of old,
  73. .I fossil
  74. is a collection of user-space programs that run on a standard Plan 9 kernel.
  75. The name of the main fossil file server at Murray Hill is
  76. .BR pie .
  77. The Plan 9 distribution file server,
  78. .BR sources ,
  79. is also a fossil server.
  80. .PP
  81. .I Fossil
  82. is structured as a magnetic disk write buffer
  83. optionally backed by a Venti server for archival storage.
  84. It serves the Plan 9 protocol via TCP.
  85. A
  86. .I fossil
  87. file server conventionally presents
  88. three trees in the root directory of each file system:
  89. .BR active ,
  90. .BR archive ,
  91. and
  92. .BR snapshot .
  93. .B /active
  94. is the root of a conventional file system
  95. whose blocks are stored in a disk file.
  96. In a typical configuration, the file server periodically
  97. marks the entire file system copy-on-write, effectively
  98. taking a snapshot of the file system at that moment.
  99. This snapshot is made available in a name
  100. created from the date and time of the snapshot:
  101. .BI /snapshot/ yyyy / mmdd / hhmm \fR,
  102. where
  103. .I yyyy
  104. is the full year,
  105. .I mm
  106. is the month number,
  107. .I dd
  108. is the day number,
  109. .I hh
  110. is the hour,
  111. and
  112. .I mm
  113. is the minute.
  114. The snapshots in
  115. .B /snapshot
  116. are ephemeral: eventually they are deleted
  117. to reclaim the disk space they occupy.
  118. Long-lasting snapshots stored on a Venti server
  119. are kept in
  120. .B /archive
  121. and also named from the date (though not the time) of the snapshot:
  122. .BI /archive/ yyyy / mmdds \fR,
  123. where
  124. .IR yyyy ,
  125. .IR mm ,
  126. and
  127. .I dd
  128. are year, month, and day as before,
  129. and
  130. .I s
  131. is a sequence number if more than one
  132. archival snapshot is done in a day.
  133. For the first snapshot,
  134. .I s
  135. is null.
  136. For the subsequent snapshots,
  137. .I s
  138. is
  139. .BR .1 ,
  140. .BR .2 ,
  141. .BR .3 ,
  142. etc.
  143. The root of the main file system that is frozen
  144. for the first archival snapshot of December 15, 2002
  145. will be named
  146. .BR /archive/2002/1215/ .
  147. .PP
  148. The attach name used in
  149. .I mount
  150. (see
  151. .IR bind (1),
  152. .IR bind (2)
  153. and
  154. .IR attach (5))
  155. selects a file system to be served
  156. and optionally a subtree,
  157. in the format
  158. .IB fs \fR[\fB/ dir \fR].
  159. An empty attach name selects
  160. .BR main/active .
  161. .PP
  162. .I Fossil
  163. normally requires all users except
  164. .L none
  165. to provide authentication tickets on each
  166. .IR attach (5).
  167. To keep just anyone from connecting,
  168. .L none
  169. is only allowed to attach after another user
  170. has successfully attached on the same
  171. connection.
  172. The other user effectively acts as a chaperone
  173. for
  174. .LR none .
  175. Authentication can be disabled using the
  176. .B -A
  177. flag to
  178. .B open
  179. or
  180. .B srv
  181. (see
  182. .IR fossilcons (8)).
  183. .PP
  184. The groups called
  185. .B noworld
  186. and
  187. .B write
  188. are special on the file server.
  189. Any user belonging to
  190. .B noworld
  191. has attenuated access privileges.
  192. Specifically, when checking such a user's access to files,
  193. the file's permission bits are first ANDed
  194. with 0770 for normal files and 0771 for directories.
  195. The effect is to deny world access permissions to
  196. .B noworld
  197. users, except when walking into directories.
  198. If the
  199. .B write
  200. group exists, then the file system appears read-only
  201. to users not in the group.
  202. This is used to make the Plan 9 distribution file server
  203. .RI ( sources.cs.bell-labs.com )
  204. readable by the world but writable only to the developers.
  205. .PP
  206. .I Fossil
  207. starts a new instance of the fossil file server.
  208. It is configured mainly through console commands,
  209. documented in
  210. .IR fossilcons (8).
  211. .PP
  212. The options are:
  213. .TP
  214. .B -D
  215. Toggle the debugging flag, which is initially off.
  216. When the flag is set, information about authentication
  217. and all protocol messages are written to standard error.
  218. .TP
  219. .B -t
  220. Start a file server console on
  221. .BR /dev/cons .
  222. If this option is given,
  223. .I fossil
  224. does not fork itself into the background.
  225. .TP
  226. .BI -c " cmd
  227. Execute the console command
  228. .IR cmd .
  229. This option may be repeated to give multiple
  230. commands.
  231. Typically the only commands given on the
  232. command line are
  233. .RB `` . \fIfile \fR,''
  234. which executes a file containing commands,
  235. and
  236. .RB `` "srv -p" \fIcons \fR,''
  237. which starts a file server console on
  238. .BI /srv/ cons \fR.
  239. See
  240. .IR fossilcons (8)
  241. for more information.
  242. .TP
  243. .BI -f " file
  244. Read and execute console commands stored in the Fossil disk
  245. .IR file .
  246. .I Conf
  247. .RI ( q.v. )
  248. reads and writes the command set stored in the disk.
  249. .TP
  250. .B -m
  251. Allocate
  252. .I free-memory%
  253. percent of the available free RAM for buffers.
  254. This overrides all other memory sizing parameters,
  255. notably the
  256. .B -c
  257. option to
  258. .BR open .
  259. .PD
  260. .PP
  261. .I Flchk
  262. checks the fossil file system stored in
  263. .I file
  264. for inconsistencies.
  265. .I Flchk
  266. is deprecated in favor of the console
  267. .B check
  268. command (see
  269. .IR fossilcons (8)).
  270. .I Flchk
  271. prints
  272. .I fossil
  273. console commands that may be
  274. executed to take care of
  275. bad pointers
  276. .RB ( clrp ),
  277. bad entries
  278. .RB ( clre ),
  279. bad directory entries
  280. .RB ( clri ),
  281. unreachable blocks
  282. .RB ( bfree ).
  283. Console commands are interspersed with
  284. more detailed commentary on the file system.
  285. The commands are distinguished by being prefixed with
  286. sharp signs.
  287. Note that all proposed fixes are rather drastic: offending
  288. pieces of file system are simply chopped off.
  289. .PP
  290. .I Flchk
  291. does
  292. .I not
  293. modify the file system, so it is safe to
  294. run concurrently with
  295. .IR fossil ,
  296. though in this case
  297. the list of unreachable
  298. blocks and any inconsistencies involving the active file system
  299. should be taken with a grain of salt.
  300. .PP
  301. The options are:
  302. .TP
  303. .B -f
  304. Fast mode.
  305. By default,
  306. .I flchk
  307. checks the entire file system image for consistency,
  308. which includes all the archives to Venti
  309. and can take a very long time.
  310. In fast mode,
  311. .I flchk
  312. avoids walking in Venti blocks
  313. whenever possible.
  314. .TP
  315. .BI -c " ncache
  316. Keep a cache of
  317. .I ncache
  318. (by default, 1000)
  319. file system blocks in memory during the check.
  320. .TP
  321. .BI -h " host
  322. Use
  323. .I host
  324. as the Venti server.
  325. .PD
  326. .PP
  327. .I Flfmt
  328. prepares
  329. .I file
  330. as a new fossil file system.
  331. The file system is initialized with three empty directories
  332. .BR active ,
  333. .BR archive ,
  334. and
  335. .BR snapshot ,
  336. as described above.
  337. The options are:
  338. .TP
  339. .B -y
  340. Yes mode.
  341. By default,
  342. .I flfmt
  343. will prompt for confirmation before formatting
  344. a file that already contains a fossil file system,
  345. and before formatting a file that is not served
  346. directly by a kernel device.
  347. If the
  348. .B -y
  349. flag is given, no such checks are made.
  350. .TP
  351. .BI -b " blocksize
  352. Set the file system block size (by default, 8192).
  353. .TP
  354. .BI -h " host
  355. Use
  356. .I host
  357. as the Venti server.
  358. .TP
  359. .BI -l " label
  360. Set the textual label on the file system to
  361. .IR label .
  362. The label is only a comment.
  363. .TP
  364. .BI -v " score
  365. Initialize the file system using the vac file
  366. system stored on Venti at
  367. .IR score .
  368. The score should have been generated by
  369. .I fossil
  370. rather than by
  371. .IR vac (1),
  372. so that the appropriate snapshot metadata is present.
  373. .PD
  374. .PP
  375. .I Conf
  376. reads or writes the configuration branded on the Fossil disk
  377. .IR file .
  378. By default, it reads the configuration from the disk and prints it to
  379. standard output.
  380. If the
  381. .B -w
  382. flag is given,
  383. .I conf
  384. reads a new configuration from
  385. .I config
  386. (or else from standard input)
  387. and writes it to the disk.
  388. Inside the configuration file, the argument
  389. .L *
  390. may be used to stand in for the name of the disk holding the configuration.
  391. The Plan 9 kernel boot process runs
  392. .RB `` fossil
  393. .B -f
  394. .IR disk ''
  395. to start a Fossil file server.
  396. The disk is just a convenient place to store configuration
  397. information.
  398. .PP
  399. .I Last
  400. prints the vac score that resulted after the most recent archival snapshot
  401. of the fossil in
  402. .I file.
  403. .SH EXAMPLES
  404. .PP
  405. Place the root of the archive file system on
  406. .B /n/dump
  407. and show the modified times of the MIPS C compiler
  408. over all dumps in December 2002:
  409. .IP
  410. .EX
  411. 9fs dump
  412. ls -l /n/dump/2002/12*/mips/bin/vc
  413. .EE
  414. .PP
  415. To get only one line of output for each version of the compiler:
  416. .IP
  417. .EX
  418. ls -lp /n/dump/2002/12*/mips/bin/vc | uniq
  419. .EE
  420. .ne 14
  421. .PP
  422. Initialize a new file system, start the server with permission
  423. checking turned off, create a users file, and mount the server:
  424. .IP
  425. .EX
  426. fossil/flfmt /dev/sdC0/fossil
  427. fossil/conf -w /dev/sdC0/fossil <<EOF
  428. fsys main config /dev/sdC0/fossil
  429. fsys main open -AWP
  430. fsys main
  431. create /active/adm adm sys d775
  432. create /active/adm/users adm sys 664
  433. users -w
  434. srv -p fscons
  435. srv fossil
  436. EOF
  437. fossil/fossil -f /dev/sdC0/fossil
  438. mount /srv/fossil /n/fossil
  439. .EE
  440. .LP
  441. See the discussion of the
  442. .B users
  443. and
  444. .B uname
  445. commands in
  446. .IR fossilcons (8)
  447. for more about the user table.
  448. .ne 3
  449. .PP
  450. Perhaps because the disk has been corrupted or replaced,
  451. format a new file system using the last archive score printed
  452. on the console:
  453. .IP
  454. .EX
  455. fossil/flfmt -v b9b3...5559 /dev/sdC0/fossil
  456. .EE
  457. .LP
  458. Note that while
  459. .B /snapshot
  460. will be lost,
  461. .B /active
  462. and
  463. .B /archive
  464. will be restored to their contents at the time of the
  465. last archival snapshot.
  466. .ne 3
  467. .PP
  468. Blindly accept the changes prescribed by
  469. .I flchk
  470. (not recommended):
  471. .IP
  472. .EX
  473. fossil/flchk /dev/sdC0/fossil | sed -n 's/^# //p' >>/srv/fscons
  474. .EE
  475. .LP
  476. A better strategy is to vet the output,
  477. filter out any suggestions you're not comfortable with,
  478. and then use the
  479. .I sed
  480. command to prepare the script.
  481. .SH SOURCE
  482. .B /sys/src/cmd/fossil
  483. .SH SEE ALSO
  484. .IR yesterday (1),
  485. .IR fs (3),
  486. .IR fs (4),
  487. .IR srv (4),
  488. .IR fossilcons (8),
  489. .IR venti (8)
  490. .SH BUGS
  491. It is possible that the disk format (but not the Venti format)
  492. will change in the future, to make the disk a full cache
  493. rather than just a write buffer.
  494. Changing to the new format will require reformatting
  495. the disk as in the example above,
  496. but note that this will preserve most of the file system
  497. (all but
  498. .BR /snapshot )
  499. with little effort.
  500. .PP
  501. The
  502. .B -m
  503. option currently assumes a block size of 8K bytes,
  504. and a single file system per
  505. .I fossil
  506. instance.