Monday, March 19, 2012

How to turn old hard drives into a secure file server: Tutorial

You won't need too many parts -

1. Hardware first 

hardware 1

FreeNAS is designed to boot and run from a solid-state device; either a flash card or USB thumb drive, largely as it frees up a drive port but also drive space.

 ZFS is demanding and you'll need at least 1GB of RAM, but ideally 4GB, and the boot device needs to be 16GB in size. FreeNAS's default file system only needs a 2GB boot device and less than 256MB of system memory.

2. Controller set up

hardware 2

We've already mentioned RAID a lot but for the hardware configuration RAID is unimportant, in fact in the BIOS you should configure any host controllers to run in AHCI or IDE mode, occasionally this is listed as JBOD mode if its a RAID controller.
The ZFS system is a software-based RAID solution so handles all of the striping and parity storage itself alongside other high-level operations.
3. Bunch of disks

hardware 3

The tricky part of connecting all of this together can create quite the mess, we'd strongly recommend implementing a good cable management system. Cable ties are the obvious solution and once fitted the power and data connection can still be reused even if a drive fails.
ZFS does support hot-swapping on AHCI compatible controllers and drives for live repair and updating.

Part 2: Creating a ZFS pool

Impress the ladies with your own shared ZFS redundant array
1. Decide the split 

step 1

You need to decide how the drives are going to be mounted. RAID 5 loses around 30 per cent of its storage to parity with a three-drive array, the equation for space efficiency is 1-1/R so the more drives the more efficient the setup is.

Mirrors lose 50 per cent to the mirrored drive. But both provide strong data integrity. If you're a crazy type stripe them together and keep going until one goes pop.

2. Create the volume 

step 2

For this example we're striping two mirrored arrays but the same process works for RAID-Z arrays, if you want to use more drives you can easily head down that route.

From the main FreeNAS web interface select the Storage section. Click the 'Create Volume' button, make up an array name and choose the drives to be part of the first array; for mirrored arrays this has to be an even number of drives.

3. ZFS options

step 3

With the drives you want in the array selected you will need to choose the ZFS option and 'Mirror' radio button to create the array. For RAID-Z select that option.

You may notice another bank of options relating to the other drives not selected. This enables you to add specific caching drives to enhance read/write performance ideally using an SSD, this is largely for commercial arrays.

4. Create the stripe 

step 4

This next part isn't very intuitive due to the relevant section of the FreeNAS interface. To add the next stripped mirror retrace step two, then add the remaining drives to create the new mirrored array.

Name this identically to that of the first mirror, once created FreeNAS automatically stripes these together. You're able to view the state of the drives in the array by clicking 'View Disks'.

5. Manage the array 

step 5

The Logical Volume appears listed under this Storage tab with a number of icons that let you manage a number of its key features. The first icon with the red 'X' enables you to delete the volume and restore the raw drives.
The next Scrub icon asynchronously checks and fixes the drives of any errors. The last two icons enable you to view the status of the array and the drives within it.

6. Create a share

step 6

To create a Windows share, you need to click the top 'Services' button and then activate CIFS. Click the spanner icon next to it and adjust the Workgroup and Description to your own. Next, click the Shares tab, click 'Add Windows Share' add a suitable name, click the 'Browse' button, choose the ZFS array and click 'OK'. To restrict access under Account you may want to add your own Groups and Users.

Part 3: Installing FreeNAS

Getting your favourite NAS OS onto real hardware is easy, trust us...
1. ISO images 

step 1

If you haven't already, download the latest FreeNAS ISO from The OS is designed to be installed or run directly from a USB stick or flash card.

The easiest way to install everything is to burn the image to a CD and install this to the target system from an optical drive. If you just want to test FreeNAS, fi re up VirtualBox and it'll happily install into a virtual environment.

2. BIOS tweaks 

step 2

It's important that your target system's BIOS supports booting from external USB devices, the location varies from BIOS to BIOS. But either the dedicated Boot Menu or Advanced Settings needs to provide support for USB hard drives or similar. Any system made in the last decade should be fine, just be sure that after you've installed the OS that this has been selected.

3. Direct image write 

step 3

It's also possible to burn the image directly to the target boot device, such as on your USB drive but it's more complex than we'd hope. To start you need the amd64.Full_install.xz file and not the ISO from the download page. You also need an image writer, for Linux this would be the DD command, for Windows download Image Writer that seems to do the trick well enough.

4. Burn baby 

install 4

Point Image Writer at the image file and the target drive and it'll do the rest. Beyond selecting it as the boot drive the only real issue you may encounter is an incompatible network adaptor. There's little you can do about this beyond adding in a new compatible network card. FreeNAS maintains a comprehensive list of compatible hardware here.
Comment and share it..



Blogger said...

BlueHost is ultimately the best web-hosting company with plans for all of your hosting needs.

Post a Comment

Design by Secure Hackers