Home/Computers & IT/How To Make A Raspberry Pi NAS Using SAMBA & HFS+

I am going to take you through how to setup a Raspberry Pi NAS.  We will be using SAMBA & the format for the external HDD will be HFS+

HFS+ is the Macintosh standard format, I used this HDD with my mac & put a lot of data on it. I decided to set it up as a NAS rather then having it plugged into my macbook all the time. So naturally I don’t want to format it & lose my data.

There are a lot of benefits to setting up a Raspberry Pi NAS. It’s energy efficient, Cheap, uses USB external HDD’s (great for portability), setup data redundancy, using a stable & reliable Linux OS – Debian. ETC

First make sure your Raspberry Pi is ready to go.
Install RASPBIAN – The easiest way to do this is to follow this guide & install the NOOBS package.

Once you have your working Raspberry Pi plug it into the network (LAN is preferred, but WiFi will work) & SSH into it using Terminal or for windows users you can use PuTTY or Cigwyn.

SSH - Raspberry Pi NAS


If you haven’t changed your PW yet, the default for the pi user is: raspberry

Now lets update the Raspberry Pi.

Run these  2 commands one after each other

sudo apt-get update
sudo apt-get upgrade

Now we need to install some repos

HFS+ Support

sudo apt-get install hfsprogs

HFS+ uses GPT (GUID Partition Table) so fdisk won’t support it, this is why we need to install gdisk

sudo apt-get install gdisk

Once these are installed lets get to mounting the drive, but first we need to create a directory to mount it to. (3TBEXT is what I called my directory, you can call it whatever you please)

sudo mkdir /media/3TBEXT

Plug in your HDD & lets make sure the device is detected in fdisk

sudo fdisk -l

fdisk - Raspberry Pi NAS


We can see that the 3TB external HDD is /dev/sda but we need to know the partition to mount, fdisk can’t show us this because it doesn’t support GPT.

So we will use gdisk which we installed earlier to check the device path for the partition.

sudo gdisk -l /dev/sda

We can now see that its partition number 2. The device path will be /dev/sda2 (you could of easily guessed this but its always better to double check)

gdisk - Raspberry Pi NAS

Lets mount the drive

sudo mount -t hfsplus -o force,rw /dev/sda2 /media/3TBEXT

Now that the drive is mounted lets add them to the fstab which will mount the drive every time the Pi reboots.

sudo nano /etc/fstab

add another line for your HFS+ drive

/dev/sda2       /media/3TBEXT    hfsplus defaults,force  0       0

How To Make A Raspberry Pi NAS Using SAMBA & HFS+

(each space is a tab, not a space)
Exit & save by pushing CTRL X then Y  & Enter

Now we can install SAMBA which is the windows sharing protocol. (this works fine across all platforms)

sudo apt-get install samba samba-common-bin

Once it’s installed we can configure it. But first incase you make a mistake lets backup the config file.

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bkup

Now that we have our backup config file lets edit the main one. (CTRL V to scroll through the pages, if you aren’t familiar with nano I recommend you check out the user guide)

sudo nano /etc/samba/smb.conf

SAMBA Conf - Raspberry Pi NAS

You can change the workgroup here as well but default is fine in my case, which is “workgroup”

Workgroup Conf - Raspberry Pi NAS

When you get to Authentication you need to remove the # symbol from security = user so it enables user base authentication with your shares. (depending on the version of samba you installed this might not be there. Just add it if its missing)

Security Conf - Raspberry Pi NAS

Now go all the way to the bottom of the config file & add your share. (what you put in brackets in the top line will be the name of the folder that appears on the network share)

[ShareName] comment = Raspberry Pi NAS
path = /media/3TBEXT/
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no

Now exit the same as we did before.
CTRL X then Y  & Enter

Restart Samba

sudo /etc/init.d/samba restart

We now have to create a user that can access the samba shares. (change *username* to what you want your user name to be)

sudo useradd *username* -m -G users

sudo passwd *username*

You’ll be prompted to type in the password twice to confirm. Now we can add this user as a samba user. (once again replace *username* with your user name)

sudo smbpasswd -a *username*

Enter the users password again when prompted.

And now we are done!
If you open finder you will see the Raspberry Pi NAS appearing in shared section of the sidebar. Click on it & click the button in the top right that says *Connect As* & put in the user credentials you created & you will have access to the network share.

By | 2017-06-27T11:12:35+00:00 July 7th, 2015|Computers & IT|20 Comments

