Adding an External Disk to a Raspberry Pi and Sharing it Over the Network
The Raspberry Pi isn’t necessarily the best choice for creating a fast and efficient Network Attached Storage (NAS) as any external disk will be attached using USB 2.0 and, at least until the recent arrival of the new Raspberry Pi 3, Model B+, the Pi was limited to 100Mbps over Ethernet.
However, if you intend to use it as a personal server you won’t be dealing with large volumes of traffic, so it can easily be “good enough” to use as reliable, and perhaps critically, really rather cheap network storage device. Which is why one of the most frequent uses of the Raspberry Pi is to create a NAS. Despite the obvious downsides of low network throughput.
There are a number of ways you can go about it, however the biggest choice you’re going to have to make is how you want to share your storage across the network. There are three main choices here, NFS, AFS, and SMB, and which you choose depends on how and where you’re intending to access the NAS from, so we’ll walk through all three.
Go ahead and download the latest SD Card image of Raspbian, and walk through the normal set up steps for your Raspberry Pi. Afterwards, remember to change the default password for the ‘pi’ account to something other than ‘raspberry,’ and make sure everything is up to date.
$ sudo apt-get update
$ sudo apt-get upgrade
Once you have your board configured and working we can get started.
Choosing a Disk
The first thing we need do is grab a disk. You can either use a standard external hard drive, or a USB flash drive. However if you want to use an external USB hard drive, considering the power constrains on the Raspberry Pi, you might want to opt for one that has a separate mains connection rather than one that takes its power from its USB connection. You can now pick a main’s powered 4TB external drive up for under £100 (that’s around $150).
Formatting your Disk
While it is pretty much never the most optimal choice, you should still probably format your external disk using the ubiquitous FAT32 format. It’s old, rather slow, and imposes a maximum file size of only 4GB. However it’s still the easiest way to…