1
0

fossil 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. .TH FOSSIL 4
  2. .SH NAME
  3. fossil, flchk, flfmt \- 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-percent
  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. .TF "-c\fI cmd
  214. .PD
  215. .TP
  216. .B -D
  217. Toggle the debugging flag, which is initially off.
  218. When the flag is set, information about authentication
  219. and all protocol messages are written to standard error.
  220. .TP
  221. .B -t
  222. Start a file server console on
  223. .BR /dev/cons .
  224. If this option is given,
  225. .I fossil
  226. does not fork itself into the background.
  227. .TP
  228. .BI -c " cmd
  229. Execute the console command
  230. .IR cmd .
  231. This option may be repeated to give multiple
  232. commands.
  233. Typically the only commands given on the
  234. command line are
  235. .RB `` ".\fI file" ,''
  236. which executes a file containing commands,
  237. and
  238. .RB `` "srv -p" \fIcons \fR,''
  239. which starts a file server console on
  240. .BI /srv/ cons \fR.
  241. See
  242. .IR fossilcons (8)
  243. for more information.
  244. .TP
  245. .BI -f " file
  246. Read and execute console commands stored in the Fossil disk
  247. .IR file .
  248. .I Conf
  249. .RI ( q.v. )
  250. reads and writes the command set stored in the disk.
  251. .TP
  252. .B -m
  253. Allocate
  254. .I free-memory-percent
  255. percent of the available free RAM for buffers.
  256. This overrides all other memory sizing parameters,
  257. notably the
  258. .B -c
  259. option to
  260. .BR open .
  261. .PD
  262. .PP
  263. .I Flchk
  264. checks the fossil file system stored in
  265. .I file
  266. for inconsistencies.
  267. .I Flchk
  268. is deprecated in favor of the console
  269. .B check
  270. command (see
  271. .IR fossilcons (8)).
  272. .I Flchk
  273. prints
  274. .I fossil
  275. console commands that may be
  276. executed to take care of
  277. bad pointers
  278. .RB ( clrp ),
  279. bad entries
  280. .RB ( clre ),
  281. bad directory entries
  282. .RB ( clri ),
  283. unreachable blocks
  284. .RB ( bfree ).
  285. Console commands are interspersed with
  286. more detailed commentary on the file system.
  287. The commands are distinguished by being prefixed with
  288. sharp signs.
  289. Note that all proposed fixes are rather drastic: offending
  290. pieces of file system are simply chopped off.
  291. .PP
  292. .I Flchk
  293. does
  294. .I not
  295. modify the file system, so it is safe to
  296. run concurrently with
  297. .IR fossil ,
  298. though in this case
  299. the list of unreachable
  300. blocks and any inconsistencies involving the active file system
  301. should be taken with a grain of salt.
  302. .PP
  303. The options are:
  304. .TF "-h\fI host
  305. .PD
  306. .TP
  307. .B -f
  308. Fast mode.
  309. By default,
  310. .I flchk
  311. checks the entire file system image for consistency,
  312. which includes all the archives to Venti
  313. and can take a very long time.
  314. In fast mode,
  315. .I flchk
  316. avoids walking in Venti blocks
  317. whenever possible.
  318. .TP
  319. .BI -c " ncache
  320. Keep a cache of
  321. .I ncache
  322. (by default, 1000)
  323. file system blocks in memory during the check.
  324. .TP
  325. .BI -h " host
  326. Use
  327. .I host
  328. as the Venti server.
  329. .PD
  330. .PP
  331. .I Flfmt
  332. prepares
  333. .I file
  334. as a new fossil file system.
  335. The file system is initialized with three empty directories
  336. .BR active ,
  337. .BR archive ,
  338. and
  339. .BR snapshot ,
  340. as described above.
  341. The options are:
  342. .TF "-b\fI blocksize
  343. .PD
  344. .TP
  345. .B -y
  346. Yes mode.
  347. By default,
  348. .I flfmt
  349. will prompt for confirmation before formatting
  350. a file that already contains a fossil file system,
  351. and before formatting a file that is not served
  352. directly by a kernel device.
  353. If the
  354. .B -y
  355. flag is given, no such checks are made.
  356. .TP
  357. .BI -b " blocksize
  358. Set the file system block size (by default, 8192).
  359. .TP
  360. .BI -h " host
  361. Use
  362. .I host
  363. as the Venti server.
  364. .TP
  365. .BI -l " label
  366. Set the textual label on the file system to
  367. .IR label .
  368. The label is only a comment.
  369. .TP
  370. .BI -v " score
  371. Initialize the file system using the vac file
  372. system stored on Venti at
  373. .IR score .
  374. The score should have been generated by
  375. .I fossil
  376. rather than by
  377. .IR vac (1),
  378. so that the appropriate snapshot metadata is present.
  379. .PD
  380. .PP
  381. .I Conf
  382. reads or writes the configuration branded on the Fossil disk
  383. .IR file .
  384. By default, it reads the configuration from the disk and prints it to
  385. standard output.
  386. If the
  387. .B -w
  388. flag is given,
  389. .I conf
  390. reads a new configuration from
  391. .I config
  392. (or else from standard input)
  393. and writes it to the disk.
  394. Inside the configuration file, the argument
  395. .L *
  396. may be used to stand in for the name of the disk holding the configuration.
  397. The Plan 9 kernel boot process runs
  398. .RB `` fossil
  399. .B -f
  400. .IR disk ''
  401. to start a Fossil file server.
  402. The disk is just a convenient place to store configuration
  403. information.
  404. .PP
  405. .I Last
  406. prints the vac score that resulted after the most recent archival snapshot
  407. of the fossil in
  408. .I file.
  409. .SH EXAMPLES
  410. .PP
  411. Place the root of the archive file system on
  412. .B /n/dump
  413. and show the modified times of the MIPS C compiler
  414. over all dumps in December 2002:
  415. .IP
  416. .EX
  417. 9fs dump
  418. ls -l /n/dump/2002/12*/mips/bin/vc
  419. .EE
  420. .PP
  421. To get only one line of output for each version of the compiler:
  422. .IP
  423. .EX
  424. ls -lp /n/dump/2002/12*/mips/bin/vc | uniq
  425. .EE
  426. .ne 14
  427. .PP
  428. Initialize a new file system, start the server with permission
  429. checking turned off, create a users file, and mount the server:
  430. .IP
  431. .EX
  432. fossil/flfmt /dev/sdC0/fossil
  433. fossil/conf -w /dev/sdC0/fossil <<EOF
  434. fsys main config
  435. fsys main open -AWP
  436. fsys main
  437. create /active/adm adm sys d775
  438. create /active/adm/users adm sys 664
  439. users -w
  440. srv -p fscons
  441. srv fossil
  442. EOF
  443. fossil/fossil -f /dev/sdC0/fossil
  444. mount /srv/fossil /n/fossil
  445. .EE
  446. .LP
  447. See the discussion of the
  448. .B users
  449. and
  450. .B uname
  451. commands in
  452. .IR fossilcons (8)
  453. for more about the user table.
  454. .ne 3
  455. .PP
  456. Perhaps because the disk has been corrupted or replaced,
  457. format a new file system using the last archive score printed
  458. on the console:
  459. .IP
  460. .EX
  461. fossil/flfmt -v b9b3...5559 /dev/sdC0/fossil
  462. .EE
  463. .LP
  464. Note that while
  465. .B /snapshot
  466. will be lost,
  467. .B /active
  468. and
  469. .B /archive
  470. will be restored to their contents at the time of the
  471. last archival snapshot.
  472. .ne 3
  473. .PP
  474. Blindly accept the changes prescribed by
  475. .I flchk
  476. (not recommended):
  477. .IP
  478. .EX
  479. fossil/flchk /dev/sdC0/fossil | sed -n 's/^# //p' >>/srv/fscons
  480. .EE
  481. .LP
  482. A better strategy is to vet the output,
  483. filter out any suggestions you're not comfortable with,
  484. and then use the
  485. .I sed
  486. command to prepare the script.
  487. .SH SOURCE
  488. .B /sys/src/cmd/fossil
  489. .SH SEE ALSO
  490. .IR yesterday (1),
  491. .IR fs (3),
  492. .IR fs (4),
  493. .IR srv (4),
  494. .IR fossilcons (8),
  495. .IR loadfossil (8),
  496. .IR venti (8)
  497. .SH BUGS
  498. It is possible that the disk format (but not the Venti format)
  499. will change in the future, to make the disk a full cache
  500. rather than just a write buffer.
  501. Changing to the new format will require reformatting
  502. the disk as in the example above,
  503. but note that this will preserve most of the file system
  504. (all but
  505. .BR /snapshot )
  506. with little effort.
  507. .PP
  508. The
  509. .B -m
  510. option currently assumes a block size of 8K bytes,
  511. and a single file system per
  512. .I fossil
  513. instance.