openWRT USB设备的自动挂载

已经挂载好的分区可以通过df -h来查看,连接的设备可以通过fdisk -l来查看。比如:


 root@OpenWrt:~# fdisk -l

Disk /dev/mtdblock0: 192 KiB, 196608 bytes, 384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mtdblock1: 64 KiB, 65536 bytes, 128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mtdblock2: 64 KiB, 65536 bytes, 128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mtdblock3: 15.7 MiB, 16449536 bytes, 32128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mtdblock4: 14.7 MiB, 15419904 bytes, 30117 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mtdblock5: 4.6 MiB, 4784128 bytes, 9344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 15.5 GiB, 16634675200 bytes, 32489600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x017e1ea1

Device    Boot Start       End   Blocks  Id System
/dev/sda1 *       64  32489599 16244768   b W95 FAT32


Disk /dev/sdb: 12 MiB, 12517376 bytes, 24448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device    Boot Start       End Blocks  Id System
/dev/sdb1         64     24447  12192   4 FAT16 <32M 

U盘就是其中的/dev/sda1 和/dev/sdb1 两个分区。把打的15G的分区挂在上,可以通过mount /dev/sda1 /mnt/udisk来挂在到目录下

自动挂载,可以通过两种方式:

1.直接修改/etc/config/fstab,添加:

config 'mount'

option 'device' '/dev/sda1'

option 'options' 'rw,sync'

option 'enabled_fsck' '0'

option 'enabled' '1'

option 'target' '/mnt/udsik'


2.通过UCI命令来完成,具体可以参考如下 start on boot章节:

http://wiki.openwrt.org/zh-cn/doc/howto/usb.storage

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值