venti-fmt 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. .TH VENTI-FMT 8
  2. .SH NAME
  3. buildindex,
  4. checkarenas,
  5. checkindex,
  6. conf,
  7. fmtarenas,
  8. fmtbloom,
  9. fmtindex,
  10. fmtisect \- prepare and maintain a venti server
  11. .SH SYNOPSIS
  12. .PP
  13. .B venti/fmtarenas
  14. [
  15. .B -Z
  16. ]
  17. [
  18. .B -a
  19. .I arenasize
  20. ]
  21. [
  22. .B -b
  23. .I blocksize
  24. ]
  25. .I name
  26. .I file
  27. .PP
  28. .B venti/fmtisect
  29. [
  30. .B -1Z
  31. ]
  32. [
  33. .B -b
  34. .I blocksize
  35. ]
  36. .I name
  37. .I file
  38. .PP
  39. .B venti/fmtbloom
  40. [
  41. .B -n
  42. .I nblocks
  43. |
  44. .B -N
  45. .I nhash
  46. ]
  47. [
  48. .B -s
  49. .I size
  50. ]
  51. .I file
  52. .PP
  53. .B venti/fmtindex
  54. [
  55. .B -a
  56. ]
  57. .I venti.conf
  58. .PP
  59. .B venti/conf
  60. [
  61. .B -w
  62. ]
  63. .I partition
  64. [
  65. .I configfile
  66. ]
  67. .if t .sp 0.5
  68. .PP
  69. .B venti/buildindex
  70. [
  71. .B -bd
  72. ] [
  73. .B -i
  74. .I isect
  75. ] ... [
  76. .B -M
  77. .I imemsize
  78. ]
  79. .I venti.conf
  80. .PP
  81. .B venti/checkindex
  82. [
  83. .B -f
  84. ]
  85. [
  86. .B -B
  87. .I blockcachesize
  88. ]
  89. .I venti.conf
  90. .I tmp
  91. .PP
  92. .B venti/checkarenas
  93. [
  94. .B -afv
  95. ]
  96. .I file
  97. .SH DESCRIPTION
  98. These commands aid in the setup, maintenance, and debugging of
  99. venti servers.
  100. See
  101. .IR venti (6)
  102. for an overview of the venti system and
  103. .IR venti (8)
  104. for an overview of the data structures used by the venti server.
  105. .PP
  106. Note that the units for the various sizes in the following
  107. commands can be specified by appending
  108. .LR k ,
  109. .LR m ,
  110. or
  111. .LR g
  112. to indicate kilobytes, megabytes, or gigabytes respectively.
  113. .SS Formatting
  114. To prepare a server for its initial use, the arena partitions and
  115. the index sections must be formatted individually, with
  116. .I fmtarenas
  117. and
  118. .IR fmtisect .
  119. Then the
  120. collection of index sections must be combined into a venti
  121. index with
  122. .IR fmtindex .
  123. .PP
  124. .I Fmtarenas
  125. formats the given
  126. .IR file ,
  127. typically a disk partition, into an arena partition.
  128. The arenas in the partition are given names of the form
  129. .IR name%d ,
  130. where
  131. .I %d
  132. is replaced with a sequential number starting at 0.
  133. .PP
  134. Options to
  135. .I fmtarenas
  136. are:
  137. .TP
  138. .BI -a " arenasize
  139. The arenas are of
  140. .I arenasize
  141. bytes. The default is
  142. .BR 512M ,
  143. which was selected to provide a balance
  144. between the number of arenas and the ability to copy an arena to external
  145. media such as recordable CDs and tapes.
  146. .TP
  147. .BI -b " blocksize
  148. The size, in bytes, for read and write operations to the file.
  149. The size is recorded in the file, and is used by applications that access the arenas.
  150. The default is
  151. .BR 8k .
  152. .TP
  153. .B -4
  154. Create a `version 4' arena partition for backwards compatibility with old servers.
  155. The default is version 5, used by the current venti server.
  156. .TP
  157. .B -Z
  158. Do not zero the data sections of the arenas.
  159. Using this option reduces the formatting time
  160. but should only be used when it is known that the file was already zeroed.
  161. (Version 4 only; version 5 sections are not and do not need to be zeroed.)
  162. .PD
  163. .PP
  164. .I Fmtisect
  165. formats the given
  166. .IR file ,
  167. typically a disk partition, as a venti index section with the specified
  168. .IR name .
  169. Each of the index sections in a venti configuration must have a unique name.
  170. .PP
  171. Options to
  172. .I fmtisect
  173. are:
  174. .TP
  175. .BI -b " bucketsize
  176. The size of an index bucket, in bytes.
  177. All the index sections within a index must have the same bucket size.
  178. The default is
  179. .BR 8k .
  180. .TP
  181. .B -1
  182. Create a `version 1' index section for backwards compatibility with old servers.
  183. The default is version 2, used by the current venti server.
  184. .TP
  185. .B -Z
  186. Do not zero the index.
  187. Using this option reduces the formatting time
  188. but should only be used when it is known that the file was already zeroed.
  189. (Version 1 only; version 2 sections are not and do not need to be zeroed.)
  190. .PD
  191. .PP
  192. .I Fmtbloom
  193. formats the given
  194. .I file
  195. as a Bloom filter
  196. (see
  197. .IR venti (6)).
  198. The options are:
  199. .TF "\fL-s\fI size"
  200. .PD
  201. .TP
  202. .BI -n " nblock \fR| " -N " nhash
  203. The number of blocks expected to be indexed by the filter
  204. or the number of hash functions to use.
  205. If the
  206. .B -n
  207. option
  208. is given, it is used, along with the total size of the filter,
  209. to compute an appropriate
  210. .IR nhash .
  211. .TP
  212. .BI -s " size
  213. The size of the Bloom filter. The default is the total size of the file.
  214. In either case,
  215. .I size
  216. is rounded down to a power of two.
  217. .PD
  218. .PP
  219. The
  220. .I file
  221. argument in the commands above can be of the form
  222. .IB file : lo - hi
  223. to specify a range of the file.
  224. .I Lo
  225. and
  226. .I hi
  227. are specified in bytes but can have the usual
  228. .BI k ,
  229. .BI m ,
  230. or
  231. .B g
  232. suffixes.
  233. Either
  234. .I lo
  235. or
  236. .I hi
  237. may be omitted.
  238. This notation eliminates the need to
  239. partition raw disks on non-Plan 9 systems.
  240. .PP
  241. .I Fmtindex
  242. reads the configuration file
  243. .I venti.conf
  244. and initializes the index sections to form a usable index structure.
  245. The arena files and index sections must have previously been formatted
  246. using
  247. .I fmtarenas
  248. and
  249. .I fmtisect
  250. respectively.
  251. .PP
  252. The function of a venti index is to map a SHA1 fingerprint to a location
  253. in the data section of one of the arenas. The index is composed of
  254. blocks, each of which contains the mapping for a fixed range of possible
  255. fingerprint values.
  256. .I Fmtindex
  257. determines the mapping between SHA1 values and the blocks
  258. of the collection of index sections. Once this mapping has been determined,
  259. it cannot be changed without rebuilding the index.
  260. The basic assumption in the current implementation is that the index
  261. structure is sufficiently empty that individual blocks of the index will rarely
  262. overflow. The total size of the index should be about 2% to 10% of
  263. the total size of the arenas, but the exact percentage depends both on the
  264. index block size and the compressed size of blocks stored.
  265. See the discussion in
  266. .IR venti (8)
  267. for more.
  268. .PP
  269. .I Fmtindex
  270. also computes a mapping between a linear address space and
  271. the data section of the collection of arenas. The
  272. .B -a
  273. option can be used to add additional arenas to an index.
  274. To use this feature,
  275. add the new arenas to
  276. .I venti.conf
  277. after the existing arenas and then run
  278. .I fmtindex
  279. .BR -a .
  280. .PP
  281. A copy of the above mappings is stored in the header for each of the index sections.
  282. These copies enable
  283. .I buildindex
  284. to restore a single index section without rebuilding the entire index.
  285. .PP
  286. To make it easier to bootstrap servers, the configuration
  287. file can be stored in otherwise empty space
  288. at the beginning of any venti partitions using
  289. .IR conf .
  290. A partition so branded with a configuration file can
  291. be used in place of a configuration file when invoking any
  292. of the venti commands.
  293. By default,
  294. .I conf
  295. prints the configuration stored in
  296. .IR partition .
  297. When invoked with the
  298. .B -w
  299. flag,
  300. .I conf
  301. reads a configuration file from
  302. .I configfile
  303. (or else standard input)
  304. and stores it in
  305. .IR partition .
  306. .SS Checking and Rebuilding
  307. .PP
  308. .I Buildindex
  309. populates the index for the Venti system described in
  310. .IR venti.conf .
  311. The index must have previously been formatted using
  312. .IR fmtindex .
  313. This command is typically used to build a new index for a Venti
  314. system when the old index becomes too small, or to rebuild
  315. an index after media failure.
  316. Small errors in an index can usually be fixed with
  317. .IR checkindex ,
  318. but
  319. .I checkindex
  320. requires a large temporary workspace and
  321. .I buildindex
  322. does not.
  323. .PP
  324. Options to
  325. .I buildindex
  326. are:
  327. .TF "\fL-M\fI imemsize"
  328. .PD
  329. .TP
  330. .B -b
  331. Reinitialise the Bloom filter, if any.
  332. .TP
  333. .B -d
  334. `Dumb' mode; run all three passes.
  335. .TP
  336. .BI -i " isect
  337. Only rebuild index section
  338. .IR isect ;
  339. may be repeated to rebuild multiple sections.
  340. The name
  341. .L none
  342. is special and just reads the arenas.
  343. .TP
  344. .BI -M " imemsize
  345. The amount of memory, in bytes, to use for caching raw disk accesses while running
  346. .IR buildindex .
  347. (This is not a property of the created index.)
  348. The usual suffices apply.
  349. The default is 256M.
  350. .PD
  351. .PP
  352. .I Checkindex
  353. examines the Venti index described in
  354. .IR venti.conf .
  355. The program detects various error conditions including:
  356. blocks that are not indexed, index entries for blocks that do not exist,
  357. and duplicate index entries.
  358. If requested, an attempt can be made to fix errors that are found.
  359. .PP
  360. The
  361. .I tmp
  362. file, usually a disk partition, must be large enough to store a copy of the index.
  363. This temporary space is used to perform a merge sort of index entries
  364. generated by reading the arenas.
  365. .PP
  366. Options to
  367. .I checkindex
  368. are:
  369. .TP
  370. .BI -B " blockcachesize
  371. The amount of memory, in bytes, to use for caching raw disk accesses while running
  372. .IR checkindex .
  373. The default is 8k.
  374. .TP
  375. .B -f
  376. Attempt to fix any errors that are found.
  377. .PD
  378. .PP
  379. .I Checkarenas
  380. examines the Venti arenas contained in the given
  381. .IR file .
  382. The program detects various error conditions, and optionally attempts
  383. to fix any errors that are found.
  384. .PP
  385. Options to
  386. .I checkarenas
  387. are:
  388. .TP
  389. .B -a
  390. For each arena, scan the entire data section.
  391. If this option is omitted, only the end section of
  392. the arena is examined.
  393. .TP
  394. .B -f
  395. Attempt to fix any errors that are found.
  396. .TP
  397. .B -v
  398. Increase the verbosity of output.
  399. .PD
  400. .SH SOURCE
  401. .B /sys/src/cmd/venti/srv
  402. .SH SEE ALSO
  403. .IR venti (6),
  404. .IR venti (8)
  405. .SH BUGS
  406. .I Buildindex
  407. should allow an individual index section to be rebuilt.