USB ドライブの追加
パッケージ インストール
block-mount - ブロックマウント ([OpenWrt Wiki] Mounting Block Devices)
e2fsprogs - ext2 ファイルシステムユーティリティ
kmod-fs-ext4 - ext4 ファイルシステムをサポートするカーネルモジュール
kmod-usb-storage - USB Mass Storage デバイスをサポートするカーネルモジュール
kmod-usb2 - USB2 (EHCI) コントローラをサポートするカーネルモジュール
kmod-usb3 - USB3 (XHCI) コントローラをサポートするカーネルモジュール
# opkg update && opkg install block-mount e2fsprogs kmod-fs-ext4 kmod-usb-storage kmod-usb2 kmod-usb3
Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_core Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/base/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_base Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/base/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/luci/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_luci Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/luci/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/packages/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_packages Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/packages/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/routing/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_routing Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/routing/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/telephony/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_telephony Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/telephony/Packages.sig Signature check passed. Installing block-mount (2021-01-04-c53b1882-1) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/block-mount_2021-01-04-c53b1882-1_arm_cortex-a9.ipk Installing e2fsprogs (1.45.6-2) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/base/e2fsprogs_1.45.6-2_arm_cortex-a9.ipk Installing libcomerr0 (1.45.6-2) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/base/libcomerr0_1.45.6-2_arm_cortex-a9.ipk Installing libss2 (1.45.6-2) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/base/libss2_1.45.6-2_arm_cortex-a9.ipk Installing libext2fs2 (1.45.6-2) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/base/libext2fs2_1.45.6-2_arm_cortex-a9.ipk Installing kmod-fs-ext4 (5.4.188-1) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/kmod-fs-ext4_5.4.188-1_arm_cortex-a9.ipk Installing kmod-lib-crc16 (5.4.188-1) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/kmod-lib-crc16_5.4.188-1_arm_cortex-a9.ipk Installing kmod-crypto-hash (5.4.188-1) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/kmod-crypto-hash_5.4.188-1_arm_cortex-a9.ipk Installing kmod-crypto-crc32c (5.4.188-1) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/kmod-crypto-crc32c_5.4.188-1_arm_cortex-a9.ipk Installing kmod-usb-storage (5.4.188-1) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/kmod-usb-storage_5.4.188-1_arm_cortex-a9.ipk Installing kmod-scsi-core (5.4.188-1) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/kmod-scsi-core_5.4.188-1_arm_cortex-a9.ipk Package kmod-usb2 (5.4.188-1) installed in root is up to date. Installing kmod-usb3 (5.4.188-1) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/kmod-usb3_5.4.188-1_arm_cortex-a9.ipk Installing kmod-phy-bcm-ns-usb3 (5.4.188-1) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/kmod-phy-bcm-ns-usb3_5.4.188-1_arm_cortex-a9.ipk Configuring kmod-scsi-core. Configuring kmod-usb-storage. Configuring kmod-crypto-hash. Configuring kmod-phy-bcm-ns-usb3. Configuring kmod-lib-crc16. Configuring kmod-crypto-crc32c. Configuring block-mount. Configuring kmod-usb3. Configuring kmod-fs-ext4. Configuring libcomerr0. Configuring libss2. Configuring libext2fs2. Configuring e2fsprogs.
# ls -al /dev/sd*
brw------- 1 root root 8, 0 Aug 22 22:09 /dev/sda brw------- 1 root root 8, 1 Aug 22 22:09 /dev/sda1
gdisk - GPT 対応のディスク パーティショニング ツール
# opkg update && opkg install gdisk
Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_core Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/base/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_base Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/base/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/luci/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_luci Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/luci/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/packages/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_packages Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/packages/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/routing/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_routing Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/routing/Packages.sig Signature check passed. Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/telephony/Packages.gz Updated list of available packages in /var/opkg-lists/openwrt_telephony Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/telephony/Packages.sig Signature check passed. Installing gdisk (1.0.6-1) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/packages/arm_cortex-a9/packages/gdisk_1.0.6-1_arm_cortex-a9.ipk Installing libstdcpp6 (8.4.0-3) to root... Downloading https://downloads.openwrt.org/releases/21.02.3/targets/bcm53xx/generic/packages/libstdcpp6_8.4.0-3_arm_cortex-a9.ipk Configuring libstdcpp6. Configuring gdisk.
# gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.6 Warning: Partition table header claims that the size of partition table entries is 0 bytes, but this program supports only 128-byte entries. Adjusting accordingly, but partition table may be garbage. Warning: Partition table header claims that the size of partition table entries is 0 bytes, but this program supports only 128-byte entries. Adjusting accordingly, but partition table may be garbage. Partition table scan: MBR: MBR only BSD: not present APM: not present GPT: not present *************************************************************** Found invalid GPT and valid MBR; converting MBR to GPT format in memory. *************************************************************** Disk /dev/sda: 30183424 sectors, 14.4 GiB Model: USB Flash Disk Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 5BE1B0DB-D482-4871-B45D-3848D43639CB Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 30183390 Partitions will be aligned on 2048-sector boundaries Total free space is 4029 sectors (2.0 MiB) Number Start (sector) End (sector) Size Code Name 1 2048 30181375 14.4 GiB 0700 Microsoft basic data
# gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.6 Warning: Partition table header claims that the size of partition table entries is 0 bytes, but this program supports only 128-byte entries. Adjusting accordingly, but partition table may be garbage. Warning: Partition table header claims that the size of partition table entries is 0 bytes, but this program supports only 128-byte entries. Adjusting accordingly, but partition table may be garbage. Partition table scan: MBR: MBR only BSD: not present APM: not present GPT: not present *************************************************************** Found invalid GPT and valid MBR; converting MBR to GPT format in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing 'q' if you don't want to convert your MBR partitions to GPT format! *************************************************************** Command (? for help): p Disk /dev/sda: 30183424 sectors, 14.4 GiB Model: USB Flash Disk Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 82D735FF-88D8-4779-87A9-9BF0DCAC248C Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 30183390 Partitions will be aligned on 2048-sector boundaries Total free space is 4029 sectors (2.0 MiB) Number Start (sector) End (sector) Size Code Name 1 2048 30181375 14.4 GiB 0700 Microsoft basic data Command (? for help): d Using 1 Command (? for help): p Disk /dev/sda: 30183424 sectors, 14.4 GiB Model: USB Flash Disk Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 82D735FF-88D8-4779-87A9-9BF0DCAC248C Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 30183390 Partitions will be aligned on 2048-sector boundaries Total free space is 30183357 sectors (14.4 GiB) Number Start (sector) End (sector) Size Code Name Command (? for help): n Partition number (1-128, default 1): First sector (34-30183390, default = 2048) or {+-}size{KMGTP}: 34 Information: Moved requested sector from 34 to 2048 in order to align on 2048-sector boundaries. Use 'l' on the experts' menu to adjust alignment Last sector (2048-30183390, default = 30183390) or {+-}size{KMGTP}: Current type is 8300 (Linux filesystem) Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem' Command (? for help): p Disk /dev/sda: 30183424 sectors, 14.4 GiB Model: USB Flash Disk Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 82D735FF-88D8-4779-87A9-9BF0DCAC248C Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 30183390 Partitions will be aligned on 2048-sector boundaries Total free space is 2014 sectors (1007.0 KiB) Number Start (sector) End (sector) Size Code Name 1 2048 30183390 14.4 GiB 8300 Linux filesystem Command (? for help): w Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! Do you want to proceed? (Y/N): y OK; writing new GUID partition table (GPT) to /dev/sda. The operation has completed successfully.
root@TomoyanWRT-ow:~# mkfs.ext4 /dev/sda1
mke2fs 1.45.6 (20-Mar-2020) /dev/sda1 contains a ntfs file system Proceed anyway? (y,N) y Creating filesystem with 3772667 4k blocks and 944704 inodes Filesystem UUID: b993d801-42ca-4275-ab3f-ec29ecba4da1 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208 Allocating group tables: done Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done
root@TomoyanWRT-ow:~# block detect
config 'global' option anon_swap '0' option anon_mount '0' option auto_swap '1' option auto_mount '1' option delay_root '5' option check_fs '0' config 'mount' option target '/mnt/sda1' option uuid 'b993d801-42ca-4275-ab3f-ec29ecba4da1' option enabled '0'
root@TomoyanWRT-ow:~# block detect | uci import fstab
root@TomoyanWRT-ow:~# uci show fstab
fstab.@global[0]=global fstab.@global[0].anon_swap='0' fstab.@global[0].anon_mount='0' fstab.@global[0].auto_swap='1' fstab.@global[0].auto_mount='1' fstab.@global[0].delay_root='5' fstab.@global[0].check_fs='0' fstab.@mount[0]=mount fstab.@mount[0].target='/mnt/sda1' fstab.@mount[0].uuid='b993d801-42ca-4275-ab3f-ec29ecba4da1' fstab.@mount[0].enabled='0'
root@TomoyanWRT-ow:~# uci set fstab.@mount[0].enabled='1' && uci set fstab.@global[0].anon_mount='1' && uci commit fstab
root@TomoyanWRT-ow:~# uci show fstab
fstab.@global[0]=global fstab.@global[0].anon_swap='0' fstab.@global[0].auto_swap='1' fstab.@global[0].auto_mount='1' fstab.@global[0].delay_root='5' fstab.@global[0].check_fs='0' fstab.@global[0].anon_mount='1' fstab.@mount[0]=mount fstab.@mount[0].target='/mnt/sda1' fstab.@mount[0].uuid='b993d801-42ca-4275-ab3f-ec29ecba4da1' fstab.@mount[0].enabled='1'
root@TomoyanWRT-ow:~# /etc/init.d/fstab boot
block: No "mount.ubi" utility available block: mounting /dev/mtdblock4 (ubi) as /mnt/mtdblock4 failed (2) - No such file or directory
root@TomoyanWRT-ow:~# mount
/dev/root on /rom type squashfs (ro,relatime) proc on /proc type proc (rw,nosuid,nodev,noexec,noatime) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime) cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime) /dev/ubi0_1 on /overlay type ubifs (rw,noatime,assert=read-only,ubi=0,vol=1) overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work) tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000) debugfs on /sys/kernel/debug type debugfs (rw,noatime) none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700) /dev/sda1 on /mnt/sda1 type ext4 (rw,relatime)
root@TomoyanWRT-ow:~# df -h
Filesystem Size Used Available Use% Mounted on /dev/root 3.3M 3.3M 0 100% /rom tmpfs 123.5M 244.0K 123.3M 0% /tmp /dev/ubi0_1 16.8M 2.1M 13.8M 13% /overlay overlayfs:/overlay 16.8M 2.1M 13.8M 13% / tmpfs 512.0K 0 512.0K 0% /dev /dev/sda1 14.1G 40.0M 13.3G 0% /mnt/sda1