[Share Experiences] 解决deepin访问windows的ntfs分区的只读问题(不用关闭快速启动)
Tofloor
poster avatar
偷捧时间煮酒喝
deepin
2022-09-01 20:06
Author

1.查看分区的UUID

首先找到只读状态的分区然后右键点击属性查看改分区的标识sdb4

截图_dde-file-manager_20220831181556.png

然后我们按ctrl+alt+T进入命令终端输入下面的命令回车:

blkid -s "UUID"

然后找到刚刚的分区sdb4的后面的就是UUID,复制UUID

截图_deepin-terminal_20220831181926.png

2.将管理员密码和分区UUID填写到shell脚本里

然后我们找个地方创建一个shell脚本remount.sh,我放在了这个路径/home/cattle/java/remount.sh,你们随意,然后按照下面图片要求填写UUID和登录系统的密码然后保存

截图_deepin-editor_20220831182437.png


#!/bin/bash

#双引号里面填写你的超级管理员密码
password="12345678"
#下面是填写你的磁盘分区的UUID,每一行填写一个双引号包裹。禁止填写windows的C系统盘的UUID
uuid_list=(
"C65628CCB773766F"
"7949867F6ED66948"
"0D6E308635C4725E"
"A6C31E97500CA60A"
)

for uuid in ${uuid_list[@]};
do
	device=`blkid -U $uuid`
	if [ ${#device} -gt 5 ];then
		echo $password | sudo -S ntfsfix $device
		echo $password | sudo -S mount -o remount,rw $device
	fi
done

3.制作开机自启
不知道为什么,我这里用rc.local的文件来开机自没有效果,你们可以试试。我这里用的是desktop来开机自启的。

按ctrl+alt+t进入命令终端然后我们输入下面的命令:

进入~/.config/autostart
cd ~/.config/autostart

创建remount.desktop文件并编辑

deepin-editor ./remount.desktop

把下面代码复制粘贴修改里面的shell脚本路径/home/cattle/java/remount.sh改成你自己的脚本路径

[Desktop Entry]
Name=remount
Type=Application
Exec=/home/cattle/java/remount.sh

截图_deepin-editor_20220901115952.png

然后保存。

给两个文件附加执行权限
sudo chmod +x /你的自己文件的路径/remount.sh

sudo chmod +x ~/.config/autostart/remount.desktop

然后关机开机测试一下有没有效果。
大佬可以自己优化一下脚本,这个无论是不是只读状态都会执行ntfsfix和mount命令。

Reply Favorite View the author
All Replies
jjcui8595
deepin
2022-09-01 21:08
#1

like

Reply View the author
xuqi
deepin testing team
2022-09-01 21:52
#2

kissing_heart

Reply View the author
SamLukeYes
deepin
2022-09-01 23:39
#3

开机启动系统服务正确的做法是写个 systemd service 并将其 enable,这样就不需要在脚本里写明文的密码了。rc.local 是前 systemd 时代的过时的东西了,不建议在以 systemd 为 init 程序的发行版上使用。

Reply View the author
偷捧时间煮酒喝
deepin
2022-09-02 06:47
#4
SamLukeYes

开机启动系统服务正确的做法是写个 systemd service 并将其 enable,这样就不需要在脚本里写明文的密码了。rc.local 是前 systemd 时代的过时的东西了,不建议在以 systemd 为 init 程序的发行版上使用。

谢谢指点

Reply View the author