#!/bin/sh # Copyright (C) 2011 OpenWrt.org sleep 10 #more apps installed, need more time to load kernel modules! 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 /dev/$device /mnt/$device elif [ "$isvfat" ]; then mount -o iocharset=utf8 /dev/$device /mnt/$device else mount /dev/$device /mnt/$device fi ;; remove) umount -l /dev/$device ;; esac fi
插拔硬盘之后会自动mount到/mnt/sda1目录下
1 2 3 4
# ls -l /mnt/sda1 drwxrwxrwx 1 root root 4096 Feb 20 08:46 nas drwxrwxrwx 1 root root 4096 Apr 10 2019 temp #