fossil 9.3 KB

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