Guest User

Untitled

a guest
May 15th, 2026
135
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.61 KB | None | 1 0
  1. @Proxmox Host
  2.  
  3. # replace sdX with the disk device
  4. dd if=/dev/sdX of=/root/unraid-license-usb.img bs=64M status=progress
  5.  
  6. modprobe libcomposite
  7. modprobe usb_f_mass_storage
  8.  
  9. apt update
  10. apt install build-essential git proxmox-headers-$(uname -r)
  11.  
  12. cd /root
  13. git clone https://github.com/xairy/raw-gadget.git
  14. cd raw-gadget/dummy_hcd
  15. make KDIR=/lib/modules/$(uname -r)/build
  16.  
  17. modprobe ./dummy_hcd.ko
  18.  
  19. cd /sys/kernel/config/usb_gadget
  20. mkdir unraidusb
  21. cd unraidusb
  22.  
  23. lsusb
  24. # note the physical's USB drive's Vendor and Product ID (XXXX:YYYY) and replace below
  25. echo 0xXXXX > idVendor
  26. echo 0xYYYY > idProduct
  27. echo 0x0200 > bcdUSB
  28. echo 0x0100 > bcdDevice
  29.  
  30. mkdir -p strings/0x409
  31. lsusb -v
  32. # note the physical's drive iSerial, iProduct, iManufacturer for the values below
  33.  
  34. echo "<<iSerial>>" > strings/0x409/serialnumber
  35. echo "<<iManufacturer>>" > strings/0x409/manufacturer
  36. echo "<<iProduct>>" > strings/0x409/product
  37.  
  38. mkdir -p configs/c.1
  39. mkdir -p configs/c.1/strings/0x409
  40.  
  41. echo "Mass Storage" > configs/c.1/strings/0x409/configuration
  42. echo 250 > configs/c.1/MaxPower
  43.  
  44. mkdir -p functions/mass_storage.usb0
  45.  
  46. echo 1 > functions/mass_storage.usb0/lun.0/removable
  47. echo 0 > functions/mass_storage.usb0/lun.0/ro
  48. echo "<<iManufacturer>> <<iProduct>>" > functions/mass_storage.usb0/lun.0/inquiry_string
  49.  
  50. echo /root/unraid-license-usb.img > functions/mass_storage.usb0/lun.0/file
  51. ln -s functions/mass_storage.usb0 configs/c.1/
  52.  
  53. # unplug physical USB flash drive before the next command, otherwise duplicate IDs and serial will likely cause issues!
  54. echo dummy_udc.0 > /sys/kernel/config/usb_gadget/unraidusb/UDC
  55.  
  56.  
  57.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment