0% found this document useful (0 votes)
32 views34 pages

How To Make A NAS With Raspberry Pi

This document provides a step-by-step guide on how to create a Network-Attached Storage (NAS) system using a Raspberry Pi, detailing the necessary components, including a Raspberry Pi board, microSD card, and external storage drive. It outlines the process of flashing the operating system, configuring the NAS settings, and setting up a Samba server for file sharing. The guide is aimed at users looking for a cost-effective storage solution, emphasizing the ease of setup and accessibility across devices.

Uploaded by

sudhindras
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views34 pages

How To Make A NAS With Raspberry Pi

This document provides a step-by-step guide on how to create a Network-Attached Storage (NAS) system using a Raspberry Pi, detailing the necessary components, including a Raspberry Pi board, microSD card, and external storage drive. It outlines the process of flashing the operating system, configuring the NAS settings, and setting up a Samba server for file sharing. The guide is aimed at users looking for a cost-effective storage solution, emphasizing the ease of setup and accessibility across devices.

Uploaded by

sudhindras
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

How to make a NAS with Raspberry Pi https://www.xda-developers.

com/make-nas-raspberry-pi/

 

How to make a NAS with Raspberry Pi


By Ayush Pande – Dec 14, 2023

A Raspberry Pi with Seagate hard drives and other storage devices

Raspberry Pi

  Like

A network-attached storage (NAS) system can be a great addition to your computing


setup if you want a centralized storage solution. Modern-day NAS setups support
multiple RAID levels, immutable snapshots, and a wide array (pun intended) of
failsafes to ensure that your data remains secure. Plus, you can use them to share
files across your devices.

While a NAS may sound like a pricey investment costing thousands of dollars, it’s not
really all that expensive. If you don’t mind (relatively) slow read and write speeds, you
can build a cheap NAS for under $100 using a Raspberry Pi.

1 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

What you ll need


Since the entire NAS project revolves around a Raspberry Pi, you'll need one of these
palm-sized single-board computers. I'll be using a Raspberry Pi 5 for this guide, but
you can do this on older boards, too. However, if you pick anything older than the
Raspberry Pi 4b, the NAS will get bottlenecked by the slow transfer rates of USB 2.0
ports.

You’ll also need a microSD card to boot into the operating system powering the NAS. If
you want your NAS to be responsive, you should grab a fast microSD card with at least
4GB capacity.

Finally, you need a storage drive to store all the data. Here’s the twist: Unlike typical
NAS, Raspberry Pi boards lack SATA slots and instead rely on USB ports to access an
external storage device. Depending on your requirements and budget, you can choose
a high-capacity hard drive or a cheap flash drive.

Raspberry Pi 5

$60 at SparkFun Electronics

$60 at CanaKit

PNY 32GB Elite microSDHC card

$10 at Amazon

SanDisk 64GB iXpand Flash Drive Luxe

$40 at Amazon

2 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

Flashing the operating system


Once you have the necessary components, it’s time to flash an OS onto the microSD
card. I’ll be using the Raspberry Pi OS Lite since a headless setup will improve the
performance of the NAS, but you can also pick the GUI version. I'm using the official
Raspberry Pi Imager, which provides the option to enable SSH and WLAN without
going through the trouble of creating additional files on the microSD card.

1. Download the Raspberry Pi Imager from the official link.


2. Click on the Install button after running the Imager.exe tool with admin
privileges.
3. Once the tool has finished installing, run rpi-imager.exe as an administrator
4. Click on Choose Device and pick your Raspberry Pi model.

A screenshot of Raspberry Pi Imager highlighting the steps to choose a device

5. Select Choose OS and click on Raspberry Pi OS (other).

3 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of Raspberry Pi Imager highlighting the steps to choose an OS

6. Select Raspberry Pi OS Lite (64-bit).

4 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of Raspberry Pi Imager highlighting the steps to select the


Raspberry Pi OS Lite

7. Click on Choose Storage and select the microSD card you want to use as the
boot device for the Raspberry Pi.

5 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of Raspberry Pi Imager highlighting the steps to choose a storage


device

8. Press Next and choose Edit settings on the pop-up window.

6 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of Raspberry Pi Imager highlighting the steps to edit the OS settings

9. Type the username and password.

7 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of Raspberry Pi Imager highlighting the steps to enter the username


and password

