{"id":797,"date":"2023-09-15T11:55:33","date_gmt":"2023-09-15T09:55:33","guid":{"rendered":"https:\/\/mic.st\/blog\/?p=797"},"modified":"2025-09-07T23:16:44","modified_gmt":"2025-09-07T21:16:44","slug":"connect-hfs-mac-formatted-usb-drive-to-raspberry-pi-and-access-its-data","status":"publish","type":"post","link":"https:\/\/mic.st\/blog\/connect-hfs-mac-formatted-usb-drive-to-raspberry-pi-and-access-its-data\/","title":{"rendered":"Connect Mac formatted (HFS+) USB drive to Raspberry Pi"},"content":{"rendered":"\n<p>Today, I wanted to connect an USB drive to my Raspberry Pi and it did not work as easy as expected to access it&#8217;s data. As a side note, it is a Raspberry Pi completely set up via terminal so there is no nice GUI where you can have a look what happens. I am by far a terminal expert so I googled around a lot during the process. This is what I found and worked for finally accessing the data on my Mac formatted USB stick.<\/p>\n\n\n\n<p>For setting up the Raspberry Pi itself, I wrote another post for that, see: <a href=\"https:\/\/mic.st\/blog\/minimal-setup-of-raspberry-pi-zero-w-with-ssh-over-wifi-connection\/\">https:\/\/mic.st\/blog\/minimal-setup-of-raspberry-pi-zero-w-with-ssh-over-wifi-connection\/<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Connect it<\/h2>\n\n\n\n<p>First just connect it and see if your Raspberry can see it at all. E.g. type <code>lsub<\/code> which will give you something like this depending on your setup.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">pi@raspberrypi:\/ $ lsusb\nBus 002 Device 002: ID 0781:5591 SanDisk Corp. Ultra Flair\nBus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub\nBus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub\nBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The first one here looks pretty promising. Nice! So it&#8217;s there.<\/p>\n\n\n\n<p>However, you still cannot just access it like you would do on your Mac or Windows machine. On Linux you have to &#8220;mount&#8221; it.<\/p>\n\n\n\n<p>Depending on your setup this might have happened automagically then you are basically done already. Check by typing to your terminal and see if there is any folder that looks like your usb stick. <\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">ls \/media<\/code><\/span><\/pre>\n\n\n<p>If nothing is shown, no worries, it just means your device is not mounted yet. I also had to do it manually.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Check filesystem<\/h2>\n\n\n\n<p>It is important to know the file system of your USB drive, i.e. how you formatted it when preparing it on your Mac or Windows PC. You can check that by typing: <\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">blkid<\/code><\/span><\/pre>\n\n\n<p>E.g. you will see something like this in your list:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">mark<\/span> <span class=\"hljs-attr\">style<\/span>=<span class=\"hljs-string\">\"background-color:rgba(0, 0, 0, 0)\"<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"has-inline-color has-accent-color\"<\/span>&gt;<\/span>\/dev\/sda2:<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">mark<\/span>&gt;<\/span> UUID=\"xxxx-xxxx-xxx-xxxx-xxxx\" BLOCK_SIZE=\"4096\" LABEL=\"Untitled\" TYPE=\"<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">mark<\/span> <span class=\"hljs-attr\">style<\/span>=<span class=\"hljs-string\">\"background-color:rgba(0, 0, 0, 0)\"<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"has-inline-color has-accent-color\"<\/span>&gt;<\/span>hfsplus<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">mark<\/span>&gt;<\/span>\" PARTUUID=\"1fd0f434-937a-48ec-971b-78c7f67a1a3f\"<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The highlighted parts are the important pieces of information here. First is the path of the device you have to use when mounting and for the parameter <code>TYPE<\/code> you can see the actual filesystem.<\/p>\n\n\n\n<p>In my case it is <code>hfsplus<\/code> which relates to &#8220;HFS+&#8221; you can select when formatting a device on Mac for example. By default, Raspberry Pi&#8217;s Linux does not seem to support HFS+, we will change that now.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add HFS+ Support to Raspberry Pi<\/h2>\n\n\n\n<p>Luckily, we have a builtin package manager called apt-get on Linux which we can use for quickly adding HFS+ support.<\/p>\n\n\n\n<p>Call the following in your Raspberry Pi&#8217;s terminal:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">sudo apt-<span class=\"hljs-keyword\">get<\/span> update\nsudo apt-<span class=\"hljs-keyword\">get<\/span> upgrade<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>These just make sure everything is up to date.<\/p>\n\n\n\n<p>Then add all the needed dependencies for HFS+ support with the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">sudo apt-<span class=\"hljs-keyword\">get<\/span> install hfsplus hfsutils hfsprogs gdisk<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Now we are ready to mount!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Mount your USB stick \/ device<\/h2>\n\n\n\n<p>First, create a new folder in that empty <code>\/media<\/code> we had a look into earlier:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">sudo mkdir \/media\/myUSBStick<\/code><\/span><\/pre>\n\n\n<p>Of course you can name <code>myUSBStick<\/code> however you like.<\/p>\n\n\n\n<p>Second, mount it by using the following:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">sudo mount -t hfsplus &lt;mark style=<span class=\"hljs-string\">\"background-color:rgba(0, 0, 0, 0)\"<\/span> <span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span><\/span>=<span class=\"hljs-string\">\"has-inline-color has-accent-color\"<\/span>&gt;&#91;add path you got via blkid]&lt;<span class=\"hljs-regexp\">\/mark&gt; \/m<\/span>edia\/hfsplus<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Make sure you add the correct path you got earlier when using <code>blkid<\/code>, e.g. in my case it would be:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">sudo mount -t hfsplus \/dev\/sda2 \/media\/hfsplus<\/code><\/span><\/pre>\n\n\n<p>Check if you can access your mounted USB stick by trying to list its contents:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">ls \/media\/myUSBStick<\/code><\/span><\/pre>\n\n\n<p>In case you do have any content (folders or files) on your USB stick, you should see it now.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, I wanted to connect an USB drive to my Raspberry Pi and it did not work as easy as expected to access it&#8217;s data. As a side note, it is a Raspberry Pi completely set up via terminal so there is no nice GUI where you can have a look what happens. I am&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[20,83],"tags":[],"class_list":["post-797","post","type-post","status-publish","format-standard","hentry","category-electronics","category-terminal"],"_links":{"self":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts\/797","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/comments?post=797"}],"version-history":[{"count":3,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts\/797\/revisions"}],"predecessor-version":[{"id":1027,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/posts\/797\/revisions\/1027"}],"wp:attachment":[{"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/media?parent=797"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/categories?post=797"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mic.st\/blog\/wp-json\/wp\/v2\/tags?post=797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}