Connect a USB Drive to Your Cloud

![[head.png]]

USB passthrough is a technology enabling a USB device connected to a physical machine to be shared on a virtual machine hosted on it's cloud system. This capability is especially useful in scenarios like data backups and transferring large files between virtual machines.

In environments built on Proxmox, you can connect a USB drive directly to the Proxmox hardware and share it with a virtual container (CT).

Steps to Connect and Share a USB Drive in Proxmox

Prepare the USB Drive

Attach the USB drive to your Proxmox server and prepare it using standard Linux commands:

$ lsblk 
$ fdisk /dev/sdb # choose 'n' for new partition, then follow default prompts, and 'w' to write changes
$ mkfs.ext4 /dev/sdb1 # format the new partition

Mount the USB Drive on Proxmox Node: Create a directory to mount the USB drive and then mount it:

$ mkdir /mnt/usb
$ mount /dev/sdb1 /mnt/usb

Share the Drive with a Container: Share the mounted USB drive with your container. First, identify a free mount point in your container's resource panel. Then, share the drive:

pct start
pct set 101 -mp1 /mnt/usb,mp=/shared_usb
pct stop

![[Pasted image 20240106144256.png]]

After setting up the mount point, restart your container and remount the usb drive on the proxmox node. You'll then have access to the USB drive from the /shared_usb directory within the container.

Caveats

Snapshots

If you want to create a snapshot of your machine and are using a USB drive solely for uploading backups, the recommended approach is to set up a separate container or machine dedicated to backups. Connect the USB drive to this backup machine as described in the article, and then use rsync to transfer the backup to the /shared_usb directory on the backup machine.

For more detailed information, refer to Proxmox's official documentation on Linux Container Bind Mount Points.