[Share Experiences] 分区挂载的问题
Tofloor
poster avatar
zrtxh
deepin
2022-05-09 18:14
Author

20.6版能不能让分区不挂载容易操作点。比较WIN的系统分区我不想挂载还有启动分区都想隐藏了,可是 20.5太麻 烦了

Reply Favorite View the author
All Replies
zijinyise
deepin
2022-05-09 18:21
#1

文件管理器可以设置不显示挂载盘

Reply View the author
jjcui8595
deepin
2022-05-09 19:21
#2

创建一个脚本文件并执行,内容如下:

#!/bin/bash 

 

set -e

 

# 提供隐藏分区功能,支持备份,重启生效。因为是修改系统文件,所以需要提供sudo密码。

# 此功能修改文件,添加隐藏规则。

modify_diskrule () {

    echo "# hide $1" | sudo tee -a "$file2bemodified"

    echo -e "ENV{ID_FS_UUID}==\""${!#}"\", ENV{UDISKS_IGNORE}=\"1\"\n" | sudo tee -a "$file2bemodified"

    if [ $? -eq 0 ]; then

        echo "修改成功!"

    else

        echo "修改失败,试试手动修改?"

    fi

}

 

# 需要修改的系统文件路径。

file2bemodified="/etc/udev/rules.d/80-udisks2.rules"

 

# 把分区列表读进array。

readarray -t diskmenu < <(lsblk -l -o name,mountpoint,uuid | awk '$3>null')

 

# 显示提示,按数字键来选择要隐藏的分区,q 键退出,b 键备份。

echo "输入 2-${#diskmenu[@]} 来隐藏对应分区,q键退出,b键备份。重启之后即隐藏。"

# 创建选择菜单

select item in "${diskmenu[@]}"; do

    # 选择分区来隐藏

    if [[ "$REPLY" -ge 2 && "$REPLY" -le "${#diskmenu[@]}" ]]; then

        echo "$REPLY"

        modify_diskrule $item

        continue

    fi

    # 创建备份

    if [[ "$REPLY" =~ [b|B] ]]; then

        backupfile="${file2bemodified%/*}/$(date +%F-%H-%M-%S)_${file2bemodified##*/}.bakcup"

        sudo cp $file2bemodified $backupfile

        if [ -e "$backupfile" ]; then

            echo "备份成功。$bakcupfile"

        fi

    fi

    # 按q键退出

    if [[ "$REPLY" =~ [q|Q] ]]; then

        break

    fi

done

 

Reply View the author
[^_^]
deepin
2022-05-10 17:07
#3

自动挂载关了就行啊,需要用磁盘的时候手动双击就执行挂载了,对体验应该没啥影响。

Reply View the author