在macOS使用ntfs格式硬盘方法
Published in:2025-02-25 |
Words: 1.8k | Reading time: 8min | reading:

在macOS使用ntfs格式硬盘方法

1. FAT32 (File Allocation Table 32-bit)

  • 历史: FAT32 是 FAT 文件系统家族的一员,是 FAT16 的后继者。它在 Windows 95 OSR2 中首次引入,旨在克服 FAT16 的一些限制。
  • 结构: FAT32 文件系统使用文件分配表 (FAT) 来跟踪磁盘上的文件和目录。FAT 表实际上是一个索引表,记录了磁盘上每个簇(cluster,磁盘上最小的存储单元)的使用情况。
  • 特点:
    • 兼容性好: FAT32 得到了广泛的支持,几乎所有的操作系统和设备(包括 Windows、macOS、Linux、嵌入式系统、游戏机等)都可以读取和写入 FAT32 格式的磁盘。
    • 简单易用: FAT32 的结构比较简单,实现起来也相对容易。
  • 缺点:
    • 最大文件尺寸限制: FAT32 文件系统对单个文件的大小有限制,最大不能超过 4GB。 这使得它无法存储高清视频、大型数据库文件等。
    • 最大分区尺寸限制: 虽然理论上 FAT32 可以支持最大 8TB 的分区,但实际上由于一些操作系统(特别是 Windows)的限制,FAT32 分区通常限制在 32GB。
    • 安全性较差: FAT32 不支持文件权限、加密等安全特性。
    • 可靠性较低: FAT32 的元数据(FAT 表)通常只有一个副本,一旦损坏,可能会导致数据丢失。
  • 适用场景:
    • 移动存储设备: 比如 U 盘、SD 卡等,如果不需要存储超过 4GB 的单个文件,并且需要在多个操作系统或设备上使用,FAT32 是一个不错的选择。
    • 嵌入式系统: 一些嵌入式设备仍然使用 FAT32,因为它的实现简单且资源占用较少。
    • 老旧操作系统: 对于一些老旧的操作系统,可能只能支持 FAT32 格式。

2. NTFS (New Technology File System)

  • 历史: NTFS 是微软为 Windows NT 系列操作系统设计的现代文件系统,旨在取代 FAT 文件系统。它首次出现在 Windows NT 3.1 中,并在后续的 Windows 版本中得到了广泛应用。
  • 结构: NTFS 使用主文件表 (MFT, Master File Table) 来管理磁盘上的文件和目录。MFT 类似于一个数据库,记录了每个文件和目录的元数据(大小、创建时间、权限等)以及数据存储位置。
  • 特点:
    • 支持大文件和分区: NTFS 没有 4GB 的文件尺寸限制,可以存储大型文件。 NTFS 可以支持非常大的分区(理论上可达 256TB),但实际受操作系统限制。
    • 安全性高: NTFS 支持文件权限管理,可以控制用户对文件和目录的访问权限。 它还支持加密文件系统 (EFS),可以对文件进行加密存储。
    • 可靠性高: NTFS 具有日志功能,可以记录文件系统的操作,并在系统崩溃后进行恢复,从而保证数据的完整性。 NTFS 的元数据(MFT)通常有多个副本,可以提高容错能力。
    • 高级特性: NTFS 支持磁盘配额、压缩、稀疏文件、符号链接等高级特性。
  • 缺点:
    • 兼容性稍差: 虽然 Windows 操作系统对 NTFS 的支持非常好,但 macOS 和 Linux 对 NTFS 的支持可能存在一些问题。 在 macOS 上,默认只能读取 NTFS 格式的磁盘,无法写入。 在 Linux 上,虽然可以通过安装驱动程序来支持 NTFS 的读写,但性能可能不如在 Windows 上。
    • 实现复杂: NTFS 的结构比 FAT32 复杂得多,实现起来也比较困难。
  • 适用场景:
    • Windows 操作系统: NTFS 是 Windows 操作系统的默认文件系统,用于系统盘和数据盘。
    • 需要存储大文件的场合: 比如高清视频编辑、大型数据库服务器等。
    • 对数据安全性有较高要求的场合: 比如企业服务器、存储敏感数据的磁盘等。
    • 需要使用 NTFS 高级特性的场合: 比如磁盘配额、压缩等。

