如何在Mac上格式化SD 卡

本来想折腾一下树莓派,装一下openwrt,但是以前用的是windows,目前换成macbook了,因此实操一下。

1. 打开终端

可以使用Spotlight搜索(Command + 空格键,然后输入“终端”) 或者在Finder > 应用程序> 实用工具中找到终端应用程序。

2. 连接SD卡

将SD卡通过读卡器插入Mac电脑的相应接口。

3. 查看磁盘列表

在终端中输入diskutil list并按下回车键,会显示所有连接的磁盘,包括SD卡。

1
diskutil list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
> % diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: Apple_APFS_ISC Container disk1 524.3 MB disk0s1
2: Apple_APFS Container disk3 245.1 GB disk0s2
3: Apple_APFS_Recovery Container disk2 5.4 GB disk0s3

/dev/disk3 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +245.1 GB disk3
Physical Store disk0s2
1: APFS Volume Macintosh HD 10.2 GB disk3s1
2: APFS Snapshot com.apple.os.update-... 10.2 GB disk3s1s1
3: APFS Volume Preboot 6.1 GB disk3s2
4: APFS Volume Recovery 931.6 MB disk3s3
5: APFS Volume Data 213.6 GB disk3s5
6: APFS Volume VM 7.5 GB disk3s6

/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *32.1 GB disk4
1: DOS_FAT_32 SYSTEM-BOOT 268.4 MB disk4s1
2: Linux 31.8 GB disk4s2

4. 找到SD卡

在列表中找到SD卡,通常会显示其名称、大小和磁盘标识符(例如,/dev/disk4)。

image-20250706163130701

5. 卸载磁盘(如果已挂载)

1
sudo diskutil unmountDisk /dev/disk4
1
2
> % sudo diskutil unmountDisk /dev/disk4
Unmount of all volumes on disk4 was successful

6. 格式化SD卡

输入以下命令并按下回车键,替换SD卡名称为SD卡的名称, /dev/diskX替换为实际的SD卡标识符:

1
sudo diskutil eraseDisk FAT32 SD卡名称 MBRFormat /dev/diskX

例如,如果要将名为”Untitled”的SD卡格式化为FAT32,且其标识符为/dev/disk2,则命令应为:

1
sudo diskutil eraseDisk FAT32 Untitled MBRFormat /dev/disk2

本文命令如下:

1
sudo diskutil eraseDisk FAT32 "USB" MBRFormat /dev/disk4
  • FAT32:文件系统格式(兼容 Windows/macOS/Linux)。
  • "USB":新磁盘的名称(可以自定义)。
  • MBRFormat:分区方案(适用于大多数 USB 设备)。
  • /dev/disk4:目标磁盘。
  1. 输入密码:

系统会提示您输入管理员密码,输入后按下回车键,格式化操作就开始了。

  1. 等待完成:

    格式化过程可能需要一些时间,请耐心等待,直到终端提示格式化完成。

1
2
3
4
5
6
7
8
9
10
11
> % sudo diskutil eraseDisk FAT32 "USB" MBRFormat /dev/disk4
Started erase on disk4
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk4s1 as MS-DOS (FAT32) with name USB
512 bytes per physical sector
/dev/rdisk4s1: 62672960 sectors in 1958530 FAT32 clusters (16384 bytes/cluster)
bps=512 spc=32 res=32 nft=2 mid=0xf8 spt=32 hds=255 hid=2048 drv=0x80 bsec=62703616 bspf=15302 rdcl=2 infs=1 bkbs=6
Mounting disk
Finished erase on disk4

7.查看自动挂载

完成后,磁盘会自动挂载,可以在 Finder 中看到它。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
> % diskutil list                       
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: Apple_APFS_ISC Container disk1 524.3 MB disk0s1
2: Apple_APFS Container disk3 245.1 GB disk0s2
3: Apple_APFS_Recovery Container disk2 5.4 GB disk0s3

/dev/disk3 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +245.1 GB disk3
Physical Store disk0s2
1: APFS Volume Macintosh HD 10.2 GB disk3s1
2: APFS Snapshot com.apple.os.update-... 10.2 GB disk3s1s1
3: APFS Volume Preboot 6.1 GB disk3s2
4: APFS Volume Recovery 931.6 MB disk3s3
5: APFS Volume Data 213.6 GB disk3s5
6: APFS Volume VM 7.5 GB disk3s6

/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *32.1 GB disk4
1: DOS_FAT_32 USB 32.1 GB disk4s1

image-20250706164252233

注意事项

  • sudo命令需要管理员权限,因此需要输入管理员密码。
  • FAT32是常用的文件系统格式,适用于大多数设备,但如果SD卡容量大于32GB,建议使用exFAT格式。
  • MBRFormat参数表示使用MBR分区方案,这是Windows和Mac都兼容的方案。
  • diskutil命令还有很多其他参数,可以用于更高级的磁盘管理操作,具体可以参考man diskutil命令。
  • 在格式化之前,请务必备份SD卡中的重要数据,因为格式化会清除所有数据。
  • 数据会全部删除! 确保磁盘上没有重要文件。
  • 如果磁盘大于 32GB,FAT32 可能无法使用(Mac 的 diskutil 仍然可以格式化,但 Windows 可能不认)。
  • 如果需要 NTFS/exFAT,可以替换 FAT32exFAT(但 MBR 仍然适用)。

如何在Mac上格式化SD 卡
https://blog.baixf.shop/2025/07/06/Macbook/ 如何在Mac 上格式化SD 卡/
作者
白小飞
发布于
2025年7月6日
许可协议