Building a cheap NAS

Do you have an old computer laying around? Do you want to have easy access to all of your files and folders?

If the answer to these questions is yes, then follow me and let’s build a cheap NAS (Network Attached Storage) together!

This is the end result:

Our goal here is to create a Network storage location, accessible for anyone on the network, no matter what device they are using. I tested mine with Windows and Android, but it should work with Linux as well.

Note: Using VPN you can access your NAS remotely and securely. Click here to learn how to create your own 35$ VPN server.

What is a NAS?

Network-attached storage (NAS) is a file-level computer data storage server connected to a computer network providing data access to a heterogeneous group of clients. NAS is specialized for serving files either by its hardware, software, or configuration. It is often manufactured as a computer appliance – a purpose-built specialized computer. NAS systems are networked appliances which contain one or more storage drives, often arranged into logical, redundant storage containers or RAID.Network-attached storage removes the responsibility of file serving from other servers on the network. They typically provide access to files using network file sharing protocols such as NFS, SMB/CIFS, or AFP.

 

Parts used:

  • Old Dell computer (any old PC should work, but having SATA ports and RAID support are big bonuses; I used a Dell Optiplex G520)
  • 1 TB HDD (the capacity depends on what your storage needs are)

Software used:

 

Hardware

There’s not much to it. Just make sure your computer is powered on and is connected to the network.

In my case I also did a slight modification of the design. Because I had a HDD laying about, I decided I want to add it to the NAS. But, this was a problem since there was no room in the case for an extra drive. So, after a bit of tinkering I managed to fix it inside the CD Rom bay. Note that this is a 2.5” drive.

A 1 TB drive mounted inside the CD Rom bay

Software

1. OS

First of all, just install Ubuntu Server the normal way. I used the server version because it is lighter on resources.

Here you can find a great guide if you’re not sure how to proceed. I recommend setting a secure password, as this will be a network connected device.

You should also assign a static IP to your server now, and note it down.

2. Extra drive (optional)

If you have added a new drive in the system you need to:

You should also create a directory which will become the network share now. In my case I used /data.

Since only an admin can create files and folders under the root of the system (/). To achieve this use:

sudo mkdir /data

sudo chown [username] /data

3. Installing and configuring samba

In order to create network shares, we will use an utility called samba. You can install it using the following commands.

sudo apt-get update
sudo apt-get install samba

Next, we have to set a password for our samba user (this is a different password from you login one)

sudo smbpasswd -a [username]

Good. Now, we have to tell samba which folders should be available to the network.

sudo cp /etc/samba/smb.conf ~ #create a backup of the config file

sudo nano /etc/samba/smb.conf

Now, you should add these lines to the bottom of the file:

[somename]
path = /home/username/foldername
valid users = username
read only = no

Note: mind the spaces before and after the equal signs. Replace foldername and username with your own data

So, in the case of my /data folder, I need to write this to the config file:

[Share]
path = /data
valid users = [my_user]
read only = no

Now, we need to restart the samba service, and check that everything is all right:

sudo service smbd restart

testparm

Accessing your share

1. Windows

Open the File Explorer and go to the network tab. There you should see your machine, and other devices connected to your network. If it asks you whether you want to discover other devices on the network accept.

2. Android

Download and install the free app ES File Explorer. In the left menu, go to Network -> Lan. Click the big plus on the lower right side of the screen. And add your server’s details (IP, username and password; you can also set a display name here if you wish). After you click done, it should appear as an icon on your screen. Just tap it and you’re in!

Note: you should be on the same network as the server for this to work

Ideas for the future

  1. Set up either RAID or a backup system
  2. Keep the computer turned off when not needed and use Wake on Lan to turn it on (tutorial coming)
  3. Use a VPN to securely acess your NAS from anywhere (VPN tutorial)

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.