Make NTFS writable on macOS
发布于 7 年前 作者 helloyou2012 3848 次浏览 来自 分享

前言

NTFS 全称是 New Technology File System,是微软随 Windows NT 系统开发的文件系统,由于版权的问题 macOS 没有开放对 NTFS 的写权限。但是可以通过重新挂载打开写权限,方法如下:

  1. 列出所有的外接存储设备
$ diskutil list external
/dev/disk2 (external, physical):
 #:                       TYPE NAME                    SIZE       IDENTIFIER
 0:     FDisk_partition_scheme                        *15.9 GB    disk2
 1:               Windows_NTFS DBand                   15.9 GB    disk2s1
  1. 解挂载然后重新挂载
# 解挂载
$ sudo diskutil umount /dev/disk2s1
# 重新挂载
$ sudo mount -o rw,auto,nobrowse -t ntfs /dev/disk2s1 /Volumes/DBand
# 打开
$ open /Volumes/DBand

写个小工具

虽然上述方法比较简单但是对于普通人操作起来还是比较麻烦的,而且每次都要输命令也比较麻烦。因此打算写个可视化的小工具。

第一步:列出所有的外接存储设备

通过 diskutil 可以查看存储设备的基本信息,我们简单的把他封装了下,项目地址:https://github.com/d-band/ls-usb

const getMediaList = require('ls-usb');

getMediaList()
  .then(data => {
    console.log(JSON.stringify(data, null, '  '));
  });

/*[{
  "udid": "disk2",
  "name": "UDisk",
  "type": "Generic",
  "node": "/dev/disk2",
  "size": "15.9 GB",
  "size_bytes": 4026531840,
  "volumes": [{
    "udid": "disk2s1",
    "mount": "/Volumes/DBand",
    "size": "15.9 GB",
    "size_bytes": 15938355200,
    "name": "DBand",
    "node": "/dev/disk2s1",
    "fs_type": "ntfs",
    "fs_name": "NTFS",
    "free": "15.9 GB",
    "free_bytes": 15938355200,
    "writable": false
  }]
}]*/

第二步:写个基于 Electron 的小工具

项目地址:https://github.com/d-band/disky

主要技术点:

  • Electron:跨平台桌面应用开发工具
  • dool:基于 Webpack 的打包工具
  • React:构建用户界面的 JavaScript 库
  • yax:基于 Redux 的状态容器
  • sudo-prompt:图形化的 sudo 提示框
# 全局安装 dool
$ npm i dool -g

# 安装项目依赖
$ npm i

# 运行 dool 编译 electron-renderer 相关文件
$ npm run dev

# 再打开一个 Tab 启动 electron
$ npm run start

附个图

image.png

6 回复

点赞,赶脚很实用啊

@aojiaotage 网上很多人都用 Paragon,写这个工具主要是因为 Paragon 收费而且卸载很麻烦~

默认不打开写不是版权问题,是可靠性问题,从前系统自带这个驱动写多了,总会碰到文件系统错乱的情况,现在不知道好点儿没。

@pinxue 可靠性应该是一个原因(Paragon 也是无法保证可靠的),但应该版权更重要些:https://discussions.apple.com/thread/660621?start=0&tstart=0

之前一直在用一个Python脚本,还不错,然后弄成了js版的,不过我怎么就忘了electron这么好的轮子。。。已star

@helloyou2012 呵呵,侵权可不分默认打开还是关闭。微软不提供 spec 确实是问题的根源,ntfs 实在太复杂了。

(I spoke to a number of people through differet channels at MS about this. It seems that they are unable to document the specification fully enough to be able to provide support. You can get enough information to create volumes and maybe read files but getting writing information seems very difficult. - https://social.msdn.microsoft.com/Forums/en-US/699e4f81-e54c-4326-b775-17c68526a1bd/licensing-the-ntfs-sepcifcation?forum=isv. )

回到顶部