您的位置:首页 > 运维架构

openWRT USB设备的自动挂载

2014-11-11 13:45 429 查看
已经挂载好的分区可以通过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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: