[SOLVED] Mount Block/File as USB in Guest


New Member
Oct 16, 2021

I am trying to automate the installation of pfSense via the use of their ECL feature (stick a USB in with the config during installation and it automatically restores every boot).

I am struggling on how exactly to achive this on Proxmox other than having a single USB device plugged into a physical host.

Is there a way I can simply attach a USB device to a guest then point it at VHD file?

Any help would be massively appreciated. :)
Last edited:
I have also looked at trying something like emulating USB on Debian which sounded promising.

i.e. something like this (but the dummy_hcd kernel module not being included in 5.13.19-6-pve stops me. :(
modprobe dummy_hcd modprobe: FATAL: Module dummy_hcd not found in directory /lib/modules/5.13.19-6-pve
modprobe g_mass_storage file=/path/to/backing_file idVendor=0x1d6b idProduct=0x0104 iManufacturer=Myself iProduct=VirtualBlockDevice iSerialNumber=123
Last edited:
Thanks for the reply @leesteken !

I have added
args: -drive if=none,id=stick,format=raw,file=/var/lib/vz/template/iso/pfconfig-test.img -device nec-usb-xhci,id=xhci -device usb-storage,bus=xhci.0,drive=stick
as documented in

The VM seems to see the device during boot but fails with
Root mount waiting for : CAM (for many lines)
CAM status: CCB request completed with an error

I am thinking perhaps mkfs.fat -F 16 pfconfig-test.img or mkfs.fat -F 32 pfconfig-test.img aren't enough and I need to give the .img a partition structure like /dev/sda1 to format? Not sure how to do that but will update if I find anything more and manage to get it working.
I got this working with the below for anyone who comes across the same issue.

dd if=/dev/zero of=/tmp/pfsense-config.img count=204800 apt install multipath-tools kpartx -a /tmp/pfsense-config.img mkfs.vfat -F 32 /dev/mapper/loop0p1 mkdir /tmp/pfsense-config-temp-mount mount /dev/mapper/loop0p1 /tmp/pfsense-config-temp-mount mkdir /tmp/pfsense-config-temp-mount/config cp yourpfsenseconfig.xml /tmp/pfsense-config-temp-mount/config/config.xml umount /tmp/pfsense-config-temp-mount rmdir /tmp/pfsense-config-temp-mount kpartx -d /dev/loop0 mv /tmp/pfsense-config.img /var/lib/vz/private/pfsense-config.img

Then add this to /etc/pve/qeum_server/<vmid>.conf.
args: -drive if=none,id=stick,format=raw,file=/var/lib/vz/private/pfconfig-test.img -device nec-usb-xhci,id=xhci -device usb-storage,bus=xhci.0,drive=stick
Last edited:
  • Like
Reactions: leesteken


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!