Configuring a simple Raspberry Pi NAS (or network attached storage) is quite a straightforward process. SMB is my chosen app to do this as it’s both Mac and Windows compatible and lightweight, so your Raspberry Pi can do other things as well.
Setting up SMB For Your Simple Raspberry Pi NAS
Setting up SMB (Server Message Block) on a Raspberry Pi allows you to share files and printers between computers and devices on a local network. Below are the steps to follow and some of the terminal codes you may require. To make things a bit simpler, I have recorded the process within the following video:
If you wish to follow a written guide, here are the steps to set up SMB on Raspberry Pi:
Install Samba: Open the terminal on your Raspberry Pi and run the following command to install Samba:
sudo apt-get update sudo apt-get install samba samba-common-bin
Create a shared directory: Decide which directory you want to share with other devices on your network. You can create a new directory or use an existing one. For example, you can create a new directory called “shared” in the home directory with the following command:bashCopy codemkdir ~/shared
Configure Samba: Open the Samba configuration file using the following command:
sudo vim /etc/samba/smb.conf
Please note that I use Vim to edit text files as this is what I am used to. Nano is also popular, so feel free to use whichever text editing application you prefer.
Add the following lines to the bottom of the file:
[shared] comment = Shared Directory
path = /home/pi/shared
browsable = yes
guest ok = yes
read only = no
create mask = 0777
directory mask = 0777
This creates a new share called “shared” that points to the directory you created in step 2.
Restart Samba: After you have made changes to the Samba configuration file, you need to restart the Samba service for the changes to take effect.
Use the following command:
sudo service smbd restart
Access the shared directory: You can now access the shared directory from another device on your network. Open File Explorer (or Finder on Mac) and type in the Raspberry Pi’s IP address in the address bar, preceded by \\. For example, if your Raspberry Pi’s IP address is 192.168.1.100, type \\192.168.1.100 in the address bar. You should see the “shared” directory listed. Double-click on it to access the files.
If you follow the video, you will see that to create the NAS, I have a USB drive inserted and store the files separate to the SD Card which holds the operating system. For more posts about the Raspberry Pi, please read through these posts.
No Responses