Mac下如何不借助第三方工具實現NTFS分區的可寫掛載


問題背景

我想很多使用Mac的同學都會遇到讀寫NTFS磁盤的問題,因為默認情況下Mac OSX對NTFS磁盤的掛載方式是只讀(read-only)的,因此把一個NTFS格式的磁盤插入到Mac上,是只能讀不能寫的,用起來很是不便。

因此也就出現了一些第三方工具,例如Tuxera NTFS for Mac、Paragon NTFS for MAC等,這些工具都可以實現Mac下NTFS的寫操作,但是這些工具都是收費的,當然也有些破解的版本,但是破解軟件畢竟存在安全風險,so,I don't really like that.

此外Tuxera也提供了開源的NTFS讀寫方案:NTFS-3G,基於GPL授權的NTFS-3G也可以通過用戶空間文件系統在Mac OS X上實現NTFS分區的讀寫。這個方案也比較不錯,只是需要簡單的安裝,本文不再展開。具體的可以參考官方鏈接:http://www.tuxera.com/community/open-source-ntfs-3g/

但其實,我們完全可以不借助任何第三方工具就能解決這個問題,因為其實OSX原生就是支持NTFS的。后來由於微軟的限制,蘋果把這個功能給屏蔽了,但是我們可以通過命令行手動打開這個選項。

 

How to do that?

mount查看磁盤掛載情況

thatsitdeMacBook-Pro:~ thatsit$ mount
/dev/disk4s2 on /Volumes/Untitled (ntfs, local, nodev, nosuid, read-only, noowners)
thatsitdeMacBook-Pro:~ thatsit$

 

這時候如果我們要實現/dev/disk4s1分區的可寫掛載,我們只需要做做一下兩個步驟:卸載、重新掛載

卸載

thatsitdeMacBook-Pro:~ thatsit$ sudo umount /Volumes/Untitled/

重新掛載

thatsitdeMacBook-Pro:~ thatsit$ sudo mount -t ntfs -o rw,auto,nobrowse /dev/disk4s2 /Volumes/Udisk/

  

這時候/dev/disk4s2已經以讀寫的方式掛載到/Volumes/Udisk/了,下面我們來進行掛載結果的確認

確認掛載

thatsitdeMacBook-Pro:~ thatsit$ mount|grep ntfs
/dev/disk4s2 on /Volumes/Udisk (ntfs, local, noowners, nobrowse)
thatsitdeMacBook-Pro:~ thatsit$

測試寫入

thatsitdeMacBook-Pro:~ thatsit$ cd /Volumes/Udisk/
thatsitdeMacBook-Pro:Udisk thatsit$ touch test_writing
thatsitdeMacBook-Pro:Udisk thatsit$ ll|grep test_writing 
-rwxr-xr-x 1 thatsit staff 0 12 24 17:14 test_writing
thatsitdeMacBook-Pro:Udisk thatsit$ 
thatsitdeMacBook-Pro:Udisk thatsit$ echo heheda >> test_writing 
thatsitdeMacBook-Pro:Udisk thatsit$ cat test_writing 
heheda
thatsitdeMacBook-Pro:Udisk thatsit$ 
thatsitdeMacBook-Pro:Udisk thatsit$ ll|grep test_writing 
-rwxr-xr-x 1 thatsit staff 7 12 24 17:15 test_writing
thatsitdeMacBook-Pro:Udisk thatsit$

上述掛載參數的詳細說明:

mount -t ntfs -o rw,auto,nobrowse /dev/disk4s2 /Volumes/Udisk/

-t ntfs # 執行要掛載的分區文件系統格式
-o # 執行掛載的選項
rw # read-write,以讀寫的方式掛載
auto # 自動檢測文件系統,此參數可以省略
nobrowse # 這個選項非常重要,因為這選項指明了在finder里不顯示這個分區,只有打開了這個選項才能將磁盤以讀寫的方式進行掛載
/dev/disk4s2 # 要掛載的分區,也就是我們在mount命令中看到的盤符
/Volumes/Udisk/ # 掛載點

* /Volumes/Udisk這個目錄是需要存在的,如果不存在需要手動創建下:sudo mkdir /Volumes/Udisk
* 如果目錄不存在會收到如下報錯:
mount: realpath /Volumes/Udisk: No such file or directory

  

通過上面的測試大家也看到了,此時的NTFS分區已經是可寫的了;但是這個時候還存在另一個小問題,因為我們在掛載的時候使用nobrowse選項,這個分區在finder里是不顯示的。

總會有些同學不習慣一直使用命令行進行操作,所以需要高解決這個問題:
解決辦法其實很簡單,因為這個分區是掛/Volumes下的,我們把這個目錄在桌面做一個軟鏈接就OK了。

創建軟鏈接

thatsitdeMacBook-Pro:Udisk thatsit$ sudo ln -s /Volumes/Udisk/ ~/Desktop/Udisk
Password: # <----輸入用戶密碼
thatsitdeMacBook-Pro:Udisk thatsit$

效果如下:桌面上會顯示如下的盤符,點擊即可進入Finder

 

----Done----

參考鏈接:
https://zh.wikipedia.org/wiki/NTFS

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM