1

我正在尝试使用dwc2g_mass_storage(使用最后一个可用的 Raspbian 图像)将 Raspberry Pi Zero 设置为大容量存储。我用 . 创建了数据存储文件dd,用mkdosfs. 我找了很多东西。花了一些时间才明白,options应该是传入的/etc/modprobe.d/g_mass_storage.conf ,终于在ubuntu中看到了。我的问题是:它处于只读模式。

我试图将ro选项设置为对行为yn不产生任何影响。我更改了文件(777)的权限,它没有改变。这是我/etc/modprobe.d/g_mass_storage.conf文件的当前内容:

options g_mass_storage file=/piusb.bin stall=0 removable=y ro=n

这是dmesg来自 ubuntu 的:

[Today and now]usb 1-1.2: new high-speed USB device number 28 using ehci-pci
[  +0,299994] usb 1-1.2: device descriptor read/64, error -71
[  +0,959969] usb 1-1.2: device descriptor read/64, error -71
[  +0,187918] usb 1-1.2: new high-speed USB device number 29 using ehci-pci
[  +0,113925] usb 1-1.2: New USB device found, idVendor=0525, idProduct=a4a5
[  +0,000007] usb 1-1.2: New USB device strings: Mfr=3, Product=4, SerialNumber=0
[  +0,000004] usb 1-1.2: Product: Mass Storage Gadget
[  +0,000003] usb 1-1.2: Manufacturer: Linux 4.19.118+ with 20980000.usb
[  +0,001467] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[  +0,000246] usb-storage 1-1.2:1.0: Quirks match for vid 0525 pid a4a5: 10000
[  +0,000283] scsi host9: usb-storage 1-1.2:1.0
[  +1,009528] scsi 9:0:0:0: Direct-Access     Linux    File-Stor Gadget 0419 PQ: 0 ANSI: 2
[  +0,001079] sd 9:0:0:0: Attached scsi generic sg5 type 0
[  +0,001699] sd 9:0:0:0: Power-on or device reset occurred
[  +0,001211] sd 9:0:0:0: [sde] 67108864 512-byte logical blocks: (34.4 GB/32.0 GiB)
[  +0,000672] sd 9:0:0:0: [sde] Write Protect is on
[  +0,000016] sd 9:0:0:0: [sde] Mode Sense: 0f 00 80 00
[  +0,000740] sd 9:0:0:0: [sde] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[  +0,005478]  sde:
[  +0,002735] sd 9:0:0:0: [sde] Attached SCSI removable disk

如何获得读/写大容量存储?

4

1 回答 1

0

我重现了你的问题。我在Raspberry Pi Zero W上的模块也有类似的问题g_acm_ms。如果您在其中配置模块/etc/modprobe.d/,则系统会忽略该参数ro=0。也许这是由于内核模块的初始化顺序。我通过将模块添加到黑名单并在/etc/rc.local. 因此,我设法模拟了读/写大容量存储。

所有步骤:

  1. 创建并格式化文件:
    # dd bs=1M if=/dev/zero of="/piusb.bin" count=2048
    # mkdosfs "/piusb.bin"
    
  2. 添加modules-load=dwc2,g_acm_ms到末尾/boot/cmd_line.txt(之后rootwait
  3. 将字符串添加dtoverlay=dwc2/boot/config.txt
  4. 防止模块在启动时初始化:
    $ echo "blacklist g_acm_ms" | sudo tee -a "/etc/modprobe.d/blacklist-g_acm_ms.conf"
    
  5. /etc/rc.local在上面添加初始化exit 0
    # nano /etc/rc.local
    
  6. 添加字符串:
    /sbin/modprobe file=/piusb.bin removable=y ro=0 stall=0
    
  7. 重启系统:
    # reboot -h
    

PS:如果不想使用 USB 进行控制台输出,可以g_mass_storage使用g_acm_ms.

于 2020-12-27T20:58:39.223 回答