usbdisk 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. .TH USBDISK 4
  2. .SH NAME
  3. usbdisk, usbfat: - serve USB mass storage devices
  4. .SH SYNOPSIS
  5. .B usb/disk
  6. [
  7. .B -dDfl
  8. ] [
  9. .B -m
  10. .I mountpoint
  11. ] [
  12. .B -s
  13. .I srvname
  14. ] [
  15. .I ctrlno
  16. .I id
  17. ]
  18. .LP
  19. .B usbfat:
  20. [
  21. .B -fl
  22. ] [
  23. .I disk
  24. [
  25. .I mntpt
  26. ] ]
  27. .SH DESCRIPTION
  28. .I Disk
  29. serves a directory named
  30. .I mountpoint
  31. (default
  32. .BR /n/disk )
  33. containing the files
  34. .B ctl
  35. and
  36. .IR n ,
  37. where
  38. .I n
  39. is the number of a LUN to access,
  40. for all detected LUNs of the named or found USB device.
  41. .I Disk
  42. searches for a USB device with class 8 (storage),
  43. subclass 2 (ATAPI CD/DVD),
  44. 5 (removable, ATAPI-like) or
  45. 6 (SCSI transparent),
  46. and
  47. protocol 0x50 (bulk), or uses
  48. .BI /dev/usb/ ctrlno / id
  49. if specified.
  50. In every LUN directory are the files
  51. .B data
  52. and
  53. .BR raw .
  54. .B data
  55. gives read/write access to blocks of the device.
  56. .B raw
  57. is a raw SCSI-like interface (talk to it with
  58. .IR scuzz (8)).
  59. .PP
  60. The root directory's
  61. .B ctl
  62. file accepts the command
  63. .LR reset ,
  64. which tells
  65. .I disk
  66. to again fetch the information about all LUNs,
  67. and yields the device geometries when read.
  68. .PP
  69. The
  70. .B -d
  71. option generates debugging output.
  72. The
  73. .B -f
  74. option avoids freaking out some cheap USB flash disks by not issuing
  75. UMS reset commands to them.
  76. The
  77. .B -l
  78. option asks the device for its maximum LUN.
  79. By default,
  80. .I disk
  81. assumes a maximum LUN of zero, since some devices
  82. get upset if you ask them for their maximum LUN.
  83. Flash memory devices are likely to have multiple LUNs.
  84. The
  85. .B -m
  86. option mounts the served hierarchy on
  87. .I mountpoint
  88. instead of
  89. .BR /n/disk .
  90. The
  91. .B -s
  92. option posts a mountable file descriptor as
  93. .BI /srv/ srvname.
  94. The
  95. .B -D
  96. option prints all 9P messages.
  97. .SH EXAMPLES
  98. Access the usual preformatted FAT partition:
  99. .IP
  100. .EX
  101. % usb/usbd
  102. % usb/disk -l
  103. % disk/fdisk -p /n/disk/0/data
  104. part dos 7 31559
  105. % dossrv -f /n/disk/0/data:7 usbstorage
  106. dossrv: serving #s/usbstorage
  107. % mount /srv/usbstorage /n/d:
  108. % ls -l /n/d:
  109. alrw-rw-rw- M 39 bill trog 180364 Oct 5 18:14 /n/d:/9LOAD
  110. d-rwxrwxrwx M 39 bill trog 0 Nov 13 14:30 /n/d:/benedict
  111. .EE
  112. .LP
  113. The latter part of the above example, from
  114. .B disk/fdisk
  115. to
  116. .BR mount ,
  117. has been packaged up as
  118. .IR usbfat: ,
  119. which mounts the FAT file system in the DOS partition of the named
  120. .I disk
  121. (by default
  122. .BR /n/disk/0/data )
  123. on
  124. .I mntpt
  125. (by default
  126. .BR /n/usb ).
  127. .SH FILES
  128. .TF /srv/usbsfs.ctlr.id
  129. .TP
  130. .B /n/disk
  131. default mountpoint
  132. .TP
  133. .B /n/usb
  134. default mountpoint for FAT file system on the disk
  135. .TP
  136. .B /srv/usbfat.$user
  137. FAT file system service
  138. .SH SOURCE
  139. .B /sys/src/cmd/usb/disk
  140. .br
  141. .B /rc/bin/usbfat:
  142. .SH SEE ALSO
  143. .IR fs (3),
  144. .IR sd (3),
  145. .IR usb (3),
  146. .IR partfs (8),
  147. .IR prep (8),
  148. .IR scuzz (8)
  149. .SH BUGS
  150. Should implement
  151. .IR sd (3)'s
  152. interface for each LUN.
  153. Currently,
  154. if there are multiple partitions, you can use
  155. .IR fs (3)
  156. to manage them.
  157. If
  158. .L "fdisk -p"
  159. prints nothing,
  160. there is no partition table on the device,
  161. so one can invoke
  162. .IR dossrv (4)
  163. directly.
  164. .PP
  165. USB 1 flash disks' I/O rates are slow and variable.
  166. Reading and writing in large units (e.g., 4KB) seems to be faster
  167. by an order of magnitude when transferring large volumes of data.