10. (Optional) If you want to access the Raspberry Pi over Wi-Fi, enable the
Configure wireless LAN checkbox and enter the network SSID, password, and
location.

8 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of Raspberry Pi Imager highlighting the steps to configure the WLAN


settings

11. Navigate to the Services header, check the box adjacent to Enable SSH, and
click on the Save button.

9 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of Raspberry Pi Imager highlighting the steps to configure SSH

12. Choose Yes twice and wait for the tool to finish writing the OS files.

When I tried to create a NAS with a Raspberry Pi 3b last year, I installed


OpenVaultMedia (OVM), which provides an intuitive GUI interface. Unfortunately, OVM
6 is only compatible with the older Buster and Bullseye versions of the Raspberry Pi
OS and doesn't support the latest Bookmark release. So, we’ll have to make do with
the CLI interface instead.

Checking the IP address of your Pi


You’ll need the IP address of your Raspberry Pi before you can log in from another
system via the SSH command. To do so,

1. Click on the Wi-Fi icon in the top-right corner of the screen.


2. Select Advanced options.

10 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

3. Choose Connection Information, and note down the IP address under the IPv4
section.

A screenshot of the Raspberry Pi OS highlighting the procedure to check the IP


address of the SBC

Connecting to the NAS


Since the NAS server will be operated in a headless setup, you’ll need to access it from
another PC.

I have switched to PuTTY from here on out since it's easier to use, but the
procedure is mostly the same if you're using the Terminal shell in Windows
11.

1. Insert the microSD card and plug the power and Ethernet cables into the

11 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

Raspberry Pi. If you’re using a Raspberry Pi 5, you’ll need to press the power
button to turn on the SBC.
2. Switch to another PC.
3. Download PuTTY from this link and open the app after installing it.
4. Type the IP address of the Raspberry Pi as the destination and make sure SSH
is selected as the Connection type before clicking Open.

A screenshot of PuTTY with the IP address of the Raspberry Pi highlighted

5. Type the name and password of the root user to enable the SSH connection.

12 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of PuTTY with the name and password of the root user highlighted

Configuring the storage drives


Next, it’s time to partition, format, and mount the storage drive for the NAS.

1. Use the lsblk command to view the list of drives.

13 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of PuTTY with lsblk command highlighted

2. Running the following command will open the Parted tool.

sudo parted /dev/sda

14 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of PuTTY highlighting the command to open the Parted interface

3. Type mklabel gpt and enter yes when asked for confirmation.

15 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of PuTTY with the mklabel gpt command highlighted

4. Type quit to close the Parted interface.


5. Run the mkfs.ext4 command to format the newly created partition:

sudo mkfs.ext4 /dev/sda1

16 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of PuTTY with the mkfs.ext4 command highlighted

6. Press Y when prompted for confirmation.


7. Enter mkdir command to create a mount point for the drive:

sudo mkdir /mnt/sda1

17 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of PuTTY with the mkdir command highlighted

8. Mount the drive by entering the following command:

sudo mount /dev/sda1 /mnt/sda1

18 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of PuTTY with the mount command highlighted

Setting up a Samba server


Once you’re done adding the drives, the next step is to set up a way to share them
over the network. Samba is free to use and lets you share files with multiple devices,
so we’ll be using that for our Raspberry Pi-powered NAS.

1. Run the following command to install Samba on your Raspberry Pi:

sudo apt-get install samba samba-common-bin -y

2. Paste the following command to create a directory for Samba:

sudo mkdir /home/samba-folder

3. Grant read and write privileges to the file by running these commands:
a.

19 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

sudo chown -R root:users /home/samba-folder

b.

sudo chmod -R ug=rwx,o=rx /home/samba-folder

A screenshot of PuTTY highlighting the commands to grant read and write


previleges

4. Mount the drive to the Samba directory by running the following command:

sudo mount /dev/sda1 /home/samba-folder

20 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of PuTTY highlighting the command to mount a drive to the Samba


directory

5. Execute the following command to open the fstab file:

sudo nano /etc/fstab

21 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of PuTTY highlighting the command to open the fstab file

6. Add these lines at the end of the file:


a.

/dev/sda1 /home/samba-folder auto noatime,nofail 0 0

b.

/dev/sda1 /home/samba-folder vfat dmask=000,fmask=111,user 0 1

22 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of the fstab file

7. Press Ctrl + X to save the file, and press Y when prompted for confirmation.
8. Open the Samba configuration file by entering the following command:

