OpenSource For You

Build Your Own Home-Grown NAS with an Old Computer

For those wondering if they could get rid of all the external hard drives and cables lying around, or find a way to use that ancient CPU or laptop gathering dust in a cupboard, a Linux server could be the answer. Servers are incredibly useful even at home

-

What are servers, and why do I need one? A server is often just a computer that stores your data and serves it to other computers on the network. In a household scenario, it can be hidden away in a corner of your room— a target for all your device backups, and source for all your media to your devices. Specifical­ly, such a set- up is called ketwork- Attached Storage ( kAS).

There are a lot of out-of-the-box solutions to create a kAS, but most of them are very expensive or don’t even come close to the kind of customisab­ility that rbuntu Linux can provide. rbuntu is one of the best and the easiest to LnsWDOO DnG usH flDYRuUs RI /Lnux, DnG WhDW Ls why wH DUH using it for our kAS box.

So what do you need to get started? There are different YHUsLRns RI UEunWu DYDLODEOH, DnG PRsW shRuOG wRUN finH IRU our purposes, but in this article, we will follow the easiest method of installati­on. This is what you will need:

A PCLlaptop with a minimum of 512 MB of RAM and a 1 dHz processor, and a minimum of 5 dB free space for your server. It is recommende­d that you set up your server close to your router, so you can use a wired (Ethernet) connection instead of Wi-Fi—that is much faster. An rbuntu live CD, downloaded from the rbuntu website. We will be using the Desktop version rather than WhH SHUYHU YHUsLRn, sLnFH LW’s HDsLHU WR FRnfiJuUH DnG sHW uS. YRu FRuOG DOWHUnDWHO­y EuUn WhH LPDJH WR D USB flDsh drive as well, if your soon-to-be server machine does not have a CD drive. Links to help you do this are given at the end of the article. Hard drives to store your mediaLback-ups. You don’t need to get new hard disks for this; we will be sharing the content on your existing disks. You could always plug in more storage if you plan on buying new hard disks.

Setting up Ubuntu

Before beginning the installati­on, make sure you back up any existing data on your soon-to-be server, and that you have at least 5 dB of free space. To begin, insert the CDL USB flDsh GULYH LnWR yRuU sHUYHU PDFhLnH DnG ERRW LW uS. ,I your machine is not set to boot from a CDLrSB, you may need to press F12 to enter a one-time boot menu and select CDLrSB, or you could change the boot device priority in the BIOS settings (but make sure you change it back, if you’re going to be using external disks for storage—which is the likely scenario, if you are using an old laptop for your server, like I am). Your system’s start-up screen will tell you how to enter the BIOS set-up screen.

After booting into rbuntu, select the Install Ubuntu option and follow the onscreen instructio­ns to set up a dual-boot or single-boot system, based on your preference­s. Also, make sure you select Log in automatica­lly when you are creating a user account, so that you have a single-button power-up sequence, which doesn’t need any action from you during start-up.

The server set-up

At this point, I assume you have rbuntu set up successful­ly and are booted into it. kow for the server setup: plug in your external drives if you haven’t already, and click the rbuntu Dash (the button with the rbuntu logo) and search for Terminal. rbuntu has built-in support for kTFS, so your drives should ideally work out-of-the-box. If you are configurin­g new drives, you can format them as ext4 for better Linux compatibil­ity. rbuntu supports HFS-formatted disks (the native format on Macintosh computers) as well, as long as journaling is disabled on them; but for the purposes of this article, let us assume your disks are formatted as kTFS or ext4.

Step 1: Mount-points: In the terminal, run the following commands as explained below:

sudo mkdir /path/to/mountpoint sudo chown userName /path/to/mountpoint

Replace /path/to/mountpoint with a folder in which you would like to mount your hard disk. For example: sudo mkdir /media/BackupDisk sudo chown sumit /media/BackupDisk sudo mkdir /media/MovieDisk sudo chown sumit /media/MovieDisk

Enter your password when you are prompted for it. Repeat the commands for each hard disk you have connected to the system.

Step 2: Auto-mounting: kext, run the following command in the terminal:

sudo blkid

This command should result in an output that looks something like what follows: /dev/sda1: TYPE=”ntfs” UUID=”A0F0582EF0­580CC2” /dev/sda2: UUID=”8c2da865-13f4-47a2-9c922f3173­8469e8” SEC_TYPE=”ext2” TYPE=”ext3” /dev/sda3: TYPE=”swap” UUID=”5641913f-9bcc-4d8a8bcb-ddfc3159e7­0f” /dev/sda5: UUID=”FAB008D6B0­089AF1” TYPE=”ntfs”

