Setting up a Home NAS / File Server

Build a Home NAS

Scope of this Article (NAS)


This article will cover how to create a NAS Server for your home. I am going to talk about several ways to do this and how to go about configuring a NAS with Linux on a PC. If you would like to see certain points covered, just let me know in the comments section. I am not going to cover the most efficient way to create a NAS, but what works for me. My main reasons are 1. Duplicate my data so it is safe 2. Not use any propriety hardware like RAID Controllers which could fail and cause data loss 3. Cost – Keep it at a reasonable cost


The two topics I will cover are

  • Setting up a Linux NAS Server
  • Buying a NAS in a Box Solution.


There are many choices of Home NAS’s out there today which you could consider depending on what you looking for. One of the common solutions and well known is the Buffalo NAS Solution such as the Buffalo Link Station 210 .This is a easy solution in a box. If you looking for a no fuss solution, then take a look at the Buffalo Series, they have been around for a long time. There are various models and the price has come down quite a bit than when they first launched. They start around $150 – $200 without hard drives and some of them include hard disks, so look out for that.


Buffalo NAS in a Box

Buffalo NAS In a Box ModelsBuffalo NAS In a BOX

The more expensive version can be found here TeraStation 1400 4-Drive 8 TB Desktop for Home Office which does include hard disks and is an all around solution. If you looking for simple home NAS management, then a NAS In a box is for you. My only issue with these types of devices is your data is been managed by a NAS Solution and you don’t really have a lot of control of it. Sure it comes with some nice neat cool features like Raid 1 & 5 or whatever the latest RAID  fad is and overall this is fine. For me I like to be in control of my data. Another nice thing about this NAS in a BOX is it has RAID 5 type technologies, what this essentially means in layman’s terms is you get a bigger bang for your buck, hence you get more space, since it creates a RAID across the disks.


Product Highlights

Some of the features you get with these units are pretty cool. As I already mentioned the different RAIDS for either redundancy / performance or more disk space since you raiding across multiple disks. It is worth while reading up on RAID levels that you can make an educated decisions. Here is a quick comparison with RAID 5 vs 10. Personally I would recommend using RAID5 unless you need the performance else consider RAID 6 or 10 depending on what your unit supports.


  • Ideal for small businesses, home offices, and power users
  • Hot-swap SATA hard drives
  • RAID 0/1/5/10/JBOD (Individual Disks)
  • Hot-spare
  • 1.2 GHz dual-issue ARM processor, 512 MB DDR3
  • USB 2.0 port with accessory support
  • Active Directory integration
  • Disk quota support
  • Scheduled or real-time replication to other TeraStation devices
  • 10 free licenses of NovaBACKUP Business Essentials v14


QNAP Nas System


Another brand I can recommend is the QNAP Series, I have a friend who swears by them and has used them for over 5 years. One of the models is the  QNAP TS-453A 4-Bay Professional-Grade Network Attached Storage, Supports 4K Playback which is one of the more recent models.



== Product Highlights ==

  • NAS and iSCSI-SAN unified storage solution for server virtualization
  • Supports VMware, Citrix, and Microsoft Hyper-V and advanced virtualization features
  • AES-NI hardware-accelerated encryption for efficient cryptographic performance up to 412 MB/s
  • Supports hardware decoding and transcode 4K (H.264) videos on-the-fly or offline
  • Dual HDMI outputs for switching between mirroring and extended desktop options
  • Supports the Linux OS with direct output via HDMI
  • Equipped with 24-bit digital to analog converter (DAC) for amplifier and clear audio



Building your own NAS System


The HOME NAS I wanted to talk about meet some relatively simple objectives, if these objectives are for you, please read on. I am choosing Flexibility over HIGH Performance and data security without the fuss as time goes by

  • Fairly simple to setup and maintain
  • Easy to recover from a failure
  • Easy to upgrade disks to larger disks without impacting the NAS or having to try recreate a logical volume.
  • Keep old disks as backups should you have a complete failure or mishap
  • Raid 1 type redundancy (more costly)
  • Encrypted Disks. I think now days everything should be encrypted, this has added complexity and pro’s and con’s. If you are keeping sensitive information, tax forms, sensitive photo’s etc, you should be seriously considering encryption. If someone breaks in and steals your computer or NAS, you want to make sure it is safe. Most thieves typically won’t care about data, but depending on your circumstances, they might.

What I was not so much concerned about although would of been a nice to have

  • High Performance
  • Saving disk space or having large capacity when using RAID 5.


Negative side of RAID Controllers in the home environment


What I wanted to stay away from was a situation where I lost my data either due to a disk failure or unable to replace the hardware due to age such as a raid controller. In a RAID 5 environment your data is spread across 3 disks or more and losing one of those disks without a proper controller would mean data loss and complicate things generally. Now days it is mostly hardware that does this so you don’t have to worry.

Raid controllers are great when they work, but if you unable to replace them, you may have no data which will be a disaster if you rely on your NAS.

