EMMC分区格式化
(2022-03-17 11:28:00)
#!/bin/sh #1.Determines whether the /data directory is mounted echo
"Determines whether the /data directory is mounted" if mountpoint
-q /data then echo "The /data directory has been mounted,will exit
the shell" exit else echo "The /data directory not mounted" fi
#2.Determine if /dev/mmcblk0p1 exists. If so, try mount it first
echo "Determine if /dev/mmcblk0p1 exists. If so, try mount it
first" if [ -e '/dev/mmcblk0p1' ] then echo "/dev/mmcblk0p1 already
exist!" echo "do- mount /dev/mmcblk0p1 /data" mount /dev/mmcblk0p1
/data if [ "$?" = 0 ] then echo "mount /dev/mmcblk0p1 /data
successful!!!" else echo "first mount failed,then do- mkfs.vfat -I
/dev/mmcblk0p1" mkfs.vfat -I /dev/mmcblk0p1 echo "do- mount
/dev/mmcblk0p1 /data" mount /dev/mmcblk0p1 /data fi exit fi
#3.Partition the disk at /dev/mmcblk0 echo "Partition the disk at
/dev/mmcblk0" echo "First enter: n" echo "Second enter: p" echo
"Third enter: 1" echo "Fourth enter: 1" echo "Five enter 120832"
echo "Six enter w" fdisk /dev/mmcblk0 << EOF n p 1 1 120832 w
EOF if [ "$?" = 0 ] then if [ -e '/dev/mmcblk0p1' ] then echo
"/dev/mmcblk0p1 exist!" else echo "/dev/mmcblk0p1 not exist!!!" fi
else echo "The fdisk command failed" exit fi #4.Format the
partition /dev/mmcblk0p1 and mount echo "Format the partition
/dev/mmcblk0p1 and mount" echo "do-- mkfs.vfat -I /dev/mmcblk0p1"
mkfs.vfat -I /dev/mmcblk0p1 echo "do-- mount /dev/mmcblk0p1 /data"
mount /dev/mmcblk0p1 /data
前一篇:C盘清理.bat
后一篇:EMMC分区格式化-new