sudo nano /etc/samba/smb.conf

23 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of PuTTY highlighting the steps to open the Samba configuration file

9. Scroll to the bottom of the file and paste the following lines:
a.

Path = /home/samba-folder

b.

Browseable = yes

c.

read only = no

d.

Writeable = Yes

24 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

e.

only guest = no

f.

create mask = 0777

g.

directory mask = 0777

h.

Public = yes

i.

Guest ok = yes

10. (Optional) Feel free to change nasberrypi with the name you wish to give to
your NAS server. If you're the only person using the NAS, you can also add the
force user command like I have in the screenshot below.

25 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of the smb.conf

11. Save the file by pressing Ctrl + X, then Y.


12. Reboot Samba by executing the following command:

sudo systemctl restart smbd

26 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of PuTTY highlighting the command to restart Samba

13. (Optional) Add a user by entering these commands:


a.

sudo adduser nasowner

b.

sudo smbpasswd -a nasowner

Be sure to give this new user a password.

Accessing the NAS

27 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of Windows 11 with the Raspberry Pi NAS displayed

Finally, you can use File Explorer in Windows 11 to manage your files on the NAS:

1. Open File Explorer.


2. Click on the three dots in the Navigation Pane and choose Map Network Drive.

28 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of Windows 11 highlighting the steps to map a network drive

3. Pick a drive letter and enter the IP address of the Raspberry Pi, followed by the
hostname you added in the sbm.conf file in the name field.
4. Press the Finish button.

29 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

A screenshot of Windows 11 highlighting the steps to connect to a Raspberry Pi


NAS

5. If you added a user before, enter the username and password to log in to the
Raspberry Pi.

Creating a personal NAS-berry Pi server


And that's it! If you have followed all the steps correctly, the samba-folder will be
open, and you’ll be able to store and retrieve all your files in the newly created NAS.

That said, a Raspberry Pi-based NAS server is unfit for large projects due to its lack of
SATA connectivity and limited support for RAID configurations. If you’re looking for a
powerful device to manage all your professional workloads, you should instead
purchase a high-end NAS enclosure or convert an old PC into a makeshift NAS.

Raspberry Pi Storage

30 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

  Like  Share

Readers like you help support XDA. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.

31 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

 RECOMMENDED
A Raspberry Pi can't replace everything. The Raspberry Pi air monitor

Raspberry Pi Raspberry Pi

5 products my Raspberry Pi can t Someone built their own portable air


replace quality meter with a Raspberry Pi,...
As varied as the uses are for a Raspberry Pi, it's Check the air, no matter where.
not quite a ubiquitous PC. There are a few
products my Raspberry Pi still can't replace.

Sep 27, 2024 4 days ago


 14  5

The Ayaneo Mini PC AM02 with cables connected. Anker 553 USB-C Hub on desk connected to laptop and monitor

NAS, IOT, and everythin... Home Office

Ayaneo Retro Mini PC AM02 review: A Anker's 8-in-1 USB-C hub is now 39%
powerful mini PC with a great design off as it falls to its lowest price ever
The Ayaneo Retro Mini PC AM02 is another mini Looking to expand with more ports? This Anker
PC from Ayaneo, and it's capable of quite a bit compact USB-C hub is just the thing.
more than the first.

Feb 25, 2024 Feb 27, 2024


 

The Lock Screen on the HP Pavilion Plus 14. Text reading '11 23H2' over a gradient blue and purple background

32 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

Link copied to clipboard

Windows 11: Everythin... Windows 11: Everythin...

How to limit battery charge to 80% on Want Windows 11 version 24H2 right
Windows 11 now? Here's how to download it
Keeping your battery constantly at 100% can Get the latest features and security updates
reduce its lifespan, but many Windows 11 laptops
lets you limit the maximum battery charge to 80%.

Dec 19, 2024 Dec 21, 2024


 8  7

Join Our Team


Our Audience
About Us
Press & Events
Contact Us

Follow Us

     

Advertising
Careers
Terms
Privacy
Policies

XDA is part of the Valnet Publishing Group

33 of 34 1/5/25, 08:16
How to make a NAS with Raspberry Pi https://www.xda-developers.com/make-nas-raspberry-pi/

Copyright © 2025 Valnet Inc.

34 of 34 1/5/25, 08:16

You might also like