hello folks, In this series of raspberry Pi Post, I’ll explain to you that how can You Setup your own NAS server. Network-attached storage (NAS) is a dedicated file storage that enables multiple users and heterogeneous client devices to retrieve data from centralized disk capacity. Users on a local area network (LAN) access the shared storage via a standard Ethernet connection. You can setup your own NAS server using Raspberry Pi. So in this post, We will discuss the step by step guide to Configure your own NAS Server using Raspberry Pi.

Requirements to Setup NAS Server using Raspberry Pi

  • Raspbian OS must be installed on Your Raspberry Pi (Read here)
  • Read the Installation steps of Raspbian OS (Recommended)
  • Your Raspberry Pi must be on the Same Network

Steps to Install NAS server on Raspberry Pi

Step 1: Connect to Your Raspberry Pi using ssh by following commands. Replace your own credentials

ssh [email protected]

Step 2: Run the following commands to update and upgrade your Raspberry Pi to the latest version

sudo apt-get update && sudo apt-get upgrade

Step 3: Now we have to install the file system. If you are using NTFS file system, run the following command

sudo apt-get install ntfs-3g

Step 4: If you are running ex-fat, then type the following command to install exFAT file system

sudo apt-get install exfat-utils exfat-fuse

Step 5: type the following command to install samba server on your Raspberry Pi

sudo apt-get install samba samba-common-bin

Step 6: Now connect your HDD to your Raspberry Pi.  To show all drive connected to your Raspberry Pi, type the following command


This command will list all the drive connected to Your Raspberry Pi. Note the mount point of your HDD. In my case it is sda1

Step 7: We need to create a new directory so that we can mount our HDD to that directory. Type this command to create a new directory

sudo mkdir /NAS_Server

Step 8: Type the following command to mount your HDD into the directory we have created in step 7

sudo mount /dev/sda1 /NAS_Server

Step 9: Type lsblk to confirm that the Drive is mounted or not

Step 10: for the configuration of samba server, type the following command

sudo nano /etc/samba/smb.conf

Note: Add these lines exactly into your smb.conf file

[RaspberryPi – NAS server]

Writeable = yes

Browseable = yes

Path = /NAS_Server

create mask = 0777

directory mask = 0777

valid users = Rajesh

In the above code, we have defined a user name rajesh. so we have to add that user too

Step 11: Now add the user, by typing following command

sudo adduser rajesh

Step 12: Set the samba password for the user we created in step 11, by following command

sudo smbpasswd -a rajesh

Step 13: at last type this command to edit your fstab file, so that it will help to automount your HDD after reboot of Raspberry Pi

sudo nano /etc/fstab

Note: Add these lines exactly to the bottom of fstab file

/dev/sda1 /NAS_Server auto defaults, user 0 2

In my case, the mount point is sda1. Replace it with your own

Step 14: Now restart the samba server by typing the following command

sudo /etc/init.d/samba restart

Steps to Access your NAS server (Windows user)

Step 1: Open file explorer and in the left side, click on Network

raspberry pi nas

Step 2: Enter the user id and password of NAS server.

Steps to Access your NAS server (Android user)

Step 1: Download ES File Explorer from Play store

Step 2: Open ES file explorer and left side, in network section, select LAN

Step 3: Enter the IP address of Raspberry Pi and then username, password

Rajesh Ranjan

I'm a tech enthusiast currently pursuing B.Tech in Computer Science & Engineering. trying to make things as simple as possible


Leave a Reply