Setting up a HFS+ drive in Ubuntu (and the like)


Categories: it Tags: hfs+ macos linux


Bad news (sort of). You can’t run HFS+ with journalling enabled on linux distros.

So first of all we’ll have to disable it (and yes, at this point we need the drive to be connected to something with macOS on board).

Disk Utility won’t let you turn in off these days, so we are going to do it via terminal:

find your disk with diskutil list and then disable journalling:

sudo diskutil disableJournal /dev/diskXsY
where X and Y are some integers

Install needed software

We need a few addtional packages first:

sudo apt-get install hfsplus hfsutils hfsprogs

Configure automount

First we need to find where does the drive live with sudo fdisk -l command. The output will be a list of all drives where each ’entry’ will look something like this:

Disk /dev/sda: 1.8 TiB, 2000367386624 bytes, 3906967552 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D1FA1052-49E2-43C2-A2CE-4BD671F8696E

Device      Start        End    Sectors  Size Type
/dev/sda1      40     409639     409600  200M EFI System
/dev/sda2  409640 3906705367 3906295728  1.8T Apple HFS/HFS+
1.8T drive formatted in Apple HFS+ is what I’ve been looking for!

What we need here is the path of the drive. It is /dev/sda2 in my case.

Now we need to get the UUID of the drive with sudo blkid /dev/sdx2 command:

/dev/sda2: UUID="840adb20-d411-3474-ad41-21052e6c6119" LABEL="Abyss 1" TYPE="hfsplus"
You need to replace the x2 with whatever the path is in your case of course.

Last piece of the puzzle is the user UID. Simply echo $UID and you will get a number representing your user UID. Let’s say it’s 1000.

Add this line (with the correct UUID and mount point absolute path) to the /etc/fstab file:

UUID="the-uuid" /the/mount/point hfsplus defaults,uid=UID,rw 0 0

Reboot. Or you can try to just mount it right away: sudo mount /the/mount/point.

Now we have read-write HFS+ volume we can work with.


A few times I’ve encountered an error that looks like this:

cannot touch 'test': Read-only file system

Most likely I’ve turned off the external drive without unmounting it properly or something similar happens.

This can be solved by running HFS file system consistency check:

sudo fsck.hfsplus /dev/sdxN

and then you can either remount the device via sudo umount -l /dev/sdxN and sudo mount /the/mount/point or reboot.

>> Home