In this Raspberry Pi HFS tutorial, we will walk you through the steps to enabling support for Apples HFS Plus filesystem on your Raspberry Pi.
This tutorial will take you through the packages that you need to install to interact with HFS Plus drives. We will also show how to mount the drives and format a drive.
For those who do not know, HFS stands for Hierarchical File System and was the primary file system for both the Mac OS X operating system and iPod before it was replaced with the Apple File System (APFS) in 2017.
While it is useful to add support for your Raspberry Pi to read HFS Plus drives, it is not recommended to use it as your day to day drive format. HFS lacks features when compared against other file systems such as NTFS.
Below is all the equipment that you will need to set up HFS on your Raspberry Pi.
Adding support for HFS On your Raspberry Pi
1. The first thing we need to do before we can access HFS Plus drives is to ensure our Raspberry Pi is running up to date software.
We can update all installed packages by running the two commands below.
sudo apt-get update sudo apt-get upgrade
2. Next, we need to install the packages that will give our Raspberry Pi the ability to read HFS Plus formatted drives.
Also in allowing us to mount and read from HFS Plus drives, the packages we install will enable us to format drives in the HFS Plus format.
Install all the HFS packages we need by running the following command.
sudo apt-get install hfsplus hfsutils hfsprogs gdisk
3. With all the required hfs packages now installed to the Raspberry Pi, the operating system should be able to understand HFS formatted drives and deal with them appropriately.
While the Raspbian operating system tries to mount drives under the correct format automatically, there are some cases where you will want to do this manually.
In the next section of this tutorial, we will walk you through the very basics steps of manually mounting an HFS plus drive to your Raspberry Pi.
Mounting a HFS drive manually
1. Mounting an HFS drive is simple and can be done using the “mount” tool like any other drive.
The only difference is that you will be using the “-t hfsplus” argument for the mount command. This flag tells the mount application to try using hfsplus to understand the formatting of the drive.
Before we begin, we must create a folder where we will mount our HFS drive, for this tutorial we will be naming this new folder “hfsplus“.
Create this new “hfsplus” folder by running the following command on the Raspberry Pi.
sudo mkdir /media/hfsplus
2. Now let’s mount our HFS drive. In our example below, we have already found where our device is located. In our case, this is “/dev/sdb1“. You can check where the drive is located using “sudo fdisk -l“.
Using the command below we can mount the drive “/dev/sdb1” to our “/media/hfsplus” folder.
sudo mount -t hfsplus /dev/sdb1 /media/hfsplus
3. You should now be able to interact with your device at the “/media/hfsplus” location.
Formatting a drive as HFS
1. To format your drive in the HFS Plus format, you can make use of the “mkfs” program.
Using this program, you can tell it to format your drive in the “hfs+” format by entering the command below. The location mentioned next to the command should be the path at which your drive sits.
Run the command below to format the drive sitting at “/dev/sdb1” with the HFS Plus format.
By now you should be able to access your HFS drive on the Raspberry Pi. If you have issues with connecting your HFS drive, be sure to check back through the tutorial to see if you made any errors. Also, feel free to leave any feedback regarding this tutorial below.