creepy 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. .TH CREEPY 4
  2. .SH NAME
  3. 9pix, fmt, rip, arch \- creepy file server and WORM archive
  4. .SH SYNOPSIS
  5. .B creepy/9pix
  6. [
  7. .B -DFLAGS
  8. ]
  9. [
  10. .B -ra
  11. ]
  12. [
  13. .B -c
  14. .I n
  15. ]
  16. [
  17. .B -A
  18. .I addr
  19. ]
  20. [
  21. .B -S
  22. .I srv
  23. ]
  24. .I disk
  25. .PP
  26. .B creepy/fmt
  27. [
  28. .B -DFLAGS
  29. ]
  30. [
  31. .B -wy
  32. ]
  33. .I disk
  34. .PP
  35. .B creepy/rip
  36. [
  37. .B -DFLAGS
  38. ]
  39. [
  40. .B -a
  41. ]
  42. [
  43. .B -c
  44. .I n
  45. ]
  46. [
  47. .B -A
  48. .I addr
  49. ]
  50. [
  51. .B -S
  52. .I srv
  53. ]
  54. .I disk
  55. .PP
  56. .B creepy/arch
  57. [
  58. .B -DFLAGS
  59. ]
  60. [
  61. .I dir
  62. ]
  63. .SH DESCRIPTION
  64. .I Creepy
  65. is a prototype file server for Nix. It maintains a mutable file tree with unix semantics,
  66. kept in main memory, served through 9P, see
  67. .IR intro (5),
  68. and through IX.
  69. .PP
  70. .I Creepy/9pix
  71. is the main file server program. It serves a file tree through 9P and IX.
  72. The tree kept in memory is mutable. But frozen versions of the tree are written
  73. to
  74. .IR disk ,
  75. both upon request and also on a periodic basis, to survive power outages and other problems,
  76. and to be able to operate on trees larger than main memory.
  77. The tree(s) stored on disk are frozen and cannot be changed once written.
  78. .PP
  79. By default the program listens for 9P in the standard TCP port and posts a connection that
  80. can be mounted at
  81. .BR /srv/9pix .
  82. Flags
  83. .B -A
  84. and
  85. .B -S
  86. may be used to specify an alternate network address and/or
  87. .IR srv (3)
  88. file to post. Using these flags prevents
  89. .I 9pix
  90. from otherwise
  91. listening or posting to
  92. IR srv .
  93. Flag
  94. .B -r
  95. makes the program operate in read-only mode, and flag
  96. .B -a
  97. starts the program without requiring authentication to mount the file tree.
  98. .PP
  99. The program is aggresive in its usage of memory to keep disk blocks cached for
  100. further usage. By default it consumes half the memory available when started, or less
  101. if there is plenty.
  102. Flag
  103. .B -c
  104. can be used to set the size of the cache. Its argument indicates the desired number
  105. of megabytes to consume for such purpose. More memory will be consumed, e.g., for process
  106. stacks and protocol messages.
  107. .PP
  108. The on-disk image is organized as a log of blocks. When a new
  109. version of the tree must be written to disk, all blocks that changed are given disk addresses
  110. and are appended to the log. Once given addresses, they are frozen.
  111. If new changes are made to the tree, blocks are melted and forget their previous addresses:
  112. each time they are written again, they are assigned new ones.
  113. .PP
  114. When the disk gets full, all reachable blocks are marked and all other blocks are considered
  115. available for growing the log (this is a description of semantics, not of the implementation). Thus,
  116. the log is circular but jumps to the next available block each time it grows.
  117. If, after the mark process, the disk is still full, the file system becomes read only but for removing files.
  118. .PP
  119. Before using a disk it must be formatted using
  120. .IR creepy/fmt .
  121. This initializes blocks used to store marks for the mark and sweep process and also initializes a
  122. super block and an empty root directory. Flag
  123. .B -y
  124. forces the format even if the disk seems to contain a
  125. .I fossil (4)
  126. or
  127. .I creepy
  128. partition. Flag
  129. .B -w
  130. is used to format the partition for a WORM (described later) and not for a main file tree.
  131. .PP
  132. .I Creepy/rip
  133. is the same file server program, but operates in WORM mode. In this case, no mark and sweep
  134. for free blocks will ever happen. Blocks are consumed from the disk until it becomes full.
  135. The file tree served is always read-only.
  136. .PP
  137. Operating the WORM to in administrative mode to add more trees or new versions of the
  138. archived trees does not require any protocol: it can be done using the standard file interface
  139. used to operate on any other tree, by mounting and changing it.
  140. .PP
  141. An alternate mount specifier,
  142. .IR wormwr ,
  143. can be used to mount the tree in read-write mode, to update the archive.
  144. Updating the archive is performed by creating new trees with the conventional
  145. .BI / treename / year / mmdd
  146. paths on the WORM. But note that such paths are not enforced by the program at all.
  147. Before updating a tree in the archive, for a new day, a control request described
  148. later can be used to link the directory for the previous version of the archive to the new one.
  149. After that, changes made to files would in effect copy on write all blocks affected, and
  150. refer to old ones when they did not change.
  151. .PP
  152. .I Creepy/arch
  153. is a program started by
  154. .I creepy/9pix
  155. to archive snapshots of the tree into a directory provided by
  156. .I creepy/rip
  157. (or by any other file server).
  158. The program is not expected to be run by users, and speaks a simple protocol through
  159. its standard input: A block address is written and the block contents are read from it.
  160. Usually, the standard input is a pipe to
  161. .IR creepy/9pix .
  162. The program takes the address of the root directory as kept on disk and then asks the
  163. file server program for block contents, to archive them into a mounted directory. Thus,
  164. the tree archived is always consistent because only consistent trees can be read from disk
  165. (the mutable file tree is kept in memory).
  166. .PP
  167. The file tree provided by
  168. .I 9pix
  169. and
  170. .I rip
  171. has the following layout:
  172. .EX
  173. /
  174. /root
  175. /cons
  176. /stats
  177. .EE
  178. And, by convention, archives kept in the WORM are expected to have names like:
  179. .EX
  180. /root/treename/2012/0425
  181. /root/treename/2012/0425.1
  182. /root/treename/2012/0426
  183. .EE
  184. .PP
  185. Using the
  186. .B main
  187. attach specifier yields the tree as just shown. Using an empty specifier, or
  188. .BR root ,
  189. or
  190. .B main/active
  191. yields the tree found at
  192. .BR /root .
  193. In
  194. .I creepy/rip
  195. the attach specifier
  196. .B wormwr
  197. yields the root of the tree in read-write mode.
  198. .PP
  199. .IP \(bu
  200. The root directory is never found on disk. It is a placeholder for the contained files.
  201. .IP \(bu
  202. .I Cons
  203. is a synthesized file used as a console for file system administration, and it is not found
  204. on disk. It is still subject to file permissions, and coordinates concurrent access to the console
  205. by different users. The owner of the file server process is always allowed to access the console.
  206. .IP \(bu
  207. .I Stats
  208. is another synthesized file used to report statistics.
  209. .IP \(bu
  210. .I Root
  211. contains the actual file tree. It corresponds to the file tree as seen at this moment
  212. by file system users. It's semantics are similar to those of a UNIX or Plan 9 file system.
  213. .PP
  214. Users and groups can be added by creating and editing
  215. .B /root/users .
  216. See an example shown later.
  217. .PP
  218. The console accepts the following commands:
  219. .TP
  220. .BI allow " " [ uid ]
  221. Lets
  222. .I uid
  223. bypass permissions, or show allowed users if none is given.
  224. .TP
  225. .BI disallow " " [ uid ]
  226. undoes the effect of the previous command for the given
  227. .I uid
  228. or for everyone if none is given.
  229. .TP
  230. .B halt
  231. Halts the file system and terminates the processes.
  232. .TP
  233. .B stats
  234. Reports usage statistics.
  235. .TP
  236. .B sync
  237. Synchronizes the disk by writing a new version of the tree to the log.
  238. .TP
  239. .BI uname " " [ uid ]
  240. Reports information about user
  241. .IR uid .
  242. .TP
  243. .B users
  244. Prints the list of users.
  245. .TP
  246. .B who
  247. Reports the list of network addresses and users currently using the file system.
  248. .TP
  249. .BI arch " name hour " [ path ]
  250. Schedules an archival into the WORM with the given tree
  251. .I name
  252. and at the given
  253. .IR hour .
  254. By default, the WORM is expected at
  255. .B /n/rip
  256. in administrative mode. An optional
  257. .I path
  258. may be given to use a different directory.
  259. .TP
  260. .B "arch now
  261. archives the tree. The previous form must be used before to configure
  262. archival.
  263. .TP
  264. .B "arch none
  265. disables archival (this is the default).
  266. .TP
  267. .BI link " src dst
  268. is used in the WORM to initialize a new archive by linking the one of the
  269. previous day to a new name, before updating the tree.
  270. .TP
  271. .B ?
  272. Prints the list of known commands. More than those describe here will be shown,
  273. mostly for debugging.
  274. .SH EXAMPLES
  275. .PP
  276. Format a partition and a WORM
  277. .EX
  278. creepy/fmt /dev/sdE0/creepy
  279. creepy/fmt -w /dev/sdE0/rip
  280. .EE
  281. .PP
  282. Run the file system, mount it, initialize the user list with one from
  283. .IR fossil ,
  284. and populate it
  285. .EX
  286. creepy/9pix /dev/sdE0/creepy
  287. mount -c /srv/9pix /n/creepy main
  288. cp /adm/users /n/creepy/root/users
  289. echo allow $user >/n/creepy/cons
  290. dircp /n/dist /n/creepy/root
  291. .EE
  292. Run the worm (the previously file server would mount it
  293. if it finds its file posted in
  294. .I srv
  295. and is asked to archive a tree.
  296. .EX
  297. creepy/rip /dev/sdE0/rip
  298. .EE
  299. .SH SOURCE
  300. .B /sys/src/cmd/creepy
  301. .SH SEE ALSO
  302. .IR fossil (4),
  303. .IR venti (8).
  304. .br
  305. Franciscjo J. Ballesteros and Roger Peppe,
  306. ``The Design and Implementation of the Creepy File System and the IX File Protocol'',
  307. 2012.
  308. .SH BUGS
  309. Some. But hopefully, with time and testing, less than those still waiting under
  310. the covers in other popular file server programs we use.
  311. .PP
  312. Do not use this for your own files yet. It is experimental and still under testing.