5 For [[automated testing|todo/automated_builds_and_tests]] purposes, we
6 need to use removable USB mass storage devices, e.g. to test USB-only
7 features such as the USB installer or persistence.
9 On a headless test server in a datacenter, one does not want to rely
10 on a set of physical USB sticks being plugged in.
12 Therefore, these USB mass storage devices must be emulated in
13 software, and should probably use files as underlying storage.
19 * obsoleted by `g-mass-storage`
20 * not in Debian kernel as of 3.2.21-3
24 Works fine with qemu-kvm (1.0+dfsg-11) and libvirt (0.9.12-3):
26 modprobe dummy-hcd is_high_speed=1
27 modprobe g_mass_storage file=/tmp/test.usb removable=1
29 Then I use qemu-kvm + libvirt USB 2.0 passthrough to lend that virtual
30 USB mass storage device to a qemu-kvm VM, which I boot from a Tails
31 0.12 ISO, that I clone onto the virtual USB device using the Tails
34 Then I unplug the virtual CD drive, and boot the same VM from the
35 virtual USB mass storage device, onto which I successfully setup
36 a Tails persistent volume. Rebooting, enabling the persistent volume
41 * **Not in Debian** kernel as of 3.2.21-3, asked in [[!debbug 678731]]
42 * **All underlying files must be listed at module load time**; this
43 should not be a problem, but still a limitation to be kept in mind.
47 qemu (1.1.0+dfsg-1) and qemu-kvm (1.0+dfsg-11) know how to emulate
48 a USB mass storage device, using `-usbdevice` (deprecated) or
49 (roughly) a combination of `-drive file=path_to_test_file.usb,if=none`
50 and `-device usb-storage,drive=DRIVE-ID`. At least with qemu-kvm:
52 * one can boot from such a USB device
53 * virt-manager (0.9.1-4) and libvirt (0.9.12-3) allow to add and
54 configure such a device, and plug it into a virtual USB 2.0
59 * **removable property**: by default the emulated USB disk is *not*
60 marked as removable; qemu and qemu-kvm from Wheezy support emulating
61 removable USB devices, but libvirt has no way to pass this option.
62 - [upstream ticket](https://bugzilla.redhat.com/show_bug.cgi?id=922495)
63 - The qemu part was [discussed on
64 Launchpad](https://bugs.launchpad.net/qemu/+bug/686613) already.
65 - A patch that adds the missing feature is being upstream'd, see
66 [[contribute/release_process/test/setup]] for details.