1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Raspberry Pi Zero WをUSBマスストレージとして使ってみよう

Last updated at Posted at 2019-05-19

メモ。

rpi-update

#files

root@raspberrypihani:/home/pi# ls
mountimg.sh  mountusb.sh  storage1.img  umountusb.sh
"linux.yebisu.jp/memo/1160"
dd if=/dev/zero of=/home/pi/storage1.img bs=1M count=20480
losetup -o 1024k /dev/loop0 /home/pi/storage1.img
mkfs.vfat /dev/loop0
losetup -d /dev/loop0
sync
sync
sync
root@raspberrypihani:/home/pi# cat mountusb.sh
modprobe g_mass_storage file=/home/pi/storage1.img stall=0 removable=1 nofua=1  buflen=6553600
#キャッシュが足らないと、転送速度が0kb/sにdropする。
root@raspberrypihani:/home/pi# cat umountusb.sh
rmmod g_mass_storage

root@raspberrypihani:/home/pi# cat mountimg.sh
 mount -t vfat -o loop storage1.img /mnt

###cmdline.txt

root@raspberrypihani:/boot# cat cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=a262b738-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_mass_storage

###config.txt

・・・・追記
enable_uart=1
dtoverlay=dwc2
dr_mode=peripheral

#ベンチマーク
##MicroSD
image.png

##USBOTG
image.png

元のSDカードが悪い場合、USBOTGのほうがパフォーマンスがあがります。

#Chromeを動かす
image.png

#Todo
・Google driveやFTPとのsync (skicka rclone Grive2)
・ディスクの暗号化
・パスワードでの解除
・shellを見る
・共用パソコンでもcom接続

#Ref
https://qiita.com/mt08/items/838a2a0e42d4dbc9fba7
https://linux.yebisu.jp/memo/1160
https://www.raspberrypi.org/forums/viewtopic.php?t=154384
https://stackoverflow.com/questions/44053344/g-multi-mode-mass-storage-ethernet-not-working-on-raspberry-pi-zero-w
https://www.raspberrypi.org/forums/viewtopic.php?t=196628
https://raspberrypi.stackexchange.com/questions/79699/g-mass-storage-on-rpi-zerow-is-readonly-use-as-usb-stick
https://stackoverflow.com/questions/18606393/very-low-performance-of-g-mass-storage-virtual-usb-device

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?