WIFIHELL - 科技改变生活

 找回密码
 注册WIFIHELL

QQ登录

只需一步,快速开始

开启左侧

[其它] OPENWRT自动挂载U盘/WZR-HP-G450H/R36088测试成功

[复制链接]
222ba 发表于 2014-3-26 22:19:55 | 显示全部楼层 |阅读模式

注册WIFIHELL,浏览更多技术贴!

您需要 登录 才可以下载或查看,没有账号?注册WIFIHELL

x
  1. 第一步:首先ssh到openwrt系统
  2. 输入以下命令
  3. opkg update
  4. opkg install kmod-usb-ohci kmod-usb2 kmod-usb-storage      
  5. opkg install kmod-fs-ext3 ntfs-3g kmod-fs-vfat
  6. opkg install mount-utils

  7. 第二步:在/etc/hotplug.d/block/下新建10-mount文件,输入以下内容:

  8. #!/bin/sh

  9. # Copyright (C) 2009 OpenWrt.org  (C) 2010 OpenWrt.org.cn

  10. blkdev=`dirname $DEVPATH`
  11. if [ `basename $blkdev` != "block" ]; then

  12.     device=`basename $DEVPATH`
  13.     case "$ACTION" in
  14.         add)
  15.                 mkdir -p /mnt/$device
  16.                 # vfat & ntfs-3g check
  17.                 if  [ `which fdisk` ]; then
  18.                         isntfs=`fdisk -l | grep $device | grep NTFS`
  19.                         isvfat=`fdisk -l | grep $device | grep FAT`
  20.                         isfuse=`lsmod | grep fuse`
  21.                         isntfs3g=`which ntfs-3g`
  22.                 else
  23.                         isntfs=""
  24.                         isvfat=""
  25.                 fi

  26.                 # mount with ntfs-3g if possible, else with default mount
  27.                 if [ "$isntfs" -a "$isfuse" -a "$isntfs3g" ]; then
  28.                         ntfs-3g -o nls=utf8 /dev/$device /mnt/$device
  29.                 elif [ "$isvfat" ]; then
  30.                         mount -t vfat -o iocharset=utf8,rw,sync,umask=0000,dmask=0000,fmask=0000 /dev/$device /mnt/$device
  31.                 else
  32.                         mount /dev/$device /mnt/$device
  33.                 fi
  34.   if [ -f /dev/${device}/swapfile ]; then
  35.    mkswap /dev/${device}/swapfile
  36.    swapon /dev/${device}/swapfile
  37.   fi
  38.                 ;;
  39.         remove)
  40.   if [ -f /dev/${device}/swapfile ]; then
  41.    swapoff /dev/${device}/swapfile
  42.   fi
  43.                 umount /dev/$device
  44.                 ;;
  45.     esac

  46. fi


  47. 第三步:chmod 777 /etc/hotplug.d/block/10-mount
  48. 然后重新启动路由器  就好了!
复制代码
  1. root@OpenWrt:~# mount
  2. rootfs on / type rootfs (rw)
  3. /dev/root on /rom type squashfs (ro,relatime)
  4. proc on /proc type proc (rw,noatime)
  5. sysfs on /sys type sysfs (rw,noatime)
  6. tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=30852k)
  7. tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
  8. devpts on /dev/pts type devpts (rw,noatime,mode=600)
  9. /dev/mtdblock7 on /overlay type jffs2 (rw,noatime)
  10. overlayfs:/overlay on / type overlayfs (rw,noatime,lowerdir=/,upperdir=/overlay)
  11. debugfs on /sys/kernel/debug type debugfs (rw,relatime)
  12. none on /proc/bus/usb type usbfs (rw,relatime)
  13. /dev/sda1 on /mnt/sda1 type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
  14. root@OpenWrt:~# df -h
  15. Filesystem                Size      Used Available Use% Mounted on
  16. rootfs                   28.7M      1.6M     27.1M   6% /
  17. /dev/root                 2.0M      2.0M         0 100% /rom
  18. tmpfs                    30.1M    380.0K     29.8M   1% /tmp
  19. tmpfs                   512.0K         0    512.0K   0% /dev
  20. /dev/mtdblock7           28.7M      1.6M     27.1M   6% /overlay
  21. overlayfs:/overlay       28.7M      1.6M     27.1M   6% /
  22. /dev/sda1                30.8G      3.8G     27.0G  12% /mnt/sda1
  23. root@OpenWrt:~# cd /mnt/sda1/
  24. root@OpenWrt:/mnt/sda1# ls
  25. System Volume Information                  cn_windows_8_1_pro_vl_x64_dvd_2971907.iso
  26. TDDOWNLOAD                                 minidlna
  27. ThunderDB
复制代码
WIFIHELL | 万丰乐活 2020开启新的征程,好货不断!
liuzai6 发表于 2014-11-30 11:31:00 | 显示全部楼层
好难看懂  好多参数
WIFIHELL | 万丰乐活 2020开启新的征程,好货不断!
关闭

站点推荐上一条 /1 下一条

万丰乐活

GMT+8, 2024-3-29 02:59

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表