fs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. .TH FS 3
  2. .SH NAME
  3. fs \- file system devices
  4. .SH SYNOPSIS
  5. .nf
  6. .B bind -b #k /dev
  7. .B /dev/fs
  8. .B /dev/fs/ctl
  9. .B /dev/fs/...
  10. .fi
  11. .SH DESCRIPTION
  12. The
  13. .I fs
  14. driver builds complex disk files out of simpler disk files.
  15. Inspired by the Plan 9 file server kernel's configuration strings,
  16. it provides device mirroring, partitioning, interleaving, and catenation
  17. for disk-based services like
  18. .IR kfs (4)
  19. or
  20. .IR venti (8).
  21. .PP
  22. The device
  23. is intended to be bound at
  24. .B /dev
  25. and contains a directory named
  26. .BR fs ,
  27. which in turn contains a
  28. .B ctl
  29. file and one file per configured device.
  30. .PP
  31. Most control messages each introduce a new device, here named
  32. .IR new .
  33. The
  34. .I file
  35. arguments are interpreted in the name space of the writer.
  36. .TP
  37. .BI cat " new files" \fR...
  38. The device
  39. .I new
  40. corresponds to the catenation of
  41. .IR files .
  42. .TP
  43. .BI inter " new files" \fR...
  44. The device
  45. .I new
  46. corresponds to the block interleaving of
  47. .IR files ;
  48. an 8192-byte block size is assumed.
  49. .TP
  50. .BI mirror " new files" \fR...
  51. The device
  52. .I new
  53. corresponds to a RAID-1-like mirroring of
  54. .IR files .
  55. Writes to
  56. .BI new
  57. are handled by sequentially writing the same data to the
  58. .I files
  59. from right to left (the reverse of
  60. the order in the control message).
  61. A failed write causes an eventual error return
  62. but does not prevent the rest of the writes
  63. to the other devices of the mirror set.
  64. Reads from
  65. .BI new
  66. are handled by sequentially reading from the
  67. .I files
  68. from left to right until one succeeds.
  69. The length of the mirror device is the minimum of the lengths of the
  70. .IR files .
  71. .TP
  72. .BI part " new file offset length"
  73. The device
  74. .I new
  75. corresponds to the
  76. .I length
  77. bytes starting at
  78. .I offset
  79. in
  80. .IR file .
  81. If
  82. .IR offset + length
  83. reaches past the end of
  84. .IR file ,
  85. .I length
  86. is silently reduced to fit.
  87. .TP
  88. .B clear
  89. Discard all
  90. .I fs
  91. device definitions.
  92. .PD
  93. .LP
  94. If the variable
  95. .B fsconfig
  96. is set in
  97. .IR plan9.ini (8)
  98. then
  99. .I fs
  100. will read its configuration from the file
  101. .B $fsconfig
  102. on the first attach.
  103. This is useful when the machine boots
  104. from a local file server that uses
  105. .IR fs .
  106. .SH EXAMPLE
  107. Mirror the two disks
  108. .B /dev/sdC0/data
  109. and
  110. .B /dev/sdD0/data
  111. as
  112. .BR /dev/fs/m0 ;
  113. similarly, mirror
  114. .B /dev/sdC1/data
  115. and
  116. .B /dev/sdD1/data
  117. as
  118. .BR /dev/fs/m1 :
  119. .IP
  120. .EX
  121. echo mirror m0 /dev/sdC0/data /dev/sdD0/data >/dev/fs/ctl
  122. echo mirror m1 /dev/sdC1/data /dev/sdD1/data >/dev/fs/ctl
  123. .EE
  124. .LP
  125. Interleave the two mirrored disks to create
  126. .BR /dev/fs/data :
  127. .IP
  128. .EX
  129. echo inter data /dev/fs/m0 /dev/fs/m1 >/dev/fs/ctl
  130. .EE
  131. .LP
  132. Run
  133. .IR kfs (4)
  134. on the interleaved device:
  135. .IP
  136. .EX
  137. disk/kfs -f /dev/fs/data
  138. .EE
  139. .LP
  140. Save the configuration:
  141. .IP
  142. .EX
  143. cp /dev/fs/ctl /dev/fd0disk
  144. .EE
  145. .LP
  146. To load the configuration automatically at boot time,
  147. add this to
  148. .IR plan9.ini :
  149. .IP
  150. .EX
  151. fsconfig=/dev/fd0disk
  152. .EE
  153. .SH "SEE ALSO"
  154. .I read
  155. in
  156. .IR cat (1),
  157. .IR dd (1),
  158. .IR kfs (4),
  159. .IR fs (8),
  160. .IR plan9.ini (8),
  161. .IR prep (8),
  162. .IR venti (8)
  163. .SH SOURCE
  164. .B /sys/src/9/port/devfs.c
  165. .SH BUGS
  166. Mirrors are RAID-like but not RAID.
  167. There is no fancy recovery mechanism and
  168. no automatic initial copying from a master drive to its mirror drives.
  169. .PP
  170. Each
  171. .I write
  172. system call on
  173. .B ctl
  174. may transmit at most one command.