开启macOS的原生写入Ntfs的功能

在使用原生写入Ntfs功能前,测试了第三方的ntfs-3g的方案超级不稳定,害怕数据丢失果断放弃.

基于osxfuse的ntfs-3g:https://github.com/osxfuse/osxfuse/wiki/NTFS-3G


 方案一

  1.打开终端

    sudo mkdir /Volumes/ntfs 

    sudo mount_ntfs -o rw,auto,nobrowse /dev/disk2s1 /Volumes/ntfs

   2.可以方便的进入写入操作了,可以在Findar中shift+command+g,查找/Volumes,或者开启隐藏文件夹显示shift+command+.然后进入/Volumes文件夹,也可以创建桌面的软连接

    sudo ln -s /Volumes/ ~/Desktop/Volumes

   3.unmount系统默认挂载的ntfs分区的Shell脚本:

 1 #!/bin/bash
 2 
 3 #Check sudo
 4 if [[ $(/usr/bin/id -u) -ne 0 ]]; then
 5     echo "This script should be run as ROOT. Try sudo"
 6     exit
 7 fi
 8 echo "___________________________________"
 9 echo "umount all ntfs disk on this system"
10 echo ""
11 
12 for FILENAME in "/Volumes"/*
13 do
14     filetype=$(diskutil info "$FILENAME" | grep "Type (Bundle):" | cut -d ':' -f2 | tr -d ' ')
15     if [ "$filetype" = "ntfs" ]; then
16         uuid=$(diskutil info "$FILENAME" | grep UUID | cut -d ':' -f2 | tr -d ' ')
17         # volumeName=$(diskutil info "$FILENAME" | grep "Volume Name" | cut -d ':' -f2 | tr -d ' ')
18         device=$(diskutil info "$FILENAME" | grep "Device Node" | cut -d ':' -f2 | tr -d ' ')
19         echo Now unmounting the device name [$device] the uuid [$uuid];
20         diskutil unmount "$FILENAME"
21     fi
22 done

 方案二

  编辑/etc/fstab文件

    sudo vim /etc/fstab

    UUID=C627AE3A-AC93-4258-87E2-17DAB9579F6A none ntfs ro,auto,nobrowse

    LABEL=Windows_NTFS_A none ntfs rw,auto,nobrowse

    LABEL=Windows_NTFS_B none ntfs rw,auto,nobrowse

    LABEL=Windows_NTFS_C none ntfs rw,auto,nobrowse

posted @ 2018-06-14 17:46  非法关键字  阅读(2987)  评论(0编辑  收藏  举报