Basically, what we are trying to do here is to make sure your disks mount automatica­lly every time you boot up your server. The fstab RU fiOH sysWHPs WDEOH Ls D FRnfiJuUDW­LRn fiOH

in Linux systems that lists connected disks and partitions and their initialisa­tionLmount­ing informatio­n. This informatio­n is used by the mount tool to mount your disksL partitions. So we need to start adding entries for each hard disk into the /etc/fstab fiOH. :H FRuOG usH GU, WRROs, EuW WhRsH wRuOG DGG WhH GLsNs usLnJ WhHLU GHYLFH fiOH nDPHs (/ dev/sdX). This leads to problems in some cases, when the sysWHP UHnDPHs WhHsH GHYLFH fiOHs, FDusLnJ HUURUs whLOH mounting disks. That is where rrID comes to the rescue. UU,D (UnLYHUsDO UnLTuH ,GHnWLfiHU) HnDEOHs yRu WR unLTuHOy identify your disk; and it does not change with every reboot, OLNH WhH GHYLFH fiOHs GR. UU,D Ls FRnFHSWuDO­Oy sLPLODU WR WhH MAC address for a network card.

In the terminal, run sudo gedit /etc/fstab to open a text editor window (like kotepad on Windows). Add an entry to WhH HnG RI WhH fiOH Ln WhH IROORwLnJ IRUPDW, IRU HDFh RI yRuU connected disks’ partitions:

UUID=Your-UUID /path/to/mountpoint fs-type defaults 0

You will need to copy the rrID from the list generated by the blkid command. Here, /path/to/mountpoint is the address to the directorie­s you created in Step 1. For example: UUID=A0F0582EF0­580CC2 /media/BackupDisk ntfs defaults 0 0 UUID=FAB008D6B0­089AF1 /media/MovieDisk ntfs defaults 0 0

1Rw sDYH DnG FORsH WhLs fiOH. YRu shRuOG EH DEOH WR sHH DOO yRuU GLsNs Ln WhH OHIW hDnG sLGHEDU RI yRuU fiOH HxSORUHU (kautilus). However, these disks are not mounted yet. You can click on them individual­ly to mount them in the folder you have HnWHUHG Ln yRuU IsWDE fiOH (/PHGLD/ Ln RuU FDsH). 7hH nHxW WLPH yRu boot up your machine, this should happen automatica­lly.

Sharing your drives on the network

kow that the basic set-up is out of the way, and your disks are usable by the server, you need to get down to some actual ‘serving’. You need to share the connected disks on the network.

Sharing with Windows/Mac

In the terminal, run gksudo nautilus; this starts up the rbuntu file manager with root permission­s. The difference between sudo (which we used earlier) and gksudo is that sudo is used to run command-line applicatio­ns as the root while gksudo is used to launch drI applicatio­ns as the root. It is pretty similar to the ‘Run as administra­tor’ command in Windows. Right click on each drives in the left sidebar and click ‘Properties’ and select ‘Share’. Select the “Share this folder” check box in the window that comes up (Figure 1). The first time you do this, rbuntu should ask you to install the Windows file sharing service, Samba (Figure 2). Install whatever it asks you to, and then restart the session when prompted.

Start kautilus from the terminal as the root again. do back to the Share properties panel for a disk, give it a name, and select the ‘Allow others to create and delete filHV Ln thLV IRldHU’ option. Choose the ‘Add the permission­s automatica­lly’ button on being prompted (Figure 3). Click ‘Create share’. Repeat these steps for all your drives.

Finally, we need to set up a password for all the shares you have set up. You can do this by running the following command in the terminal:

sudo smbpasswd -a userName

Replace userName with your rbuntu username (which yRu FUHDWHG GuULnJ LnsWDOODWL­Rn), DnG WhHn WySH DnG FRnfiUP D password for the share. Your password can be anything and is not necessaril­y your rbuntu user account password. However, the username needs to be a valid rbuntu user, otherwise this command will fail. Once you enter your share credential­s, you should be able to see all your shared disks. You can also right-click the share and select ‘Map network drive’ to assign a drive letter to the share. This will also give it a place in

 ??  ?? Figure 1: Sharing options
Figure 1: Sharing options
 ??  ??
 ??  ?? Figure 2: Install Samba
Figure 2: Install Samba
 ??  ?? Figure 3: Add permission­s
Figure 3: Add permission­s

Newspapers in English

Newspapers from India