- 1 year ago
Connect USB Drive to HyperV with Debian as a Guest OS
Comment
1 / 1
To connect a USB drive to a Hyper-V virtual machine running Debian as the guest operating system, you can follow these steps:
Ensure USB support is enabled:
- Open the Hyper-V Manager on the host machine.
- Select the virtual machine running Debian as the guest OS.
- Go to the "Settings" of the virtual machine.
- Under the "Hardware" tab, select "Add Hardware" and choose "Legacy Network Adapter".
- Click "Add" and then "OK" to save the changes.
Install Enhanced Session Mode:
- Open PowerShell as an administrator on the host machine.
- Run the following command to enable Enhanced Session Mode:
Replace "YourVMName" with the actual name of your virtual machine.powershellSet-VM -VMName "YourVMName" -EnhancedSessionTransportType HvSocket
Attach the USB drive to the virtual machine:
- Start the virtual machine and log in to the Debian guest OS.
- Install the
usbutils
package on the Debian system if it's not already installed. Open a terminal and run the following command:bashsudo apt update
sudo apt install usbutils
- Connect the USB drive to the host machine.
- In the Hyper-V Manager on the host machine, select the virtual machine and go to "Actions" -> "Insert Integration Services Setup Disk".
- In the Debian guest OS, run the following command to list the USB devices:bash
lsusb
- Identify the USB device from the list and note down its vendor and product ID.
- Run the following command in the Debian guest OS to attach the USB device:bash
sudo adduser $USER vboxusers
sudo nano /etc/udev/rules.d/10-vboxusers.rules
- In the text editor, add the following line, replacing
VENDOR_ID
andPRODUCT_ID
with the actual vendor and product ID of your USB device:bashSUBSYSTEM=="usb", ATTRS{idVendor}=="VENDOR_ID", ATTRS{idProduct}=="PRODUCT_ID", OWNER="$USER", GROUP="vboxusers", MODE="0666"
- Save the file and exit the text editor.
- Restart the Debian guest OS for the changes to take effect.
Access the USB drive in Debian:
- After the Debian guest OS restarts, the USB drive should be accessible within the virtual machine.
- Run the following command to list the attached USB devices:bash
lsusb
- You should see the USB device in the list.
- Mount and use the USB drive as you would with any other storage device in Debian.
By following these steps, you can connect a USB drive to a Hyper-V virtual machine running Debian as the guest operating system. This enables you to access and use the USB drive within the Debian guest OS.