Take for example your RAID controller works fine and before you know it, 5 years has passed. The chances of you getting the same type of controller are slim to none in this fast moving hardware world.

I also want to be in control of my data and how it is backed up, accessed, encrypted, see it, use it and copy it if you needed to recover a file, typically what you would expect from a file server.


Building your NAS out of PC components


== Hardware Requirements ==

  • Suitable Server/PC with a basic configuration (We will talk a bit about the components)
  • A Case with Hard Disk Expansion and lots of cooling to keep your disks cool
  • A decent PSU (Power Supply Unit) 600 Watts and Above
  • A motherboard with 4-6 SATA connections or more, at minimum I would get at least 4 SATA Connections
  • A minimum of 2 Hard disks to start with (you probably want to build it up to 4 disks or more), 1-2TB and up. I would recommend a minimum of 2 x 2TB Disks + 1 Disk for the Boot disk. My preference is Seagate, but you can choose what you like.


Here my recommendations, you can choose what you like. Remember we trying to keep this cheap, it’s simply a file server and not your main PC.


Building a PC vs Buying a preconfigured PC ?


It is up to you if you want to build your own PC or build it from scratch buying components. Many local stores will build you want to your specs and you can tell them what you want in it. I have build computers in the past, but have no interest in trying to get everything to work, I would either buy a preconfigured computer (just make sure it has the 6 hard disk bays) and the motherboard with 6 SATA connections or more and have a local computer store build it for you. You can provide a list of parts you want them to use and have them build it to your spec, that way they will make sure it works and you take no risk in destroying a part. That been said, if you enjoy tinkering with computers and like building computers, here are some components you use. Do your research and buy the ones that your comfortable with and are within your budget. You should be able to build a decent computer for under $500.


Computer Case

Take a look at the Antec line of cases, they have some really inexpensive cases and some nice looking ones, here is one I bought many years ago, but there are many different types on the market. I like this one for the look and for the fact it can take at least 6 Hard Disks. I currently keep 5 Disks in Total (4 Data Disks and 1 Boot Disk).

  • A decent case for cooling your hard disks. I recommend the Antec 900 that can handle many 9 hard disks and has 7 fans for cooling. This is a really cool and inexpensive case. The 7 fans keep the hard drives as cool as anything. The fans also have a speed control, so you can make the hard disks super cool, definitely consider it.


You can get some cases for as low as $25 US and at the end of the day, they just going to serve your disks, so I wouldn’t go too crazy on the cost and look if you can avoid it. Get one with man bays and can take 3-4 fans, because you going to want to keep your disks cool. As a note, the more fans you have the more likely the case will collect dust, just an fyi


Antec Nine Hundred Black Steel Computer Case



