macOS 系统下格式化 U 盘为 ext4 格式

如果没有 Homebrew 的话,需要先安装 Homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装 e2fsprogs

brew install e2fsprogs

把 U 盘插到 Mac 上,执行:

diskutil list

找到自己 U 盘的盘符,比如我这里是:/dev/disk3s1,

/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *30.8 GB    disk3
   1:             Windows_FAT_32 SANDISK                 30.8 GB    disk3s1

然后执行格式化:

diskutil unmountdisk /dev/disk3s1
sudo $(brew --prefix e2fsprogs)/sbin/mkfs.ext4 /dev/disk3s1

执行命令后会要求输入用户密码,然后输入 y 确认。

仅有 1 条评论
  1. Edward Wang Edward Wang

    您好,我是小白,和您请教一下哦。如果您有空QQ回复的话,非常感谢!
    我在第一步输入完安装homebrew的命令后,终端报错
    wangneddeMBP:~ ned$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    curl: (28) Operation timed out after 300128 milliseconds with 0 out of 0 bytes received
    不知道怎么回事,而且安装第二步,e2fsprogs,也报错。

    装homebrew的时候,报错还会显示这样,
    The default interactive shell is now zsh.
    To update your account to use zsh, please run `chsh -s /bin/zsh`.
    For more details, please visit https://support.apple.com/kb/HT208050.
    wangneddeMBP:~ ned$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443

添加新评论