Article ID: 7984, created on Jan 18, 2010, last review on May 11, 2014

  • Applies to:
  • Virtuozzo hypervisor 4.0
  • Virtuozzo hypervisor 4.0 for Mac Bare Metal

Resolution

Parallels Server 4 Bare Metal allows one to forward to a virtual machine any USB device attached to a host computer.

This article shows an example of forwarding a USB flash drive attached to a host computer to a virtual machine running CentOS.
  1. Stop the virtual machine if it is running:
    [root@psbm10 ~]# prlctl stop USB-KB7984
    Stopping the VM...
    The VM has been successfully stopped.
    [root@psbm10 ~]# 
  2. Add the USB controller to the virtual machine:
    [root@psbm10 ~]# prlctl set USB-KB7984 --device-add usb
    Creating usb.
    The VM has been successfully configured.
    [root@psbm10 ~]#
  3. Determine the USB device ID you want to forward to the virtual machine:
    [root@psbm10 ~]# prlsrvctl info
    ID: {c7a3c721-ee34-4b24-b02d-078ac6e2eaff}
    Hostname: 127.0.0.1
    Version: Server 4.0.5612.577097
    OS: Linux Version 2.6.18-028stab070.5
    VM home: /var/parallels
    Memory limit: auto
    Minimal security level: normal
    Manage settings for new users: deny
    CEP mechanism: on
    Backup path: /var/parallels/backups
    Hardware info:
         hdd  ATA ST3750528AS                          '/dev/sda'
    hdd-part  Linux                                    '/dev/sda1'
    hdd-part  Linux swap                               '/dev/sda2'
         hdd  ATA ST3750528AS                          '/dev/sdb'
    hdd-part                                           '/dev/sdb1'
         hdd  ATA ST3750528AS                          '/dev/sdc'
    hdd-part                                           '/dev/sdc1'
         hdd  ATA ST3750528AS                          '/dev/sdd'
    hdd-part                                           '/dev/sdd1'
       cdrom  Optiarc DVD RW AD-5240S                  '/dev/scd0'
         net  eth0                                     'eth0'
         net  vnic0                                    'vnic0'
         net  vnic1                                    'vnic1'
         usb  Alcor Micro - USB Device 6387            '2-3|058f|6387|high|--|11082200000748'
         usb  Genius - Optical Mouse                   '7-2|0458|003a|low|KM|Empty'
  4. Start the virtual machine:
    [root@psbm10 ~]# prlctl start USB-KB7984
    Starting the VM...
    The VM has been successfully started.
    [root@psbm10 ~]#
  5. Connect the device right after the virtual machine is started:
    [root@psbm10 ~]# prlctl set USB-KB7984 --device-connect '2-3|058f|6387|high|--|11082200000748'
    Connect device: 2-3|058f|6387|high|--|11082200000748
    The device successfully connected
    [root@psbm10 ~]#
  6. Check that the device is connected from inside the virtual machine:
    [root@usb-kb7984 ~]# lsusb
    Bus 002 Device 001: ID 0000:0000
    Bus 001 Device 001: ID 0000:0000
    Bus 001 Device 002: ID 058f:6387 Alcor Micro Corp. Transcend JetFlash Flash Drive
    [root@usb-kb7984 ~]#

When you want to unplug the device from the virtual machine, use the following sequence:
  1. Determine the new ID of the attached USB device:
    [root@psbm10 ~]# prlsrvctl info
    ID: {c7a3c721-ee34-4b24-b02d-078ac6e2eaff}
    Hostname: 127.0.0.1
    Version: Server 4.0.5612.577097
    OS: Linux Version 2.6.18-028stab070.5
    VM home: /var/parallels
    Memory limit: auto
    Minimal security level: normal
    Manage settings for new users: deny
    CEP mechanism: on
    Backup path: /var/parallels/backups
    Hardware info:
         hdd  ATA ST3750528AS                          '/dev/sda'
    hdd-part  Linux                                    '/dev/sda1'
    hdd-part  Linux swap                               '/dev/sda2'
         hdd  ATA ST3750528AS                          '/dev/sdb'
    hdd-part                                           '/dev/sdb1'
         hdd  ATA ST3750528AS                          '/dev/sdc'
    hdd-part                                           '/dev/sdc1'
         hdd  ATA ST3750528AS                          '/dev/sdd'
    hdd-part                                           '/dev/sdd1'
       cdrom  Optiarc DVD RW AD-5240S                  '/dev/scd0'
         net  eth0                                     'eth0'
         net  vnic0                                    'vnic0'
         net  vnic1                                    'vnic1'
         usb  Alcor Micro - USB Device 6387            '2-3|058f|6387|high|PR|11082200000748'
         usb  Genius - Optical Mouse                   '7-2|0458|003a|low|KM|Empty'
  2. Use the ID to unplug the device:
    [root@psbm10 ~]# prlctl set USB-KB7984 --device-disconnect '2-3|058f|6387|high|PR|11082200000748'
    Disconnect device: 2-3|058f|6387|high|PR|11082200000748
    The device successfully disconnected
    [root@psbm10 ~]#

a26b38f94253cdfbf1028d72cf3a498b d245cfd276e66749824316e20bfd8ade 0fe456bdc1f41aefe37dd2554a60437e 2897d76d56d2010f4e3a28f864d69223

Email subscription for changes to this article
Save as PDF