0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OpenWrt APK OPKG USBとディスク

0
Last updated at Posted at 2023-08-12

:flag_jp: Japanese notation

OpenWrt_icon.png

はじめに

記事について

USBとディスクのOpenWrt初期設定・運用ガイドです
インストールから各種設定、チューニングなどをまとめています

初心者対応構成

デバイスアクセス

PowerShellの開始

  • パワーシェル起動:キー入力:Win+x > a > はい
  • コンソールログイン (パワーシェル)
    ※192.168.1.1以外の場合、以下の形式で入力後にワンライナーを入力下さい
$ip="192.168.*.*"
  • コンソールログイン (192.168.1.1用)
    万能型ワンライナー
if(!$ip){$ip="192.168.1.1"}; ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=NUL -o GlobalKnownHostsFile=NUL -o HostKeyAlgorithms=+ssh-rsa -tt root@$ip

USB

ベース

opkg update
opkg install block-mount
opkg install kmod-usb-storage
opkg install kmod-usb-storage-uas
opkg install usbutils
opkg install gdisk
opkg install libblkid1
# USBポート_LEDトリガー
opkg install kmod-usb-ledtrig-usbport
opkg install luci-app-ledtrig-usbport
# reboot

ファイルシステム

#!/bin/sh
I18N="ja"
PKGS="dosfstools kmod-fs-vfat e2fsprogs kmod-fs-ext4 f2fs-tools kmod-fs-f2fs exfat-fsck kmod-fs-exfat ntfs-3g kmod-fs-ntfs3 hfsfsck kmod-fs-hfs kmod-fs-hfsplus"
UPDATE="${UPDATE:-$(command -v opkg && opkg update >&2; command -v apk && apk update >&2; echo 1)}"
command -v opkg && opkg install $PKGS 2>/dev/null
command -v apk && apk add $PKGS 2>/dev/null

ハードディスクアイドル

#!/bin/sh
I18N="ja"
PKGS="hdparm hd-idle luci-app-hd-idle luci-i18n-hd-idle-${I18N}"
UPDATE="${UPDATE:-$(command -v opkg && opkg update >&2; command -v apk && apk update >&2; echo 1)}"
command -v opkg && opkg install $PKGS 2>/dev/null
command -v apk && apk add $PKGS 2>/dev/null

USBドライブフォーマット

  • フラッシュメモリー(メモリースティック等)
mkfs.f2fs /dev/sda1
  • ハードディスク
mkfs.ext4 /dev/sda1

カスタムフィード

ディスクインフォ

#!/bin/sh

OPENWRT_RELEASE=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release 2>/dev/null | cut -d"'" -f2)
case "$OPENWRT_RELEASE" in
    19.*|20.*|21.*|22.*|23.*|24.*)
        API_PATH="24.10"
        PKG_EXT="ipk"
        ;;
    SNAPSHOT|25.*|26.*)
        API_PATH="25.12"
        PKG_EXT="apk"
        ;;
esac

PACKAGE_PATTERN="luci-app-disks-info"
API_URL="https://api.github.com/repos/gSpotx2f/packages-openwrt/contents/${API_PATH}"
DOWNLOAD_BASE_URL="https://raw.githubusercontent.com/gSpotx2f/packages-openwrt/master/${API_PATH}"
TMP_DIR="/tmp"

RESPONSE=$(wget --no-check-certificate -q -O - "$API_URL")
PACKAGE_NAME=$(echo "$RESPONSE" | jsonfilter -e '@[*].name' | grep "${PACKAGE_PATTERN}.*\.${PKG_EXT}" | head -n1)

wget --no-check-certificate -O ${TMP_DIR}/${PACKAGE_NAME} ${DOWNLOAD_BASE_URL}/${PACKAGE_NAME}
command -v opkg && opkg install ${TMP_DIR}/${PACKAGE_NAME}
command -v apk && apk add ${TMP_DIR}/${PACKAGE_NAME}
rm ${TMP_DIR}/${PACKAGE_NAME}

ディスクマン

#! /bin/sh
UPDATE="${UPDATE:-$(command -v opkg && opkg update >&2; command -v apk && apk update >&2; echo 1)}"
opkg install luci-compat
opkg install luci-lib-ipkg
opkg install parted
opkg install blkid
opkg install smartmontools
opkg install e2fsprogs
opkg install make
opkg install btrfs-progs # オプション
opkg install lsblk # オプション
opkg install mdadm # オプション
opkg install kmod-md-raid456 # オプション
opkg install kmod-md-linear # オプション
mkdir -p package/luci-app-diskman && \
wget https://raw.githubusercontent.com/lisaac/luci-app-diskman/master/applications/luci-app-diskman/Makefile -O package/luci-app-diskman/Makefile
mkdir -p package/parted && \
wget https://raw.githubusercontent.com/lisaac/luci-app-diskman/master/Parted.Makefile -O package/parted/Makefile

#compile package only
make package/luci-app-diskman/compile V=99

#compile
make menuconfig
#choose LuCI ---> 3. Applications  ---> <*> luci-app-diskman..... Disk Manager interface for LuCI ----> save
make V=99
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?