The fast pace of technological progress is great, but it does mean that hardware soon becomes redundant. This begs the question: what do you do with that old PC gathering dust in the attic? Apart from selling it or giving it away, another option is to turn it into a network-attached server for storing files, media and backups. For this purpose there are several specialist distros to choose from, including FreeNAS and OpenMedia Vault. However, to encompass as much older hardware as possible, we’ll be using NAS4Free – a legacy version of FreeNAS – since it has lower system requirements. Officially, it only requires 512MB of RAM to work, but you may be able to get away with as little of 256MB for the Full version.
We’ll show you how to install NAS4Free on your old PC and then access and configure it remotely from a client PC via its web-based GUI. You can then schedule regular remote backups of selected folders using rsync and cron (or Windows Backup or OS X Time Machine). We also cover other uses including UPnP media streaming and downloading torrents (using the built-in Transmission) – you could even set up ownCloud hosting. So dust off that old PC and let’s get it working for you again!
Spare PC with at least 512MB of RAM
Step 01 Download NAS4Free
You can find the latest NAS4Free files at SourceForge. Choose either a Live CD ISO or Live USB IMG file, depending on whether you want to boot it from CD or USB. Also, select the correct version for your PC: x64 (64-bit) or x86 (32-bit).
Step 02 Boot it up
After setting the BIOS on your old PC so it’ll boot first from CD (or the USB stick), insert your live disc/stick and boot it up. NAS4Free will go through the boot process, which may take a while to complete.
Step 03 Choose install method
Eventually you’ll get to a Console Menu. Enter 9 to install from your live CD/USB. In the next menu, choose option 2 to install it on the PC’s hard disk (or 1 if you want to run the OS from a USB flash drive).
Step 04 Install to disk
Hit OK on the next menu, choose the installation media and destination media, then say No to a swap partition (unless you have very little RAM). NAS4Free will then be installed on the chosen disk. Note the DATA partition parameters.
Step 05 Configure LAN interface
Now remove the live CD/USB and reboot the computer. After the bootup process, you’ll end up back at the same Console Menu. This time, enter 1 to select your Ethernet interface (probably from just one option).
Step 06 Configure IP address
Back at the Console Menu, enter 2 to configure the network IP address. Say No to DHCP and enter a static IP. Press Enter to accept the default subnet mask. Use your router’s IP address as the default gateway and enter your favoured DNS.
Step 07 Access web GUI
With the basic setup done, you can now access your NAS4Free server from another PC. Just enter its IP address in a web browser and you’ll see the NAS4Free web GUI. The default username is ‘admin’, with password ‘nas4free’.
Step 08 General settings
For extra security, you can change the username and password via System>General – click the Password tab to change it. The General menu also enables you to alter settings such as DNS and time zone.
Step 09 Add disk
Go to Disks>Management and click the ‘+’ on the right. Choose your hard disk from the drop-down, then the file system for a preformatted disk – if it’s not, you can format it via Disks>Format. Click Add at the bottom, then Apply Changes.
Step 10 Add mount point
You need to add a mount point for the disk. Go to Disks>Mount Point and click ‘+’. Choose your disk from the drop-down, keep UFS file system enter partition number 1 and then a mount point name. Click Add, then Apply Changes.
Step 11 Enable sharing
Go to Services>CIFS/SMB and click Enable. Click the Shares tab, then ‘+’ and enter a name and comment. Click ‘…’ for Path and choose your mount point name from the pop-up. Click Add, then Apply Changes. Click the Settings tab, then Save and Restart.
Step 12 Remote access
You can now access the shared folder from the file browser of another PC – Browse Network>Windows Network>WORKGROUP>NAS4FREE>shared folder. Create a Backups subfolder in it, to separate them from shared files and media.
Step 13 Set up rsync
On the web GUI, go to Services>Rsync. Click the Modules tab, then enter a name and comment. Hit the Path ‘…’ button, select your mount point and Backups subfolder. Click OK, Add, Apply Changes. Click Settings tab, Enable, then Save and Restart.
Step 14 Start up SSH
We’ll want to use rsync with SSH to back up files securely from the client computer to our NAS4Free server. In the web GUI, go to Services>SSH and click Enable. Tick the ‘Permit root login’ option. Then click Save and Restart.
Step 15 Back up with rsync
Now let’s try a manual backup from the client PC. While you can run rsync from the command line, we’re using Grsync – a GUI frontend – for ease of use, particularly when choosing options. Choose the folder to back up, then enter the destination: root@[NAS4Free IP]:/mnt/[mount point]/Backups. Click the gears icon and a dialog will then prompt you for a passphrase: enter your NAS4Free password (default is ‘nas4free’). The backup will then proceed. This is fine for manual backups, but for automated ones we’ll need to set up SSH password-less, key authentication.
Step 16 SSH login
Setting up SSH key authentication (see bit.ly/1zGfaug) is done from the command line. First, open a terminal and enter:
$ ssh -l root [NAS4Free IP]
Type ‘yes’, then enter the password to log in to your NAS4Free server.
Step 17 Generate SSH key
Now we can generate a SSH key pair, just by entering:
Press Enter to accept the default file location, then Enter to set an empty passphrase and Enter again to confirm it. Your SSH key pair will then be generated.
Step 18 Rename public key
Rename your public key with:
mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
Then log out with:
Copy the private key to your client PC with:
$ scp -p root@[NAS4Free IP]:~/.ssh/id_rsa ~/.ssh
Enter the password, then SSH in (step 16) and you won’t be asked for a password.
Step 19 Automate backups
You can now automate backups with cron.
In the terminal, enter:
$ crontab -e
Copy and paste your rsync command into a new line at the bottom, preceded by the time and date fields – it’s mins, hour, then * * * for a daily backup at that time, so for a 2pm daily backup you’d use:
00 14 * * *