You are on page 1of 55

Network-Attached Storage With FreeNAS

FreeNAS is a free NAS (Network-Attached Storage) server, supporting: CIFS (samba), FTP, NFS, AFP,
RSYNC, iSCSI protocols, S.M.A.R.T., local user authentication, Software RAID (0,1,5) with a Full WEB
configuration interface. FreeNAS takes less than 32MB once installed on Compact Flash, hard drive or
USB key.
The minimal FreeBSD distribution, Web interface, PHP scripts and documentation are based on
M0n0wall.

FreeNAS Tutorial
Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 02/11/2007
This tutorial shows how you can set up a network-attached storage server with FreeNAS. FreeNAS is
based on the FreeBSD operating system and supports CIFS (samba), FTP, NFS, RSYNC, SSH, local
user authentication, and software RAID (0, 1, 5). It comes with a powerful web interface and uses
very little space on the hard drive - about 32MB.
I do not issue any guarantee that this will work for you!

1 Preliminary Note
In this article I will set up a NAS system with three 30GB hard disks, where the first one is split up in
a small partition for the FreeNAS system itself and a large data partition. I will combine the other two
hard drives in a RAID1 array. I will use the IP address 192.168.0.100 for my FreeNAS system with
the gateway address 192.168.0.1.

2 Installing FreeNAS
Download the latest FreeNAS iso image (0.68 at the time of this writing) from
http://www.freenas.org/index.php?option=com_content&task=view&id=20&Itemid=32 and burn it
onto a CD. Then boot from that CD.
The following screen will come up. Select 7 to install FreeNAS on the hard drive:

We want to have two partitions on our first hard drive (one for FreeNAS, one for data storage), so we
select 2:

Enter the name of your CD-ROM drive. In my case it was acd0:

Then enter the name of the hard drive where you want to install FreeNAS and create the data
partition. In my case I select the first hard drive, ad0:

FreeNAS is now being installed. Afterwards press <ENTER>, then 3 and 5 to reboot the system:

Confirm that you want to reboot by typing y:

The system will now reboot. Make sure you remove the FreeNAS CD from the CD-ROM.

3 Further Network Configuration


Now we log in to the FreeNAS web interface by typing http://192.168.0.100/ (or whatever IP
address you assigned to FreeNAS) in our browser.
We will be asked for a login. The default login is: username admin, password freenas.

The welcome page looks like this:

We didn't specify a gateway yet for our FreeNAS system, so we go to Interfaces -> LAN and enter
our gateway IP address (192.168.0.1) under Gateway, then we hit Save.

The system must be rebooted for the changes to take effect, so we go to the FreeNAS terminal again
and hit 5 and then y:

After the reboot we can connect to the web interface again. Go to System -> General setup and fill
in two DNS servers (e.g. 145.253.2.75 and 193.174.32.18). If you don't specify DNS servers, the
system cannot connect to NTP servers if you use an FQDN (like pool.ntp.org - which is the default
value) for the NTP server. On the same page, you can also change the admin password from freenas
to a different value:

That's it for the network configuration, no reboot is needed.

10

4 Configuring Our First Hard Drive For Network-Attached Storage


The caption is a little bit misleading. In fact we want to configure the second partition (the data
partition) for NAS, not the whole disk. Please note: You cannot configure the partition for NAS where FreeNAS
is installed on! So from the first hard drive we cannot use the first partition because FreeNAS is installed
on it.
Go to Disks -> Management and click on the + sign on the right:

11

