Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Proxmox Host
- # replace sdX with the disk device
- dd if=/dev/sdX of=/root/unraid-license-usb.img bs=64M status=progress
- modprobe libcomposite
- modprobe usb_f_mass_storage
- apt update
- apt install build-essential git proxmox-headers-$(uname -r)
- cd /root
- git clone https://github.com/xairy/raw-gadget.git
- cd raw-gadget/dummy_hcd
- make KDIR=/lib/modules/$(uname -r)/build
- modprobe ./dummy_hcd.ko
- cd /sys/kernel/config/usb_gadget
- mkdir unraidusb
- cd unraidusb
- lsusb
- # note the physical's USB drive's Vendor and Product ID (XXXX:YYYY) and replace below
- echo 0xXXXX > idVendor
- echo 0xYYYY > idProduct
- echo 0x0200 > bcdUSB
- echo 0x0100 > bcdDevice
- mkdir -p strings/0x409
- lsusb -v
- # note the physical's drive iSerial, iProduct, iManufacturer for the values below
- echo "<<iSerial>>" > strings/0x409/serialnumber
- echo "<<iManufacturer>>" > strings/0x409/manufacturer
- echo "<<iProduct>>" > strings/0x409/product
- mkdir -p configs/c.1
- mkdir -p configs/c.1/strings/0x409
- echo "Mass Storage" > configs/c.1/strings/0x409/configuration
- echo 250 > configs/c.1/MaxPower
- mkdir -p functions/mass_storage.usb0
- echo 1 > functions/mass_storage.usb0/lun.0/removable
- echo 0 > functions/mass_storage.usb0/lun.0/ro
- echo "<<iManufacturer>> <<iProduct>>" > functions/mass_storage.usb0/lun.0/inquiry_string
- echo /root/unraid-license-usb.img > functions/mass_storage.usb0/lun.0/file
- ln -s functions/mass_storage.usb0 configs/c.1/
- # unplug physical USB flash drive before the next command, otherwise duplicate IDs and serial will likely cause issues!
- echo dummy_udc.0 > /sys/kernel/config/usb_gadget/unraidusb/UDC
Advertisement