ventiaux 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. .TH VENTIAUX 8
  2. .SH NAME
  3. buildindex,
  4. checkarenas,
  5. checkindex,
  6. copy,
  7. fmtarenas,
  8. fmtindex,
  9. fmtisect,
  10. rdarena,
  11. rdarenablocks,
  12. read,
  13. wrarenablocks,
  14. write \- Venti maintenance and debugging commands
  15. .SH SYNOPSIS
  16. .B venti/buildindex
  17. [
  18. .B -B
  19. .I blockcachesize
  20. ]
  21. [
  22. .B -Z
  23. ]
  24. .I venti.config
  25. .I tmp
  26. .PP
  27. .B venti/checkarenas
  28. [
  29. .B -afv
  30. ]
  31. .I file
  32. .PP
  33. .B venti/checkindex
  34. [
  35. .B -f
  36. ]
  37. [
  38. .B -B
  39. .I blockcachesize
  40. ]
  41. .I venti.config
  42. .I tmp
  43. .PP
  44. .B venti/copy
  45. [
  46. .B -f
  47. ]
  48. .I src
  49. .I dst
  50. .I score
  51. [
  52. .I type
  53. ]
  54. .PP
  55. .B venti/fmtarenas
  56. [
  57. .B -Z
  58. ]
  59. [
  60. .B -a
  61. .I arenasize
  62. ]
  63. [
  64. .B -b
  65. .I blocksize
  66. ]
  67. .I name
  68. .I file
  69. .PP
  70. .B venti/fmtindex
  71. [
  72. .B -a
  73. ]
  74. .I venti.config
  75. .PP
  76. .B venti/fmtisect
  77. [
  78. .B -Z
  79. ]
  80. [
  81. .B -b
  82. .I blocksize
  83. ]
  84. .I name
  85. .I file
  86. .PP
  87. .B venti/rdarena
  88. [
  89. .B -v
  90. ]
  91. .I arenapart
  92. .I arenaname
  93. .PP
  94. .B venti/read
  95. [
  96. .B -h
  97. .I host
  98. ]
  99. .I score
  100. [
  101. .I type
  102. ]
  103. .PP
  104. .B venti/wrarena
  105. [
  106. .B -o
  107. .I fileoffset
  108. ]
  109. [
  110. .B -h
  111. .I host
  112. ]
  113. .I arenafile
  114. [
  115. .I clumpoffset
  116. ]
  117. .PP
  118. .B venti/write
  119. [
  120. .B -h
  121. .I host
  122. ]
  123. [
  124. .B -t
  125. .I type
  126. ]
  127. [
  128. .B -z
  129. ]
  130. .SH DESCRIPTION
  131. These commands aid in the setup, maintenance, and debugging of
  132. Venti servers.
  133. See
  134. .IR venti (8)
  135. and
  136. .IR venti.conf (6)
  137. for an overview of the data structures stored by Venti.
  138. .PP
  139. Note that the units for the various sizes in the following
  140. commands can be specified by appending
  141. .LR k ,
  142. .LR m ,
  143. or
  144. .LR g
  145. to indicate kilobytes, megabytes, or gigabytes respectively.
  146. .PP
  147. .I Buildindex
  148. populates the index for the Venti system described in
  149. .IR venti.config .
  150. The index must have previously been formatted using
  151. .IR fmtindex .
  152. This command is typically used to build a new index for a Venti
  153. system when the old index becomes too small, or to rebuild
  154. an index after media failure.
  155. Small errors in an index can usually be fixed with
  156. .IR checkindex .
  157. .PP
  158. The
  159. .I tmp
  160. file, usually a disk partition, must be large enough to store a copy of the index.
  161. This temporary space is used to perform a merge sort of index entries
  162. generated by reading the arenas.
  163. .PP
  164. Options to
  165. .I buildindex
  166. are:
  167. .TP
  168. .BI -B " blockcachesize
  169. The amount of memory, in bytes, to use for caching raw disk accesses while running
  170. .IR buildindex .
  171. (This is not a property of the created index.)
  172. The default is 8k.
  173. .TP
  174. .B -Z
  175. Do not zero the index.
  176. This option should only be used when it is known that the index was already zeroed.
  177. .PD
  178. .PP
  179. .I Checkarenas
  180. examines the Venti arenas contained in the given
  181. .IR file .
  182. The program detects various error conditions, and optionally attempts
  183. to fix any errors that are found.
  184. .PP
  185. Options to
  186. .I checkarenas
  187. are:
  188. .TP
  189. .B -a
  190. For each arena, scan the entire data section.
  191. If this option is omitted, only the end section of
  192. the arena is examined.
  193. .TP
  194. .B -f
  195. Attempt to fix any errors that are found.
  196. .TP
  197. .B -v
  198. Increase the verbosity of output.
  199. .PD
  200. .PP
  201. .I Checkindex
  202. examines the Venti index described in
  203. .IR venti.config .
  204. The program detects various error conditions including:
  205. blocks that are not indexed, index entries for blocks that do not exist,
  206. and duplicate index entries.
  207. If requested, an attempt can be made to fix errors that are found.
  208. .PP
  209. The
  210. .I tmp
  211. file, usually a disk partition, must be large enough to store a copy of the index.
  212. This temporary space is used to perform a merge sort of index entries
  213. generated by reading the arenas.
  214. .PP
  215. Options to
  216. .I checkindex
  217. are:
  218. .TP
  219. .BI -B " blockcachesize
  220. The amount of memory, in bytes, to use for caching raw disk accesses while running
  221. .IR checkindex .
  222. The default is 8k.
  223. .TP
  224. .B -f
  225. Attempt to fix any errors that are found.
  226. .PD
  227. .PP
  228. .I Fmtarenas
  229. formats the given
  230. .IR file ,
  231. typically a disk partition, into a number of
  232. Venti
  233. arenas.
  234. The arenas are given names of the form
  235. .IR name%d ,
  236. where
  237. .I %d
  238. is replaced with a sequential number starting at 0.
  239. .PP
  240. Options to
  241. .I fmtarenas
  242. are:
  243. .TP
  244. .BI -a " arenasize
  245. The arenas are of
  246. .I arenasize
  247. bytes. The default is 512 megabytes, which was selected to provide a balance
  248. between the number of arenas and the ability to copy an arena to external
  249. media such as recordable CDs and tapes.
  250. .TP
  251. .BI -b " blocksize
  252. The size, in bytes, for read and write operations to the file.
  253. The size is recorded in the file, and is used by applications that access the arenas.
  254. The default is 8k.
  255. .TP
  256. .B -Z
  257. Do not zero the data sections of the arenas.
  258. Using this option reduces the formatting time
  259. but should only be used when it is known that the file was already zeroed.
  260. .PD
  261. .I Fmtindex
  262. takes the
  263. .IR venti.conf (6)
  264. file
  265. .I venti.config
  266. and initializes the index sections to form a usable index structure.
  267. The arena files and index sections must have previously been formatted
  268. using
  269. .I fmtarenas
  270. and
  271. .I fmtisect
  272. respectively.
  273. .PP
  274. The function of a Venti index is to map a SHA1 fingerprint to a location
  275. in the data section of one of the arenas. The index is composed of
  276. blocks, each of which contains the mapping for a fixed range of possible
  277. fingerprint values.
  278. .I Fmtindex
  279. determines the mapping between SHA1 values and the blocks
  280. of the collection of index sections. Once this mapping has been determined,
  281. it cannot be changed without rebuilding the index.
  282. The basic assumption in the current implementation is that the index
  283. structure is sufficiently empty that individual blocks of the index will rarely
  284. overflow. The total size of the index should be about 2% to 10% of
  285. the total size of the arenas, but the exact depends both the index block size
  286. and the compressed size of block stored to Venti.
  287. .PP
  288. .I Fmtindex
  289. also computes a mapping between a linear address space and
  290. the data section of the collection of arenas. The
  291. .B -a
  292. option can be used to add additional arenas to an index.
  293. To use this feature,
  294. add the new arenas to
  295. .I venti.config
  296. after the existing arenas and then run
  297. .I fmtindex
  298. .BR -a .
  299. .PP
  300. A copy of the above mappings is stored in the header for each of the index sections.
  301. These copies enable
  302. .I buildindex
  303. to restore a single index section without rebuilding the entire index.
  304. .PP
  305. .I Fmtisect
  306. formats the given
  307. .IR file ,
  308. typically a disk partition, as a Venti index section with the specified
  309. .IR name .
  310. One or more formatted index sections are combined into a Venti
  311. index using
  312. .IR fmtindex .
  313. Each of the index sections within an index must have a unique name.
  314. .PP
  315. Options to
  316. .I fmtisect
  317. are:
  318. .TP
  319. .BI -b " blocksize
  320. The size, in bytes, for read and write operations to the file.
  321. All the index sections within a index must have the same block size.
  322. The default is 8k.
  323. .TP
  324. .B -Z
  325. Do not zero the index.
  326. Using this option reduces the formatting time
  327. but should only be used when it is known that the file was already zeroed.
  328. .PD
  329. .PP
  330. .I Rdarena
  331. extracts the named
  332. .I arena
  333. from the Venti system described by the
  334. .IR venti.conf (6)
  335. file
  336. .I venti.config
  337. and writes this arena to standard output.
  338. This command is typically used to back up an arena to external media.
  339. The
  340. .B -v
  341. option generates more verbose output on standard error.
  342. .PP
  343. .I Wrarena
  344. writes the blocks contained in the arena
  345. .I arenafile
  346. (typically, the output of
  347. .IR rdarena )
  348. to a Venti server.
  349. It is typically used to reinitialize a Venti server from backups of the arenas.
  350. For example,
  351. .IP
  352. .EX
  353. venti/rdarena /dev/sdC0/arenas arena.0 >external.media
  354. venti/wrarena -h venti2 external.media
  355. .EE
  356. .LP
  357. writes the blocks contained in
  358. .B arena.0
  359. to the Venti server
  360. .B venti2
  361. (typically not the one using
  362. .BR /dev/sdC0/arenas ).
  363. .PP
  364. The
  365. .B -o
  366. option specifies that the arena starts at byte
  367. .I fileoffset
  368. (default
  369. .BR 0 )
  370. in
  371. .I arenafile .
  372. This is useful for reading directly from
  373. the Venti arena partition:
  374. .IP
  375. .EX
  376. venti/wrarena -h venti2 -o 335872 /dev/sdC0/arenas
  377. .EE
  378. .LP
  379. (In this example, 335872 is the offset shown in the Venti
  380. server's index list (344064) minus one block (8192).
  381. You will need to substitute your own arena offsets
  382. and block size.)
  383. .PP
  384. Finally, the optional
  385. .I offset
  386. argument specifies that the writing should begin with the
  387. clump starting at
  388. .I offset
  389. within the arena.
  390. .I Wrarena
  391. prints the offset it stopped at (because there were no more data blocks).
  392. This could be used to incrementally back up a Venti server
  393. to another Venti server:
  394. .IP
  395. .EX
  396. last=`{cat last}
  397. venti/wrarena -h venti2 -o 335872 /dev/sdC0/arenas $last >output
  398. awk '/^end offset/ { print $3 }' offset >last
  399. .EE
  400. .LP
  401. Of course, one would need to add wrapper code to keep track
  402. of which arenas have been processed.
  403. See
  404. .B /sys/src/cmd/venti/backup.example
  405. for a version that does this.
  406. .PP
  407. .I Read
  408. and
  409. .I write
  410. read and write blocks from a running Venti server.
  411. They are intended to ease debugging of the server.
  412. The default
  413. .I host
  414. is the environment variable
  415. .BR $venti ,
  416. followed by the network metaname
  417. .BR $venti .
  418. The
  419. .I type
  420. is the decimal type of block to be read or written.
  421. If no
  422. .I type
  423. is specified for
  424. .I read ,
  425. all types are tried, and a command-line is printed to
  426. show the type that eventually worked.
  427. If no
  428. .I type
  429. is specified for
  430. .I write ,
  431. .B VtDataType
  432. (13)
  433. is used.
  434. .I Read
  435. reads the block named by
  436. .I score
  437. (a SHA1 hash)
  438. from the Venti server and writes it to standard output.
  439. .I Write
  440. reads a block from standard input and attempts to write
  441. it to the Venti server.
  442. If successful, it prints the score of the block on the server.
  443. .PP
  444. .I Copy
  445. walks the entire tree of blocks rooted at
  446. .I score ,
  447. copying all the blocks visited during the walk from
  448. the Venti server at network address
  449. .I src
  450. to the Venti server at network address
  451. .I dst .
  452. If
  453. .I type
  454. (a decimal block type for
  455. .IR score )
  456. is omitted, all types will be tried in sequence
  457. until one is found that works.
  458. The
  459. .B -f
  460. flag runs the copy in ``fast'' mode: if a block is already on
  461. .IR dst ,
  462. the walk does not descend below it, on the assumption that all its
  463. children are also already on
  464. .IR dst .
  465. Without this flag, the copy often transfers many times more
  466. data than necessary.
  467. .SH SOURCE
  468. .B /sys/src/cmd/venti
  469. .SH "SEE ALSO"
  470. .IR venti (8),
  471. .IR venti.conf (6)
  472. .SH BUGS
  473. .I Buildindex
  474. should allow an individual index section to be rebuilt.
  475. The merge sort could be performed in the space used to store the
  476. index rather than requiring a temporary file.