On the next page select the ad0 disk (that's where the data partition is on) and select UFS under
Preformated FS (during the FreeNAS installation the installer formatted both partitions on the first
hard drive with UFS, whereas the second and third hard drive are still unformated):

12

On the next screen hit Apply changes:

13

The data partition has now been added to FreeNAS:

14

To use it, we must mount it. Therefore we go to Disks -> Mount Point and click on the + sign on the
right:

15

Select the ad0 disk, the partition no. 2 (that's the data partition), the file system UFS, and under
Share Name and Description you specify a name for the share (only characters a-z, 0-9, and the
underscore _ are allowed) and a short description that allows you to identify the share. Then click on
Add:

16

Then apply the changes:

17

The data partition is now mounted and ready for use:

18

5. Enabling Services
In order to be able to access our NAS shares, we must enable some services on the FreeNAS server
first over which we can connect to the shares. In this example I will enable CIFS (samba) so that the
shares can be accessed with the Windows Explorer plus FTP and SSH.
To enable CIFS, go to Services -> CIFS and check the Enable checkbox on the right. You can leave
all other values unchanged for now (thus allowing anonymous logins - if you need authenticated logins
change the value for Authentication and create users under Access -> Users and Groups later
on). Then hit Save:

19

To enable FTP, go to Services -> FTP and check the Enable checkbox on the right. You can leave all
other values unchanged, thus allowing anonymous and authenticated logins over FTP (for
authenticated logins you must create users under Access -> Users and Groups later on):

20

To enable SSH, go to Services -> SSHD and check the checkbox on the right side. That way, users
can log in using SCP (e.g. WinSCP on Windows systems). The users must be created under Access ->
Users and Groups later on.

21

6 Our First Test


Now that we have allowed anonymous CIFS and FTP logins, we can make our first test. On a windows
system in the same local network as the FreeNAS server, go to Start -> Run and type in
\\192.168.0.100:

A Windows Explorer window should pop up with the data share from the first FreeNAS hard drive, and
you should be able to write to and read from that share:

22

Now open an FTP client and log in anonymously to the FreeNAS server:

23

Again, you should see the data share of the first FreeNAS hard drive, which should be readable and
writable:

24

7 Configuring RAID1
Next we want to build a RAID1 array from our second and third hard drive and then use the RAID1
array as a NAS share. Please note that only full hard drives can be used for RAID, not single partitions!
First we must add both hard drives. Go to Disks -> Management and click on the + sign:

25

Select ad1 and choose Unformated under Preformated FS (ad1 wasn't formated during FreeNAS
installation):

26

Do the same for ad3:

27

On the Disks -> Management page, click on Apply changes:

28

29

Next we must format ad1 and ad3. Click on the Format tab (still under Disks -> Management), select
ad1 and Software RAID: gmirror, then click on Format disk:

30

The next screen should be similar to this one:

31

Now do the same for ad3:

32

ad1 and ad3 should now be listed on the Disks -> Management page with the file system gmirror:

33

Afterwards we must combine ad1 and ad3 to one RAID1 array. To do this, we go to Disks
Software RAID

->

and click on the + sign on the right side:

34

Give the RAID array a name and select ad1 and ad3 as members of the new volume, then hit Add:

35

Then apply the changes:

36

37

Now we must format our new RAID1 array with the UFS file system, so we go to the Format RAID tab
(still under Disks -> Software RAID), select our RAID array and hit the Format UFS disk! button:

38

The next screen should be similar to this one:

39

All that is left to do is mount the RAID array. Therefore we go to Disks -> Mount Point and click on
the + sign:

40

Select your RAID array. Under Partition you select Software RAID - gmirror, and under File
system you choose UFS. Also specify a share name and a description:

41

After you've applied the changes the RAID array should be available as a NAS share:

42

43

To check the status of your RAID array, you can go to Disks -> Software RAID and click on the
Information tab:

We have already enabled services such as CIFS, FTP, and SSH in chapter 5, so we don't have to do
this again. Our RAID array should immediately be available under these services.

44

8 Our Second Test


If you check again in your Windows Explorer or your FTP client, you should now also see the RAID
share:

45

9 Adding Local Users


Services such as SSH don't allow anonymous logins. Also, if you have configured FTP and CIFS to not
allow anonymous logins, you must create local users now on the FreeNAS system that can log in to
each service.
To create users, we must first create group to which we can add the users. Go to Access -> Users
and Groups and then to the Groups tab and click on +:

46

Enter a name and description for the group and click on Add:

47

Then apply the changes:

48

49

Next go to the Users tab and click on +:

50

Enter a user name and password and select the group that you've previously created. If you enable
Full Shell, the user cannot only use SCP (like WinSCP), but also log in on the shell. If you don't
enable Full Shell, the user is restricted to using SCP:

51

Apply the changes:

52

53

10 Using SCP
Now that SSH is enabled on the FreeNAS server and you've created a local user, that user can also
use SCP (e.g. with WinSCP) to access the NAS shares.
Fill in the host name, user name, and password, and make sure to select SCP:

54

After the successful login, you can see both NAS shares:

11 Links
FreeNAS: http://www.freenas.org
WinSCP: http://winscp.net

55

You might also like