openwrt路由器 如何格式化u盘
发布网友
发布时间:2022-05-07 00:00
我来回答
共2个回答
热心网友
时间:2023-10-09 01:30
相应所需代码如下:
#!/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
备注:
#openwrt 格盘
#opkg update
#opkg install e2fsprogs #安装格盘软件
#mkfs.ext4 /dev/sda1 #格etx4
#mkfs.ext3 /dev/sda1 #格etx3
#mkfs.ext2 /dev/sda1 #格etx2
热心网友
时间:2023-10-09 01:30
需要安装这个包
e2fsprogs
然后就有你想用到工具了,比如mkfs.ext