How to build and setup your own Network Attached Storage (NAS) Server with Linux

How to build and setup your own Network Attached Storage (NAS) Server with Linux

What this document will cover

  1. How to spec out your parts (RAM, CPU, Mobo, RAID Cards, HDDs and Case)
  2. Where to buy them (suggestions, not requirements)
  3. How to install the OS drive with Linux (Ubuntu)
  4. How to install remote management software for servers with two routes
    1. Headless server, no gui, no RDP, just SSH
    2. Head(ed?) server with gui and RDP options
  5. How to install the storage hard drives so the OS sees them
  6. How to RAID the drives in different methods of RAID (optional, recommended)
  7. How to set up stores on those drives which are shareable on a local network
  8. How to connect to those shares from different clients (Windows, Mac, Linux, possibly some mobile devices on same network)
  9. How to set up Plex Media Server with multiple libraries reading different folders
  10. How to set up external access to your Plex Media Server securely
  11. How to set up downloader programs on your server
  12. How to set up automation processes to notify of latest media, download it, clean the file names and move it into your library folders for Plex Media Server to pick up
  13. VPN/Proxy setup for downloaders

What this document will not cover

  1. Every possible scenario/combination of:
    1. Versions/Distributions of Linux
    2. Downloader clients
    3. Media Servers
    4. Router configs
  2. How to download media in a manner which is illegal in your country/locality. I do not endorse or condone piracy via this document, I’m just helping you set up a media server and there’s plenty of media out there that can be downloaded legally.

How to spec out your parts

RAM (Memory)

Most of the pre-built NAS boxes will have 512 MB to 2 GB of RAM. The more you expect the box to do, the more RAM you will need and since RAM is pretty cheap these days, I would suggest picking up 2 sticks of 2GB for a total of 4GB. If you find your server is running slow and monitored the RAM as idling at significant usage

CPU (Processor)

Since AMD and Intel are pretty much the same when it comes to non-super gaming rigs, take your pick. My suggestion is for at least a dual core processor. This helps with the OS, multi-streaming and other things.

 

Plex has a decent guide on picking that are processors powerful for your needs enough here. Remember though, you are building something you should be expecting to last the next 3+ years. In that time, are you getting married (extra stream), are your kids going to be old enough to have their own computers (extra stream(s)), are you going to give yourself access to your server externally, possibly with your friends too (extra stream(s)). Are you going to run downloaders, syncers, additional transcoders, and god knows what else? All these things add up, so pick something you think will future proof yourself without breaking your piggy bank.

 

Side-Note: Someone wanted me to mention that Intel processors produce less heat. The generic-ness of that statement would lead to some misconceptions about the thermal index of your average processor because the brand has nothing to do with it. In reality, just making a NAS to stream from, even multiple streams, you aren’t going to run your processor into a boiling puddle of silicon unless you forgot to put a heatsink on it. If you want to learn more about heat dissipation for processors of different types over time, check out this wiki article. The number you are looking at for most of them in the last couple generations are 130W and 90-95W. The higher the number, the hotter the CPU is naturally intended to sit at, just get an appropriate heat-sink (or fan or heat-sink fan combo, or go totally nuts and grab a water cooling block).

Motherboard (Mobo)

Picked your CPU and RAM? Great start, now find a motherboard to match. You want to make sure you have the following capabilities on the board:

  1. SATA ports – As many SATA III (SATA-3) 6 Gbps ports as possible. Running drives directly off the board works wonders. If you can’t get 6 Gbps ports because of your budget, then shoot for 3 Gbps ports.
  2. PCIe slots – Unless you are getting specialized RAID cards that most people don’t need or want to deal with, you are probably going to buy PCIe based RAID/Expansion SATA cards. The more PCIe slots you have to drop cards in, the better. NOTE: The most you will probably ever need is 3 slots, I get by just fine with 2. Also, the more slots there are the more expensive the board will be, as the ones with more slots are generally gaming boards.
  3. PCIe revision – Just a couple years ago, PCIe 3.0 spec was released followed by boards that ran with that spec and made it freaking awesome. The bandwidth that these slots can do is amazing compare to PCIe 2. Again, if you can’t find a decent board without breaking the bank, 2.0 will still work just fine

Power Supply

Hard drives are pretty easy to power, and you can run multiple splitters for SATA power ports off of single Molex ended strands from a power supply. The one I use is around 500W, you definitely need over 200W but you certainly don’t need a 1000W supply, or even a 600W. Find what fits your budget.

RAID Cards/SATA Port Extenders

