Exclusive USB Device Passthrough QEMU/KVM

List the device you would like to redirect using lsusb

[user@hostname ~]$ lsusb
Bus 001 Device 004: ID 258a:0027 SINOWEALTH Wired Gaming Mouse

Add the following to your virtsh edit XML file

<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<address bus='1' device='4'/>
</source>
</hostdev>

Disconnecting the device from your Virtual Machine will reconnect it to the source system.

dislocker /etc/fstab Mount

UUID=$UUID_OF_DISK /mnt/crypt/8TBCrypt fuse.dislocker user-password=$PASSWORD,nofail 0 0
/mnt/crypt/8TBCrypt/dislocker-file /mnt/8TB auto loop,nofail 0 0

Note: There’s some obvious insecurity in statically assigning the password in your fstab file. This should only be used temporarily if you’re converting between a bitlocker -> ext4 or LUKS type disk.

Setting up LUKS Crypts with Filesystem & LUKS UUIDs on Debian


# Note: This depends on a key file and directory. Optimally, this would be placed
# on a separate, removable device.

# Install
sudo apt update
sudo apt install cryptsetup

# Generate a random key
sudo dd if=/dev/urandom of=/home/user/.KeyPath/Key bs=1 count=4096
sudo chown user:user/home/user/.KeyPath/Key
sudo chmod 600 /home/user/.KeyPath/Key

# NOTE: Unmount if your disks are mounted

# Create LUKS containers
sudo cryptsetup luksFormat /dev/sda1 --key-file /home/user/.KeyPath/Key

# Open the encrypted containers
sudo cryptsetup open /dev/sda1 500GBCrypt --key-file /home/user/.KeyPath/Key

# Create filesystems
sudo mkfs.ext4 /dev/mapper/500GBCrypt

# Get the LUKS UUIDs (for crypttab):
sudo cryptsetup luksUUID /dev/sda1

# Get the filesystem UUIDs (for fstab):
sudo blkid /dev/mapper/500GBCrypt

# Create mount points and mount
sudo mkdir -p /mnt/500GB

# Configure automatic mounting at boot using UUIDs

sudo vim /etc/crypttab

# NOTE: Add these lines (replace with actual LUKS UUIDs):
#
# 500GBCrypt UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /home/user/.KeyPath/Key luks

# Edit /etc/fstab using filesystem UUIDs:

sudo vim /etc/fstab

# NOTE: Add these lines (replace with actual filesystem UUIDs):
#
UUID=bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb /mnt/500GB ext4 defaults 0 2

Step 8: Test the configuration
bash
# Close all encrypted volumes
sudo cryptsetup close 500GBCrypt

# Test crypttab (should open all volumes using UUIDs)
sudo cryptdisks_start 500GBCrypt

# Test fstab
sudo mount -a

# Verify everything is mounted
lsblk