usbdisk 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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 -dD
  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 -f
  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 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. .\" SCSI reset commands to them.
  76. The
  77. .B -m
  78. option mounts the served hierarchy on
  79. .I mountpoint
  80. instead of
  81. .BR /n/disk .
  82. The
  83. .B -s
  84. option posts a mountable file descriptor as
  85. .BI /srv/ srvname.
  86. The
  87. .B -D
  88. option prints all 9P messages.
  89. .SH EXAMPLES
  90. Access the usual preformatted FAT partition:
  91. .IP
  92. .EX
  93. % usb/usbd
  94. % usb/disk
  95. % disk/fdisk -p /n/disk/0/data
  96. part dos 7 31559
  97. % dossrv -f /n/disk/0/data:7 usbstorage
  98. dossrv: serving #s/usbstorage
  99. % mount /srv/usbstorage /n/d:
  100. % ls -l /n/d:
  101. alrw-rw-rw- M 39 bill trog 180364 Oct 5 18:14 /n/d:/9LOAD
  102. d-rwxrwxrwx M 39 bill trog 0 Nov 13 14:30 /n/d:/benedict
  103. .EE
  104. .LP
  105. The latter part of the above example, from
  106. .B disk/fdisk
  107. to
  108. .BR mount ,
  109. has been packaged up as
  110. .IR usbfat: ,
  111. which mounts the FAT file system in the DOS partition of the named
  112. .I disk
  113. (by default
  114. .BR /n/disk/0/data )
  115. on
  116. .I mntpt
  117. (by default
  118. .BR /n/usb ).
  119. .SH FILES
  120. .TF /srv/usbsfs.ctlr.id
  121. .TP
  122. .B /n/disk
  123. default mountpoint
  124. .TP
  125. .B /n/usb
  126. default mountpoint for FAT file system on the disk
  127. .TP
  128. .B /srv/usbfat.$user
  129. FAT file system service
  130. .SH SOURCE
  131. .B /sys/src/cmd/usb/disk
  132. .br
  133. .B /rc/bin/usbfat:
  134. .SH SEE ALSO
  135. .IR fs (3),
  136. .IR sd (3),
  137. .IR usb (3),
  138. .IR prep (8),
  139. .IR scuzz (8)
  140. .SH BUGS
  141. Should implement
  142. .IR sd (3)'s
  143. interface for each LUN.
  144. Currently,
  145. if there are multiple partitions, you can use
  146. .IR fs (3)
  147. to manage them.
  148. If
  149. .L "fdisk -p"
  150. prints nothing,
  151. there is no partition table on the device,
  152. so one can invoke
  153. .IR dossrv (4)
  154. directly.
  155. .PP
  156. USB 1.0 flash disks' I/O rates are slow and variable.
  157. Reading and writing in large units (e.g., 4KB) seems to be faster
  158. by an order of magnitude when transferring large volumes of data.