When you get to having a whole lot of drives, you will find you run of SATA ports really quickly. That’s where the cards come in. Cards will extend the number of SATA ports available to your system significantly. I have 2 RAID Cards in my computer plugged into PCIe slots, each card gives me 4 SATA ports and the speed/bandwidth of the PCIe lanes make them feel like you are plugging the drives directly into the board. Coincidentally, since each card is handling a set of drives for a RAID-5, it’s easy to assign drives to the RAID setup.

 

Side-Note: If you don’t know what RAID means, I will cover that later. Put simply, it’s a way of either boosting performance by splitting disk read/write times among multiple drives or by creating mirroring backups so that your data is always safe.

 

When looking for a RAID Card or SATA Port Extender, the first and most obvious thing is, how many ports does it have? Well, you probably want as many as you can, so look for 4-port cards. Any more in a single card and you will be getting into specialty territory which means ka-ching ($$$).

 

The next thing, a bit less obvious, is does it support Linux? And if it does, how hard is it to set it up in Linux? Do you have to compile the driver? Do reviews say it has terrible reliability in Linux soft-RAID? Check out the reviews on multiple websites like Amazon and Newegg before you buy. You don’t want all of this stuff coming together just to find out you have to start over because of a poorly chosen card.

 

The card I bought a couple of weeks ago was the Highpoint rocketRAID 640L for over $100 (USD), I chose this one because of the reviews about it saying that it worked fine in Linux after you compile the driver, which they give direct instructions on how to do (was really easy to follow). The first card I have in the system is an old Dell Perc RAID controller card I got for free from work. It’s so old I had to do a firmware update just to make it understand what 2TB is… it works just fine though, still ticking.

Hard Drives (HDDs)

Now for the most expensive part of this process. While a CPU may cost $80-$100, RAM $40, Mobo $200, RAID card $75-$125, you will be dropping $100-$250 per drive in your setup. You are welcome to skimp on other parts because they are a lot less important than the safety of the data on the drives. Hard Drives are a must have reliability component.

 

When picking drives, there are several kinds out there and the market has been moving towards showing the End User the right kind to buy for what they intend to use them. The kind we are looking for here are built for NAS operations, they will have a moderate speed rating but most importantly, a very high (higher is better) Mean Time Between Failures (MTBF) value, a number in the millions of hours range. If you scroll down on this page, Western Digital demonstrates how different drives serve different purposes. HGST follows the same color pattern (since they are owned by WD) and I’ve seen that they are regularly cheaper without compromising MTBF, and they have a solid warranty process. Seagate, WD, Samsung are all still great companies. I would avoid any really off-brand drives like the plague.

 

If you are confused on what MTBF means in reality (how can they test over 1 million hours on a drive? that would take forever!), it’s ok, you aren’t crazy. What they really mean is they run tests on many, many production drives and run them all for a certain amount of time. Then they count the number of failures vs the number of hours logged between all the drives. For example, if you take 1,000 separate hard drives, and run them for 1,000 hours each, that’s 1,000×1,000 = 1,000,000 hours. If 1 drive had 1 failure in that entire time, that’s a 1,000,000 MTBF. They conduct this test a few times with different batches of drives to determine these statistics. 

 

All my drives except 1 at this point are HGST Red series 4TB and 2TB drives. I haven’t had a single hard drive failure in 2 years. Your mileage may vary. I don’t work for HGST and I encourage you to shop around to find the best deals, wait for weekend sales and find out for yourself. Be wary of some sites like photo & video camera equipment sellers, they may sell drives, they may even sell them cheaper, but one in particular (not linking because I don’t remember the name, it was like 18 months ago) has a terrible returns process. You will find notes like this in reviews for products, another reason reviews are so important.

Case (Chassis)

After you have selected and ordered your drives, the last thing you need to do is pick a Case or Chassis. Since you are planning for a bunch of drives, you need a computer case that can properly hold and seat each drive with care. Just stacking the drives in a box is bad for the drives and bad for your data. An example case (the one I used before the one I have now) was the Asus P90? wait… lemme look that up… this isn’t it, but it’s very close. FOUND IT it was an Antec P19X-ish model! The idea is to find a full-height tower. Since those generally have more bays for things like optical drives, you can instead mount hard drives in those spaces using hard drive mount kits (which are only a few dollars each).  They also tend to start with more space for hard drives. A user also suggested the Define R4-R5.

 

I, on the other hand, went nuts and dropped over a grand on the CaseLabs Magnum TX-10-D. I had a serious gaming rig going that needed space for a 9 120mm fan sized radiator, and that was the only case I could find that could mount such a thing. Since this is a dual pc case, I have my rig on one side and my NAS on the other. There’s literally tons of room to expand and mount drives. You definitely don’t need to do this, I’m insane and had income to spare at the time.

Parts Picker Summary

