Created
April 15, 2026 09:20
-
-
Save dubiao/d2ec2d23a68417d5171aa4d8b8e5752c to your computer and use it in GitHub Desktop.
将NTFS硬盘挂载为可写
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ "$1" = "-d" ] ; then | |
| dev=$2 | |
| volume=$3 | |
| diskutil info $dev|grep NTFS>/dev/null | |
| if [ $? -ne 0 ] ; then | |
| echo "最近挂载的磁盘:$dev 不是 NTFS 磁盘! 按 Return 键退出" | |
| read | |
| else | |
| diskutil umount $volume>/dev/null | |
| echo "请输入用户 ${USER} 的密码" | |
| sudo mkdir $volume | |
| sudo mount -t ntfs -o rw,auto,nobrowse $dev $volume>/dev/null 2>&1 | |
| if [ $? -ne 0 ] ; then | |
| echo "磁盘需要在Windows上经过检查、修复才能挂载为可写!" | |
| echo "按 Return 键退出" | |
| sudo umount $volume>/dev/null 2>&1 | |
| sudo rm -r $volume | |
| read | |
| exit | |
| fi | |
| open $volume | |
| echo "按 Return 键卸载 $volume" | |
| read | |
| until sudo umount $volume | |
| do | |
| echo "请先关掉正在占用 $volume 的程序,然后按 Return 键卸载 $volume" | |
| read | |
| done | |
| fi | |
| else | |
| N=1 | |
| `echo df`| while read myline | |
| do | |
| N=`expr $N + 1` | |
| if [ $N -gt 2 ] ; then | |
| dev=$myline | |
| volume=`echo ${dev##*% }|sed 's/\ /\\\ /g'` | |
| dev=${dev%% *} | |
| echo "~/ntfs.sh -d ${dev} ${volume}" | |
| fi | |
| done | |
| echo "复制你想挂载的一行参数, 记得用完后回这里卸载再推出" | |
| echo "~/ntfs.sh 为脚本所在路径 -d 为执行参数" | |
| fi | |
| exit |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
也可以安装 Mounty
执行三条命令:
The new version 2 of Mounty now acts as a graphical user interface for the third-party driver NTFS-3G. This brings the functionality back to macOS, but the installation is now a bit more complex. You need two additional pieces of software to use with Mounty 2: macFUSE and NTFS-3G for Mac.
新版本2的Mounty现在作为第三方驱动NTFS-3G的图形用户界面。这使功能回归macOS,但安装现在稍微复杂一些。您需要两件额外的软件才能使用Mounty 2:macFUSE和Mac的NTFS-3G。