venti-fmt 8.4 KB

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