Share This Story, Choose Your Platform!


  1. Christopher Allen July 8, 2015 at 6:28 pm - Reply

    Great write-up, thanks! I primarily use a Mac and am planning on setting this up for a Timemachine backup, however, will this drive still be accessible for windows users on the network? I have fun and games with external drives when passing files around, and have had to format everything as FAT32, which has an annoying 4GB filesize limit.

    • Sammit
      Sammit September 28, 2015 at 11:05 pm - Reply

      Hi there, this method I am using HFS+ which is not supported by windows.

  2. juliant September 9, 2015 at 1:35 am - Reply

    thanks heaps! works like a charm!!

  3. jsd November 4, 2015 at 4:52 am - Reply

    Thanks for doing this. I just found myself in the situation of needing a way to serve up files from an HFS+ drive and this walkthrough was super easy to follow.

    • Sammit
      Sammit January 4, 2016 at 1:20 am - Reply

      No worries, Glad I could help!

  4. heimi January 3, 2016 at 7:11 pm - Reply

    2 Questions
    1. Can I plug 2 Harddisks at the raspi2 or do I have to use a seccond raspi?
    2. Will the configuration be fast enaugh to stream 1080p tv over a OSMC – or similar – media player?

    • Sammit
      Sammit January 3, 2016 at 11:55 pm - Reply

      Hi Heimi,

      Yes you can. But I would recommend using powered 3.5″ External Hdd’s or if you want to use 2.5″ external HDD’s you should get a powered 4 port USB Hub. this means the HDD’s will get their power from another power source other then the raspberry pi. This also means you are increasing the amount of HDD’s you can have by increasing the USB ports.

      I run a second Raspberry Pi with OSMC & stream blu-ray 1080p with it all the time. I find the only limitation you will have is your network. For this reason I have gigabit installed everywhere in my house. So my OSMC Raspberry Pi uses the LAN port. But if your only option is WiFi make sure you have a decent router & a good wireless N adaptor with an external antenna for the OSMC Raspberry Pi.

  5. qfw March 2, 2016 at 7:20 am - Reply

    Hi, I’ve done all this and can connect from my Mac to eth NSA share on the Pi, however – I cannot write to the share. Any ideas?

    • Sammit
      Sammit March 2, 2016 at 11:32 am - Reply

      Hi there,
      Fist I would make sure that the drive has been mounted as read & write.
      Try accessing the drive directly in terminal & try creating a txt file on it.
      If it doesn’t let you do this then you will need to unmount the drive & run sudo fsck.hfsplus -f /dev/whateveryourdriveis
      Then remount & will be fine. This happens when you don’t eject the drive before unplugging it.

      If that isn’t the issue then there is a issue with your samba user permissions or there is an issue with your samba config file.

      Let me know how you go. Good Luck!

  6. qfw March 3, 2016 at 6:10 am - Reply


    I have this in fstab:
    /dev/sda2 /mnt/wdc1 hfsplus defaults,noatime,rw 0 0

    and when pi is reboot’d the drive come up with it unwritable.

    by unmounting, and then remounting with:
    sudo mount -t hfsplus -o force,rw /dev/sda2 /mnt/wdc1

    I fix the issue.

    My question is:
    Do I need to change something in fstab to ensure it mounts readable, or if not, how can I ensure that when the pi boots, the drive is mounted writeable?

    • Sammit
      Sammit March 11, 2016 at 7:39 pm - Reply

      Add the force rw command to fstab should fix it.
      Otherwise make a startup script with the command sudo mount -t hfsplus -o force,rw /dev/sda2 /mnt/wdc1 in it.

  7. Mike April 4, 2016 at 1:20 am - Reply

    Will this work with an external raid setup?

    • Sammit
      Sammit May 11, 2016 at 12:38 pm - Reply

      What format is your RAID configuration?

      In theory it should work, but I haven’t tried it personally yet.

  8. Peter April 16, 2016 at 4:18 am - Reply

    Many thanks for posting this – having spent a whole week trawling the net and finding lots of blogs that didn’t work this is brill and works a treat !
    My hfsplus partition works well but currently my Windows Fat32 partition fails to mount even though fsck doesn’t find any problems – the mount command seems to work (i.e. doesn’t return an error) but the disk doesn’t mount – I’ll try connecting it back to the windows pc and seeing if that shows any errors.

    • Sammit
      Sammit May 11, 2016 at 12:41 pm - Reply

      No worries! glad I could help you. The issue with your FAT32 drive sounds like it wasn’t correctly ejected from windows at some point before plugging it into the raspberry pi. Just plug it back into windows if it comes up asking to scan & repair the drive cause it wasn’t ejected correctly let it do it & then eject it correctly with window’s built in safely remove removable device feature in the task bar & it should mount fine on the reboot with it in fstab.

  9. Michael Lakner June 30, 2016 at 1:17 pm - Reply

    When I go to mount the drive I get this

    sudo mount -t hfsplus /dev/sda2 /media/
    mount: unknown filesystem type ‘hfsplus’

    What is the problem

    • Michael Lakner June 30, 2016 at 1:17 pm - Reply

      I have my drive named, I just took it out for the post. Not that it mattered I guess.

  10. Michael Lakner June 30, 2016 at 1:36 pm - Reply

    FIXED: Forgot to Reboot

  11. Alex September 13, 2016 at 9:01 am - Reply


    I am getting this error message and I hope you can help. It says ” problem opening -l/dev/sda for reading! Error is 2. The specified file does not exist.”
    I have followed this thing step by step but named my file something different. My fdisk screen looks identical to yours besides the warning above the disk read out. Can you help?

  12. Brendan May 20, 2017 at 10:45 am - Reply

    Thanks for this great write-up! I want to make sure I understand… this did not require you re-formatting your existing drive, correct? I currently have a 3TB external hard drive formatted for Mac OS (Journaled) with about 2.5 TB of the drive already full. I’m trying to avoid losing any of that data.

    Ultimately I want to use the raspberry pi to watch the movies off my HDD. Not sure if this is the way to go, or if i should just do the raspberry pi with osmc.

    Anyway, thank you!

Leave A Comment