Find the parts that fit your budget, don’t be afraid to build up over time, read many reviews about a product before buying, check for sales in local electronic stores and online. Above all, don’t freak out if you make a bad purchase, that’s what returns are for and most sites like Amazon and Newegg are very forgiving about returns within 30 days if it all blows up in your face.

 

$300 Compact build-With support for 8 HDD, 3 simultaneous 1080 transcodes. Small footprint.

 

$700 Build – Support for 8 HDD standard, 14 with RAID card, SSD as boot drive, water cooling, dual gigabit lan, 4 1080 transcodes.

The rest of this guide is more technical, less long-winded BS from me 🙂

How to put your new NAS parts together

If you have never put a computer together, I’ll give you the basics, but your hardware will include more in depth instructions with it.

    1. Make sure you have the proper tools, most likely you won’t need anything more than a really short phillips head screwdriver and a really long one. I suggest an anti-static wrist strap, I’ve never actually needed one, but it’s a good cautionary item.
    2. Be careful when handling exposed parts. The tips of video cards (the part that goes directly into the mobo) are sensitive to the oils human hands naturally put out. Also, when holding a mobo, try to hold it by the corners, they are specifically made to be held that way while the rest of the board will also be sensitive to oils and such.
    3. Lay your parts out on something not carpet, a smooth flat surface like a table or hardwood/tile floor if you need the room
  • The Case
      1. Open her up and find out where your motherboard, power supply and hard drives are supposed to fit and how.
      2. Check that you have enough hard drive bays, or that you have the kits to put the drives into Optical drive spots or their own special multi-drive cages inside the box.
  • The Motherboard
      1. Carefully take your motherboard out of it’s anti-static bag or the plastic packing shell it’s in and inspect it.
      2. DO NOT remove any plastic fillers on places like the CPU socket or ram slots. These things protect the board until you are ready to insert the object that goes in that spot. CPU socket especially has pins in the socket that MUST remain straight or will cause significant issues working with the CPU when installed. I’ve personally had to take more than one motherboard back to the store because of bent pins.
      3. Follow the instructions provided with the motherboard to secure it to your Case. In most cases a motherboard should be secured with around 6 screws. Some cases will also require the screw studs to be installed to the case in the right spots first. The instructions should include placing the back plate that covers the back side of the case where your motherboard ports (like USB, sound, etc.)
  • The CPU
      1. Take the CPU out of the package (carefully, like with every other step of dealing with hardware)
      2. Lay the CPU into the motherboard’s socket in the direction required. There’s usually 1 corner with a dot or an arrow to match up with the board so you know which way to turn it
      3. Grab your thermal paste, you either got some in your motherboard package, CPU package or you bought some Arctic Silver (because you care). Slowly squeeze a thin line of paste along the top of one side of the solid area of the CPU. Using a credit card-sized and -shaped piece of plastic (I use an old medical insurance card I don’t need anymore) slowly slide the plastic across the CPU starting with the side you put the paste on. You are going for a nice, even coating. You don’t need perfection, and you aren’t layering thick peanut butter on a piece of bread.
      4. Grab your heat-sink or fan assembly, whatever and apply that onto the CPU
  • The RAM
      1. RAM is easy, get stick out of package, put stick in board, done
  • Video Cards, RAID Cards, NICs, anything that uses the other slots on the board
      1. Take them out of the package and plug those suckers in
  • Power Supply
      1. Take it out, attach it to the Case
      2. Plug in the motherboard’s power array
      3. Plug in any extra power that video cards, NICs, raid cards need
  • Hard Drives
    1. Install your primary hard drive that will store your OS (I recommend doing a single non-raid drive for this part)
    2. You can set up all you other hard drives but don’t plug in the drive cables to the raid cards or mobo yet. That will prevent you from accidentally installing the OS to the wrong drive.

Install Your OS

Latest Ubuntu Desktop: http://www.ubuntu.com/download/desktop/install-ubuntu-desktop

Latest Ubuntu Server: http://www.ubuntu.com/download/server/install-ubuntu-server

Windows Desktop: http://www.howtogeek.com/186775/how-to-download-windows-7-8-and-8.1-installation-media-legally/

Windows Server 2012: https://msdn.microsoft.com/en-us/windowsserver2012r2.aspx

Mac: https://www.apple.com/support/lion/

 

If you don’t have a legal license to the OS, you should probably get one (I’m not telling you to use any OS illegally).

 

Ubuntu Server 12.04 command line (would work for the GUI version too just open a terminal)

http://www.geeklee.co.uk/headless-plex-media-server-on-hp-microserver/

 

Now plug in the rest of your hard drives.

 

Leave a Comment

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

/* add by OCEANUS */