Create a new disk image with space pre-allocation (4000 MBytes):
fallocate -l 4000M virtual_usb.img
Create Ext4 file system:
mkfs -t ext4 virtual_usb.img
Load the necessary modules:
sudo modprobe dummy_hcd
sudo modprobe g_mass_storage file=virtual_usb.img idVendor=0x8564 idProduct=0x1000 iSerialNumber=C71FFD58CDF9 iManufacturer="JetFlash" iProduct="Mass Storage Device" removable=true cdrom=false
If someone want to share the device using USBIP utility, make sure to add the
stall=false
flag to the command