OpenWRT挂载U盘
2015-07-10 10:08
1916 查看
需要选中的包有:Kernel modules ---> USB Support --->
选中上面的包就可以识别USB设备了,然后挂载需要识别文件系统: Kernel modules --->Filesystems --->
选中上面就支持NTFS的文件系统了,只要插上U盘就会自动挂载到mnt目录下。此外,还需要选中语言支持,否则会有挂载警告。===========================================================================================从网上了解到,NTFS文件系统挂载后不可写:
[/code]我们需要用到ntfs-3g的文件系统。我们先把NTFS的选项取消,然后重新选择NTFS-3g的选项。Utilities ---> Filesystem --->
烧录完成后,在系统中看不到ntfs-3g的文件系统选项,但是这个文件格式还是可以用的,就是需要先取消挂载:
[/code]如果想要自动挂载,那么需要修改系统脚本:
[/code]config配置文件
然后,这个自动挂载的脚本我们最后用补丁的形式打到系统中,可以将这个补丁放到Zigbee的补丁目录下,在编译网关的时候将补丁打进去。
------------------------------------------------------------y
遇到一个问题,U盘在挂载后中文乱码,
[/code]
来自为知笔记(Wiz)
选中上面的包就可以识别USB设备了,然后挂载需要识别文件系统: Kernel modules --->Filesystems --->
选中上面就支持NTFS的文件系统了,只要插上U盘就会自动挂载到mnt目录下。此外,还需要选中语言支持,否则会有挂载警告。===========================================================================================从网上了解到,NTFS文件系统挂载后不可写:
'/etc/config/fstab'配置文件定义了系统启动时将要激活的静态文件系统和交换分区。 注意在系统启动时,包含这些文件系统和交换分区的磁盘必须是可用的,否则就只能在启动后进行手动挂载。 同样,用于加载特定文件系统的模块必须被安装或者加载到内核。 这些模块的名称可以是kmod-fs-ext3, kmod-fs-ext4, kmod-fs-vfat等。切记ntfs文件系统仍然是闭源的,并且通过kmod-fs-ntfs只能对ntfs分区进行读操作,如要进行写操作,还需要安装ntfs-3g。
[/code]我们需要用到ntfs-3g的文件系统。我们先把NTFS的选项取消,然后重新选择NTFS-3g的选项。Utilities ---> Filesystem --->
烧录完成后,在系统中看不到ntfs-3g的文件系统选项,但是这个文件格式还是可以用的,就是需要先取消挂载:
root@OpenWrt:/#ls mnt/sda1/
root@OpenWrt:/#umount /dev/sda1
umount: can't umount /dev/sda1: Invalid argument
root@OpenWrt:/#mount -t ntfs-3g /dev/sda1 /mnt/sda1/
The disk contains an unclean file system (0, 0).
The file system wasn't safely closed on Windows. Fixing.
^C
root@OpenWrt:/#umount /dev/sda1
umount: can't umount /dev/sda1: Invalid argument
root@OpenWrt:/#mount -t ntfs-3g /dev/sda1 /mnt/sda1/
root@OpenWrt:/#
root@OpenWrt:/#ls /mnt/sda1/
README mt7621_ddr_param.txt readme.txt
mkconfig mt7621_stage_sram.bin uboot_version.h
mt7621_ddr.sh pct 鏂板缓鏂囦欢澶[0m
root@OpenWrt:/#
[/code]如果想要自动挂载,那么需要修改系统脚本:
#U盘,移动硬盘自动挂载脚本
编辑/etc/hotplug.d/block/10-mount (用winscp工具连接路由,编辑文件)
___________________________以下是文件内容_________________________________
#!/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 #加运行权限
这样就完成了自动挂载
插入USB硬盘后就会自动挂载
[/code]config配置文件
然后,这个自动挂载的脚本我们最后用补丁的形式打到系统中,可以将这个补丁放到Zigbee的补丁目录下,在编译网关的时候将补丁打进去。
------------------------------------------------------------y
遇到一个问题,U盘在挂载后中文乱码,
sda1:
README mt7621_ddr_param.txt uboot_version.h
a mt7621_stage_sram.bin 鏂板缓鏂囦欢澶[0m
mkconfig pct
mt7621_ddr.sh readme.txt
[/code]
来自为知笔记(Wiz)
附件列表
相关文章推荐
- linux清除缓存
- MyEclipse8.5集成Tomcat7
- Linux中查找最耗性能的JAVA代码
- 在 RHEL/CentOS 7.0 中安装 LAMP
- Nginx+Keepalived实现站点高可用[z]
- Linux的Cgroup<实例详解>
- Tomcat的三种运行模式
- Linux下暴力破解工具Hydra详解
- linux 内存管理
- 提升网站性能之设置gzip
- Linux 安装
- hadoop知识之fsimage和editlog
- hadoop知识之fsimage和editlog
- Linux菜鸟学习笔记
- Linux中iptables设置详细
- Java学习的30个目标以及系统架构师推荐的书 .
- Shell Script基本语言
- [转载] 【冬瓜哥手绘雄文】集群文件系统架构演变终极深度梳理图解
- Linux:no link present,check cable
- 每天进步一点点——linux——sed