Statistics
| Branch: | Revision:

root / docs / usb-storage.txt @ ff5928d0

History | View | Annotate | Download (1.4 kB)

1 0f58f68b Gerd Hoffmann
2 0f58f68b Gerd Hoffmann
qemu usb storage emulation
3 0f58f68b Gerd Hoffmann
--------------------------
4 0f58f68b Gerd Hoffmann
5 43ffe61f Stefan Weil
QEMU has two emulations for usb storage devices.
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 0f58f68b Gerd Hoffmann
enjoy,
35 0f58f68b Gerd Hoffmann
  Gerd
36 0f58f68b Gerd Hoffmann
37 0f58f68b Gerd Hoffmann
--
38 0f58f68b Gerd Hoffmann
Gerd Hoffmann <kraxel@redhat.com>