3

I see a lot of questions asking how to mount and access ext4 file systems, which can be solved with the brew packages: macFUSE, ext4FUSE.

The Question:

Is there a way to format an external disk to ext4? I can't find any brew packages, so am I just going to have to get a linux vm?

1
  • I would assume you could boot to a live version of Ubuntu and format from there. Oct 24, 2022 at 11:54

1 Answer 1

4

In macOS, all your internal and external drives are just /dev/diskX files where the X is the disk number.

diskutil list

To created a filesystem on an external disk, you will need to partition it. With free space on the disk, you can do so with this command:

gpt add -t 0FC63DAF-8483-4772-8E79-3D69D8477DE4 diskX

Once partitioned, you format the partition.

brew install e2fsprogs
`brew --prefix e2fsprogs`/sbin/mkfs.ext4 /dev/diskXs1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 97632 1k blocks and 24384 inodes
...
Writing superblocks and filesystem accounting information: done

Then mount with the macFuse ext4 command.

It is also interesting they can still support fuse, as Apple discontinued kernel extensions in Big Sur.

This makes all fuse filesystem look like network shares.

3
  • So how do you format the partition as ext4?
    – Gilby
    Oct 25, 2022 at 1:47
  • @Gilby Added how to format to the answer. Updated and thanks. Oct 25, 2022 at 2:49
  • @JamesRisner Way before this answer I ended up installing parallels with a centos vm and just got it over with. However I tried your steps after formatting the disk to fat32 but got: gpt add /dev/disk2s1: error: no primary GPT header; run create or recover I googled how to fix this and after several attempts nothing worked. Thank you very much though I'll use this in the future.
    – Nickotine
    Oct 25, 2022 at 3:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .