openwrt如何挂载usb硬盘

1、设置源并更新
opkg update
2、安装USB驱动,这里是BCM4712芯片的,其他芯片自己查
opkg install kmod-usb-ohci
opkg install kmod-usb-storage
3、安装EXT3文件系统
opkg install kmod-fs-ext3
4、安装文件系统格式化及检查工具
opkg install e2fsprogs
5、插上USB硬盘,如果正确识别输入dmesg命令就可以查看到U盘信息,如/dev/scsi/host0/bus0/target0/lun0: p1等等
6、格式化USB硬盘,这里的part1代表第一分区
mke2fs -j /dev/scsi/host0/bus0/target0/lun0/part1
7、挂载USB硬盘
mount -t ext3 /dev/scsi/host0/bus0/target0/lun0/part1 /mnt
8、df一下应该就可以看到挂载的USB硬盘了
feidele
下面写一个启动脚本,让路由器在启动时自动挂载USB硬盘。
vim /etc/init.d/usbdisk
写入脚本:
#!/bin/sh /etc/rcmon
START=99
STOP=10
start()
{
mount-text3-onoatime/dev/scsi/host0/bus0/target0/lun0/part1/mnt
}
stop()
{
sync
umount/dev/scsi/host0/bus0/target0/lun0/part1
}
restart()
包装与食品机械
{
stop
start
}
加入可执行权限
chmod 755 /etc/init.d/usbdisk
加入到启动目录
ln -s /etc/init.d/usbdisk /etc/rc.d/S99usbdisk
恩,完事了
----以下是方法2-----------------------------------------------------------------------------
openwrt 自动挂载U盘、移动硬盘
2011年01月07日 星期五 21:35
openwrt 自动挂载U盘、移动硬盘
opkg update
opkg install kmod-usb-core
opkg install kmod-usb-ohci          #安装usb ohci控制器驱动
#opkg install kmod-usb-uhci      #UHCI USB控制器
opkg install kmod-usb2                #安装usb2.0
opkg install kmod-usb-storage    #安装usb存储设备驱动
opkg install kmod-fs-ext3              #安装ext3分区格式支持组件
食品科学
opkg install mount-utils                #挂载卸载工具
opkg install ntfs-3g                      #挂载NTFS
opkg install kmod-fs-vfat              #挂载FAT
opkg install block-mount
opkg install fdisk   
opkg install usbutils #安装了这个后可以用 lsusb
#U盘,移动硬盘自动挂载脚本
编辑/etc/hotplug.d/block/10-mount  (用winscp工具连接路由,编辑文件)
___________________________以下是文件内容_________________________________
#!/bin/sh
# Copyright (C)   (C)
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  #加运行权限
bootstrapping
这样就完成了自动挂载
插入USB硬盘后就会自动挂载
挂载Swap分区
###在/mnt/sda1/下创建一个64M的交换文件
dd if=/dev/zero of=/mnt/sda1/swapfile bs=1024 count=62142
###将这个交换文件用作Swap分区
mkswap /mnt/sda1/swapfile
qiushi
###启用活动分区
swapon /mnt/sda1/swapfile
###停止
swapoff /mnt/sda1/swapfile
openwrt 格盘
opkg update
opkg install e2fsprogs    #安装格盘软件
4 /dev/sda1      #格etx4
3 /dev/sda1      #格etx3
2 /dev/sda1      #格etx2
挂载windows共享文件 cifs 
opkg install kmod-nls-utf8
opkg install kmod-fs-cifs
mkdir /mnt/share
mount -t cifs //192.168.1.2/tool /mnt/share -o username=administrator,password=123456,,nounix,noserverino,iocharset=utf8

本文发布于:2024-09-22 22:38:44,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/164836.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:挂载   自动   安装   分区   U盘
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议