#!/bin/bash # 定义分区和新的挂载点 PARTITION="/dev/mmcblk0p6" NEW_MOUNT_POINT="/root/apps" # 检查分区是否已经挂载 if mount | grep -q "$PARTITION"; then echo "分区 $PARTITION 已挂载." # 获取当前挂载点 CURRENT_MOUNT_POINT=$(mount | grep "$PARTITION" | awk '{print $3}') echo "分区 $PARTITION 当前挂载在 $CURRENT_MOUNT_POINT." # 卸载当前挂载点 echo "卸载 $CURRENT_MOUNT_POINT..." umount "$CURRENT_MOUNT_POINT" else echo "分区 $PARTITION 未挂载." fi # 创建新的挂载点 if [ ! -d "$NEW_MOUNT_POINT" ]; then echo "创建新的挂载点:$NEW_MOUNT_POINT" mkdir -p "$NEW_MOUNT_POINT" fi # 挂载分区到新的挂载点 echo "挂载分区 $PARTITION 到 $NEW_MOUNT_POINT" mount "$PARTITION" "$NEW_MOUNT_POINT" echo "分区 $PARTITION 已成功挂载到 $NEW_MOUNT_POINT." |
|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )
GMT+8, 2024-11-22 11:36
Powered by Discuz! X3.4
© 2001-2013 Comsenz Inc.