- 第一步:首先ssh到openwrt系统
- 输入以下命令
- opkg update
- opkg install kmod-usb-ohci kmod-usb2 kmod-usb-storage
- opkg install kmod-fs-ext3 ntfs-3g kmod-fs-vfat
- opkg install mount-utils
- 第二步:在/etc/hotplug.d/block/下新建10-mount文件,输入以下内容:
- #!/bin/sh
-
- # Copyright (C) 2009 OpenWrt.org (C) 2010 OpenWrt.org.cn
-
- blkdev=`dirname $DEVPATH`
- if [ `basename $blkdev` != "block" ]; then
-
- device=`basename $DEVPATH`
- case "$ACTION" in
- add)
- mkdir -p /mnt/$device
- # vfat & ntfs-3g check
- if [ `which fdisk` ]; then
- isntfs=`fdisk -l | grep $device | grep NTFS`
- isvfat=`fdisk -l | grep $device | grep FAT`
- isfuse=`lsmod | grep fuse`
- isntfs3g=`which ntfs-3g`
- else
- isntfs=""
- isvfat=""
- fi
-
- # mount with ntfs-3g if possible, else with default mount
- if [ "$isntfs" -a "$isfuse" -a "$isntfs3g" ]; then
- ntfs-3g -o nls=utf8 /dev/$device /mnt/$device
- elif [ "$isvfat" ]; then
- mount -t vfat -o iocharset=utf8,rw,sync,umask=0000,dmask=0000,fmask=0000 /dev/$device /mnt/$device
- else
- mount /dev/$device /mnt/$device
- fi
- if [ -f /dev/${device}/swapfile ]; then
- mkswap /dev/${device}/swapfile
- swapon /dev/${device}/swapfile
- fi
- ;;
- remove)
- if [ -f /dev/${device}/swapfile ]; then
- swapoff /dev/${device}/swapfile
- fi
- umount /dev/$device
- ;;
- esac
-
- fi
- 第三步:chmod 777 /etc/hotplug.d/block/10-mount
- 然后重新启动路由器 就好了!
复制代码- root@OpenWrt:~# mount
- rootfs on / type rootfs (rw)
- /dev/root on /rom type squashfs (ro,relatime)
- proc on /proc type proc (rw,noatime)
- sysfs on /sys type sysfs (rw,noatime)
- tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=30852k)
- tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
- devpts on /dev/pts type devpts (rw,noatime,mode=600)
- /dev/mtdblock7 on /overlay type jffs2 (rw,noatime)
- overlayfs:/overlay on / type overlayfs (rw,noatime,lowerdir=/,upperdir=/overlay)
- debugfs on /sys/kernel/debug type debugfs (rw,relatime)
- none on /proc/bus/usb type usbfs (rw,relatime)
- /dev/sda1 on /mnt/sda1 type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
- root@OpenWrt:~# df -h
- Filesystem Size Used Available Use% Mounted on
- rootfs 28.7M 1.6M 27.1M 6% /
- /dev/root 2.0M 2.0M 0 100% /rom
- tmpfs 30.1M 380.0K 29.8M 1% /tmp
- tmpfs 512.0K 0 512.0K 0% /dev
- /dev/mtdblock7 28.7M 1.6M 27.1M 6% /overlay
- overlayfs:/overlay 28.7M 1.6M 27.1M 6% /
- /dev/sda1 30.8G 3.8G 27.0G 12% /mnt/sda1
- root@OpenWrt:~# cd /mnt/sda1/
- root@OpenWrt:/mnt/sda1# ls
- System Volume Information cn_windows_8_1_pro_vl_x64_dvd_2971907.iso
- TDDOWNLOAD minidlna
- ThunderDB
复制代码 |