Statistics
| Branch: | Revision:

root / docs / usb-storage.txt @ 834574ea

History | View | Annotate | Download (1.9 kB)

1 0f58f68b Gerd Hoffmann
2 0f58f68b Gerd Hoffmann
qemu usb storage emulation
3 0f58f68b Gerd Hoffmann
--------------------------
4 0f58f68b Gerd Hoffmann
5 34707333 Gerd Hoffmann
QEMU has three devices for usb storage emulation.
6 0f58f68b Gerd Hoffmann
7 0f58f68b Gerd Hoffmann
Number one emulates the classic bulk-only transport protocol which is
8 0f58f68b Gerd Hoffmann
used by 99% of the usb sticks on the marked today and is called
9 0f58f68b Gerd Hoffmann
"usb-storage".  Usage (hooking up to xhci, other host controllers work
10 0f58f68b Gerd Hoffmann
too):
11 0f58f68b Gerd Hoffmann
12 0f58f68b Gerd Hoffmann
  qemu ${other_vm_args}                                \
13 0f58f68b Gerd Hoffmann
       -drive if=none,id=stick,file=/path/to/file.img  \
14 0f58f68b Gerd Hoffmann
       -device nec-usb-xhci,id=xhci                    \
15 0f58f68b Gerd Hoffmann
       -device usb-storage,bus=xhci.0,drive=stick
16 0f58f68b Gerd Hoffmann
17 0f58f68b Gerd Hoffmann
18 0f58f68b Gerd Hoffmann
Number two is the newer usb attached scsi transport.  This one doesn't
19 0f58f68b Gerd Hoffmann
automagically create a scsi disk, so you have to explicitly attach one
20 0f58f68b Gerd Hoffmann
manually.  Multiple logical units are supported.  Here is an example
21 0f58f68b Gerd Hoffmann
with tree logical units:
22 0f58f68b Gerd Hoffmann
23 0f58f68b Gerd Hoffmann
  qemu ${other_vm_args}                                                \
24 0f58f68b Gerd Hoffmann
       -drive if=none,id=uas-disk1,file=/path/to/file1.img             \
25 0f58f68b Gerd Hoffmann
       -drive if=none,id=uas-disk2,file=/path/to/file2.img             \
26 0f58f68b Gerd Hoffmann
       -drive if=none,id=uas-cdrom,media=cdrom,file=/path/to/image.iso \
27 0f58f68b Gerd Hoffmann
       -device nec-usb-xhci,id=xhci                                    \
28 0f58f68b Gerd Hoffmann
       -device usb-uas,id=uas,bus=xhci.0                               \
29 0f58f68b Gerd Hoffmann
       -device scsi-hd,bus=uas.0,scsi-id=0,lun=0,drive=uas-disk1       \
30 0f58f68b Gerd Hoffmann
       -device scsi-hd,bus=uas.0,scsi-id=0,lun=1,drive=uas-disk2       \
31 0f58f68b Gerd Hoffmann
       -device scsi-cd,bus=uas.0,scsi-id=0,lun=5,drive=uas-cdrom
32 0f58f68b Gerd Hoffmann
33 0f58f68b Gerd Hoffmann
34 34707333 Gerd Hoffmann
Number three emulates the classic bulk-only transport protocol too.
35 34707333 Gerd Hoffmann
It's called "usb-bot".  It shares most code with "usb-storage", and
36 34707333 Gerd Hoffmann
the guest will not be able to see the difference.  The qemu command
37 34707333 Gerd Hoffmann
line interface is simliar to usb-uas though, i.e. no automatic scsi
38 34707333 Gerd Hoffmann
disk creation.  It also features support for up to 16 LUNs.  The LUN
39 34707333 Gerd Hoffmann
numbers must be continous, i.e. for three devices you must use 0+1+2.
40 34707333 Gerd Hoffmann
The 0+1+5 numbering from the "usb-uas" example isn't going to work
41 34707333 Gerd Hoffmann
with "usb-bot".
42 34707333 Gerd Hoffmann
43 0f58f68b Gerd Hoffmann
enjoy,
44 0f58f68b Gerd Hoffmann
  Gerd
45 0f58f68b Gerd Hoffmann
46 0f58f68b Gerd Hoffmann
--
47 0f58f68b Gerd Hoffmann
Gerd Hoffmann <kraxel@redhat.com>