brew

install

  • script example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash

# 设置脚本遇到错误时退出
set -e

# 定义颜色
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

# 检查是否为 macOS
if [[ "$(uname)" != "Darwin" ]]; then
echo -e "${RED}This script is intended for macOS only.${NC}"
exit 1
fi

# 检查是否已安装 Homebrew
if ! command -v brew &> /dev/null; then
echo -e "${YELLOW}Homebrew is not installed. Installing...${NC}"
/bin/bash -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to install Homebrew. Please install it manually and then rerun this script.${NC}"
exit 1
fi
echo -e "${GREEN}Homebrew installed successfully!${NC}"
else
# 更新 Homebrew
echo -e "${YELLOW}Updating Homebrew...${NC}"
brew update
if [ $? -ne 0 ]; then
echo -e "${RED}Warning: Failed to update Homebrew. Continuing anyway...${NC}"
fi
fi


# 安装 FFmpeg
if ! brew list --versions ffmpeg &> /dev/null; then
echo -e "${YELLOW}Installing FFmpeg...${NC}"
brew install ffmpeg
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to install FFmpeg.${NC}"
exit 1
fi
echo -e "${GREEN}FFmpeg installed successfully!${NC}"
else
echo -e "${YELLOW}FFmpeg is already installed. Skipping...${NC}"
fi

# 安装 macFUSE, ntfs-3g-mac 和 Mounty (用于 NTFS 写入支持)
# see https://mounty.app/#installation

# macFUSE (Cask)
if ! brew list --cask --versions macfuse &> /dev/null; then
echo -e "${YELLOW}Installing macFUSE...${NC}"
brew install --cask macfuse
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to install macFUSE. You may need to install it manually from https://osxfuse.github.io/. Continuing...${NC}"
fi
else
echo -e "${YELLOW}macFUSE is already installed. Skipping...${NC}"
fi

# ntfs-3g-mac (Formula)
if ! brew list --versions ntfs-3g-mac &> /dev/null; then
echo -e "${YELLOW}Installing ntfs-3g-mac...${NC}"
brew install gromgit/fuse/ntfs-3g-mac
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to install ntfs-3g-mac. This may cause issues with writing to NTFS drives. Continuing...${NC}"
fi
else
echo -e "${YELLOW}ntfs-3g-mac is already installed. Skipping...${NC}"
fi

# Mounty (Cask)
if ! brew list --cask --versions mounty &> /dev/null; then
echo -e "${YELLOW}Installing Mounty...${NC}"
brew install --cask mounty
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to install Mounty. You may need to manually mount NTFS drives. Continuing...${NC}"
fi
else
echo -e "${YELLOW}Mounty is already installed. Skipping...${NC}"
fi

echo -e "${GREEN}Installation complete!${NC}"
echo -e "${YELLOW}Please reboot your computer for the changes (especially macFUSE) to take effect.${NC}"
echo -e "${YELLOW}After rebooting, you may need to manually enable 'System Extensions' for macFUSE in System Preferences > Security & Privacy > General.${NC}"
echo -e "${GREEN}If you encounter any issues, run 'brew doctor' to diagnose potential problems.${NC}"
  • use
1
2
sudo chmod 777 ./sh.sh
./sh.sh

mounty

地址:

1
https://mounty.app

install and use

1
2
3
macbook:~ uwe$ brew install --cask macfuse
macbook:~ uwe$ brew install gromgit/fuse/ntfs-3g-mac
macbook:~ uwe$ brew install --cask mounty

use

  • 安装完成后,重启软件 进入设置->隐私与安全性->启用未知来源安装

  • 系统自动重启后,长按电源键进入恢复模式,点击菜单栏查看启动安全实用工具,点击选择中等安全性,然后重启

  • 尝试重新挂载硬盘,如果mounty图标由黄变蓝则代表挂载成功,即可在目标磁盘创建文件

ffmpeg安装

1
brew install ffmpeg

see

Prev:
python批量写入图片到excel中
Next:
python 可视化打包工具集锦