fossil 9.4 KB

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