I am a big fan of ASUS motherboards, but now days you can’t go wrong with the various brands out there. Look for one with 6 SATA connections, you don’t have to worry about the other fancy video connections etc. To reduce cost, just board one with all you need on a single board, Network Connections, WIFI if you want (I would still recommend a hard wired connection for a File Server.




Hard Disks

As I already mentioned I am a fan of SEAGATE Hard Disks .. I have a low failure rate. A lot of people swear by Western Digital, so buy the brand you comfortable with. Here is an example for the Seagate


I recommend you look at either the 4TB or 8TB Disks. Try to get a disk with 5900RPMS and try stay away from the 7200 RPMS unless you getting the 8TB Disk.

Seagate Barracuda 4TB ST5000DM000                     Seagate Archive HDD 8TB SAT         Western Digital 4Tb SATA 6.0Gb/s 5400 RPM


For your Internal disk you can just get the cheapest smaller disk, either a 1TB, 2TB or even a SSD, just make sure you can run SSD Disks and Regular hard disks on the same motherboard

== Software Requirements ==

# Mint Linux (Current version) and up or any recent release 18.x etc
# Samba which should come preinstalled, but you may need to install it separately
# Truecrypt if you need or want encryption for your data. [ Truecrypt]. I will talk about Truecrypt in a bit and how the developers tried to kill it off.

== Setting up your NAS ==

# Install your preferred version of Linux
# Install SSH (apt-get install ssh) or just load up the software manager and install the feature software packs. Mint does a good job at allowing you to search and install packages with ease now.
# Install [[Truecrypt]]. You will need to download this 
# Verify all your disks are setup by going to System -> Administration -> Disk Utility / Gparted. You should see 3 Disks, 1 Boot disk and 2 Data disks.



Gparted Overview



Let;s talk a little bit about Truecrypt, it is really a great piece of software and make no mistake, you can and should still use it. If you do research you going to see a whole bunch of conflicting messages. I think what happened is the government was forcing the developers to create a back door which they refused so they tried to kill it off. That been said, it is worth while reading this page

Gibson Research is a well known name when it comes to security and if you were like me in the old days used them to scan your PC for vulnerabilities. This is the final resting home of Truecrypt and you can safely download the last releases. Make sure you download the 7.1a version and not any later version which will contain warnings in them. 7.1a is the version you want.

TrueCrypt Encryption Software





True crypt download

For Linux you can download it here.

Linux 64 Bit: truecrypt-7.1a-linux-console-x64.tar.gz

Linux 32 Bit: truecrypt-7.1a-linux-console-x86.tar.gz

Configuring your Disks

  • For each physical disk, create a file system on it such as /dev/sdc1, /dev/sda1. You can choose what ever file system you want, I chose ext3 or your can use ext4. This takes about 30 mins or so for a 2TB disk.
  • Once you have the file systems created, you can choose to encrypt the file systems or not. I am going to walk you through the process at a high level on how to encrypt the disks (I may create a separate Wiki for this). But it is really no different than creating a Linux file system perspective.
  • TrueCrypt comes with a gui now, so encrypting devices is fairly straight forward, here is a quick command line tutorial which does the same thing
  • Encrypt the entire disk, but you can also choose to create hidden volumes instead, but I recommend a full disk encryption as it is easier to manage

Once you have encrypted your volumes, you can just mount them with a simple script (I will provide you with my VERY simple script 🙂 ) or you can just  load the gui, but this is more of a pain if you have multiple file systems, it’s ok with one file system, but in my case I have 4 disks with 4 encrypted file systems on them.

Once you have the file systems mounted, you should have something like this

# df -h

Filesystem              Size  Used Avail Use% Mounted on

udev                    704M   12K  704M   1% /dev

tmpfs                   144M  1.4M  143M   1% /run

/dev/dm-0               457G  7.3G  427G   2% /

none                    4.0K     0  4.0K   0% /sys/fs/cgroup

none                    5.0M     0  5.0M   0% /run/lock

none                    720M   76K  720M   1% /run/shm

none                    100M   32K  100M   1% /run/user

/dev/sde1               236M   85M  140M  38% /boot

/dev/mapper/truecrypt1  3.6T  1.9T  1.6T  55% /fs2

/dev/mapper/truecrypt2  3.6T  1.9T  1.6T  55% /fs3

/dev/mapper/truecrypt3  1.8T  1.4T  365G  80% /fs4

/dev/mapper/truecrypt4  1.8T  1.4T  365G  80% /fs5


As you can see I have 4 File Systems, I have 2 x 4TB Disks and 2 x 2TB Disks in my system.  The nice thing is if I lose any 1 disk, it won’t impact me in anyway. If I lose both of my disks (either the 2TB or the 2 4TB) I am hooped, but the likely hood of that is low.


File System Mounting Script

I have a  very simple script which I run after I boot up my machine. I think I read there is a way to load a key file but I kind of think this defeats the purpose if someone else can potentially mount the disks. Not sure, feel free to comment. I like to manually mount my disks and enter in the passwords, makes it feel more secure. The downside is if I ever forget the password (I am getting old), I will lose everything.

#!/bin/bash -x

df | grep fs2
if [ “$?” -ne “0” ]
truecrypt /dev/sda /fs2

df | grep fs3
if [ “$?” -ne “0” ]
truecrypt /dev/sdb /fs3

df | grep fs4
if [ “$?” -ne “0” ]
truecrypt /dev/sdc1 /fs4

df | grep fs5
if [ “$?” -ne “0” ]
truecrypt /dev/sdd1 /fs5

Disk Replication / Rsync Disks

In order to keep your disks in sync, put a rsync script in cron which syncs your file systems

# m h dom mon dow command

00 01 * * * /fs2/

Replication Script (

#!/bin/bash -x

rsync -a -v –delete /fs2/ /fs3 rsync -a -v –delete /fs4/ /fs5

Samba / File sharing

Once you have your disks up and running, you now need to setup samba.

  • Edit /etc/samba/smb.conf and add your shares.
  • Restart Samba /etc/init.d/samba restart
  • Try connecting from your PC to your NAS Server IP and your share name.



# more /etc/samba/smb.conf
workgroup = MYGROUP
server string = VMS Server
hosts allow = 192.168.2., 192.168.1.
; printcap name = /etc/printcap
load printers = yes
printing = lprng
; guest account = smbuser
log file = /var/log/samba/%m.log
;max log size = 0
security = user
encrypt passwords = true
smb passwd file = /etc/samba/smbpasswd
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
dns proxy = no
log level = 2
debug level = 2
unix extensions = No
spnego = no
stream support = no
ea support = no
darwin_sreams:brlm = no

path = /fs2/Folder
writable = yes
valid users = root,smbuser,[your username]
browseable = yes
public = yes


path = /fs2
public = yes
only guest = no
writable = yes
valid users = [your username], root
browseable = yes
public = yes



path = /fs4
public = no
only guest = no
writable = yes
valid users = [your username], root
browseable = no

comment = Home Directories
browseable = no
writable = yes
create mask = 0700
directory mask = 0700



Please comment below and let me know what you think of this article and if there is anything I could add to improve it.


Thank you