Updated on September 03, 2019
Update #1:
This guide has been updated. Tested on Raspbian Buster on a Raspberry Pi 4
To enable the USB boot bit, the Raspberry Pi 3 needs to be booted from an SD card with a config option to enable USB boot mode. Once this bit has been set, the SD card is no longer required. Tested on Raspbian Buster on a Raspberry Pi 4. Over this past weekend, I finally setup a network share via Samba on my Raspberry Pi with an old external USB hard drive I had laying around. My RetroPie installation already serves up a Samba share - so my goal was to throw an additional folder in there that mounts to an external drive. The most common way to read a file on Kodi will be to use a USB key or an external drive (especially if you have all your photos or movies on it). In this case, plug the drive on the Raspberry Pi and all your files will be available directly. OSMC and Kodi will mount automatically your disk and display all files available.
Over this past weekend, I finally setup a network share via Samba on my Raspberry Pi with an old external USB hard drive I had laying around. My RetroPie installation already serves up a Samba share - so my goal was to throw an additional folder in there that mounts to an external drive. After a bit of trial and error, here’s how I pulled it off.
Step one was to format my drive to the ext4 filesystem. I read varying opinions on which filesystem is recommended for this procedure, and ext4 seemed to be a good choice in the end. While there are ways to format your drive directly via the CLI - I decided to use a trial of ExtFS for Mac and it was very easy.
Next, I plugged my external drive into the RPi and connected over SSH. Once you’re connected, run the following command:
Now, look towards the bottom and assuming this is the only additional drive you have plugged in, you should see something like this:
/dev/sda1 is the name of the partition on our external drive.
Next we’re going to create a directory within our /media/
folder to mount our drive into, and also a sub-directory within it. The reason for the sub-directory is that I want to avoid seeing the lost+found folder on the ext4 partition we created.
After that, we want to ensure that we have the full access to the directory.
Next, we want to mount our external drive into that new directory.
Kodi Raspberry Pi Usb Drive Format
Now we’ll need to update our Samba config. If you’re already running RetroPie, you’ve already got Samba installed. If not, you may need to run the following command.
Before you edit your Samba config, make a quick backup copy of the current file.
Now, jump into the config file.
We’re going to want to jump straight to the bottom of this file - so if you’re on a Mac just hit fn and the downarrow a few times.
Once you get to the bottom, you should see a list of familiar folders that RetroPie already shares (roms, bios, configs, and splashscreens). Create another sections just below the last that looks like this:
The name and the comment can be customized, but definitely make sure your path matches the one you created earlier.
And finally, you’ll want to restart your Samba daemons.
Kodi Raspberry Pi Usb Drive
At this point you should be able to read and write to your Samba share via Finder by clicking on retropie under the Shared heading and then accessing your new folder called share.
The final step we’ll want to do is edit our fstab configuration so that our drive will properly mount whenever our Raspberry Pi reboots.
Add the following line to the bottom of the config file (making sure to match the values you’ve used previously)./dev/sda1 /media/USBHDD auto noatime 0 0
And now we’re done. Enjoy your new network share drive. Personally I’ve hooked mine into every device on my network that can run Kodi for a personal media library accessible throughout the home.