Get Your Free IT Resume Guide

How to Setup iSCSI Drive Using FreeNAS

I recently wrote an article on how to setup a NAS using the open source FreeNAS software. One of the many features of FreeNAS is the ability to setup an iSCSI drive.

iSCSI stands for Internet SCSI and allows client machines to send SCSI commands to remote storage servers such as FreeNAS. This allows you to consolidate your storage drives into a single machine for lower cost per GB and easier maintenance, with the illusion of local disk drives on your client machines. The functionality to use iSCSI drives is built into both Windows Vista and Server 2008 natively. At the higher end you can also use iSCSI for low cost clustering solutions and disaster recovery.

In the past this was usually done using special hardware and Fibre cabling, though with iSCSI you can leverage your existing network infrastructure. It should be noted that depending on the network load and performance requirements of your servers this can be drastically slower than the dedicated options. For a high performance production application you can still use iSCSI but I would look at setting it up on its own network at 1GB speeds.

How Does iSCSI Work?

There are two parts to the iSCSI protocol, the first being clients and the second being storage devices.

Clients are called iSCSI initiators and can be configured either using hardware or software solutions. As I mentioned earlier this functionality is already built into Vista and Server 2008, so we will not have to add any software/hardware to these machines.

The storage devices are called iSCSI targets and must be running some type of software/hardware to receive the incoming requests from the iSCSI initiators. Luckily FreeNAS has the ability to create iSCSI drives as part of its core package so I am going to use the FreeNAS server I used in a past demo.

Setup iSCSI Target Drive on FreeNAS Server

I’m going to use FreeNAS as the iSCSI target, and if you are going to follow along with this demo, it is imperative that you have one setup as well.

If you don’t you can read how to setup FreeNAS server and then come back to this article for the next steps.

This demo is going to assume that while the hard drives are installed in the server they are NOT added to the FreeNAS interface.

1. Connect to your FreeNAS server through the WebGUI using your favorite browser. In the top menu select Disks, then click Management.

How to Setup iSCSI Drive Using FreeNAS - 1

2. Click on the plus sign in the lower right corner to add drives.

How to Setup iSCSI Drive Using FreeNAS - 2

3. Next to Disk, choose the drive you want to add from the drop down, and if you want enter a description for it next to Description.

I usually leave the rest of the settings at default then click Add.

How to Setup iSCSI Drive Using FreeNAS - 3

4. When you go back to the Disk Management screen you will be asked to confirm the addition by clicking on Apply changes, go ahead and do that now.

How to Setup iSCSI Drive Using FreeNAS - 4

5. From the top menu choose Services, then iSCSI Target.

How to Setup iSCSI Drive Using FreeNAS - 5

6. Click on the plus sign in the Extent area.

How to Setup iSCSI Drive Using FreeNAS - 6

7. The Bolded fields are required, so place a name in the Extent name field, leave the Type as Device, and then choose the Device you want in the dropdown.

You can also enter a note in the comment field for reference. When you have set your options click on Add.

How to Setup iSCSI Drive Using FreeNAS - 7

8. When you get back to the iSCSI Target page click on Apply changes.

How to Setup iSCSI Drive Using FreeNAS - 8

9. Click on the plus sign in the Target area.

How to Setup iSCSI Drive Using FreeNAS - 9

10. As before the Bolded fields are required. Here is a breakdown of the fields:

  • Target name: Add your own or leave the default
  • Flags: RW for Read/Write or RO for Read Only
  • Storage: Will have the extents listed that were setup, choose the one you want to use
  • Authorized Network: Enter the IP network that can access this drive. For example if your IP was 192.168.1.100, you would enter 192.168.1.0 Most people will leave the 24 in the dropdown if your subnet mask is 255.255.255.0

Once you fill in all the info click on Add.

How to Setup iSCSI Drive Using FreeNAS - 10

11. Back at the iSCSI target page you need to click on Apply changes once again.

How to Setup iSCSI Drive Using FreeNAS - 11

12. Now place a check in the box next to Enable in the top right corner and then click Save and Restart in the bottom left.

How to Setup iSCSI Drive Using FreeNAS - 12

The iSCSI Target drive is now setup and ready for use.

Setup iSCSI Initiator on Vista

Now that the iSCSI target drive is ready, let’s go in and configure our Vista client machine to use it.

1. Click on the Start menu and type iSCSI into the menu bar and hit Enter.

2. Depending on your settings you may get a UAC warning, go ahead and approve if you do.

3. If this is the first time you are using iSCSI you will get a warning that the iSCSI service is not running and it is asking if you want to start the service and also have it automatically start with your computer. Go ahead and click Yes.

How to Setup iSCSI Drive Using FreeNAS - 14

4. The next window that appears will ask if you want to unblock the Microsoft iSCSI service in Windows Firewall. Click on Yes.

How to Setup iSCSI Drive Using FreeNAS - 15

5. When the iSCSI Initiator Properties appears click on the Discovery tab.

How to Setup iSCSI Drive Using FreeNAS - 16

6. Click on Add Portal…

How to Setup iSCSI Drive Using FreeNAS - 17

7. Place the IP address of the iSCSI target in the text field labeled IP address or DNS name: and then click OK.

How to Setup iSCSI Drive Using FreeNAS - 18

8. Click on the Targets tab.

How to Setup iSCSI Drive Using FreeNAS - 19

9. Highlight the target drive listed and click Log on…

How to Setup iSCSI Drive Using FreeNAS - 20

10. In the next window you can choose to have this connection restored when the computer starts by placing a checkmark next to that option. If you don’t then leave it blank. Either way click Ok.

How to Setup iSCSI Drive Using FreeNAS - 21

11. You should now see a status of Connected, confirm that and then click Ok.

How to Setup iSCSI Drive Using FreeNAS - 22

12. Click on Start, right click on Computer, then click on Manage.

How to Setup iSCSI Drive Using FreeNAS - 23

13. If you get a UAC warning, click through. You will now see the Computer Management MMC, click on Disk Management and in a few seconds the disks will populate.

Disk 1 is the iSCSI drive and you can see that it shows up unallocated. Right click on the drive and select New Simple Volume.

NOTE: If the disk drive was formatted previously you might have to Delete partition first.

How to Setup iSCSI Drive Using FreeNAS - 24

14. When the New Simple Volume Wizard starts go ahead and click Next.

How to Setup iSCSI Drive Using FreeNAS - 25

15. Set the size of the volume you want to create; in this demo I am using all the space. After you set the space click Next.

How to Setup iSCSI Drive Using FreeNAS - 26

16. Assign a drive letter, for this demo I am using F; then click Next.

How to Setup iSCSI Drive Using FreeNAS - 27

17. I am going to format this drive as NTFS and place a check next to Perform a quick format. You can also assign a volume label, then click Next.

How to Setup iSCSI Drive Using FreeNAS - 28

18. Review the settings selected and then click Finish.

How to Setup iSCSI Drive Using FreeNAS - 29

19. Depending on the speed of the network and the size of the drive it may take some time to format. When it is finished you will see it ready to go in Disk Management.

How to Setup iSCSI Drive Using FreeNAS - 30

Summary

We have setup a iSCSI target drive in FreeNAS and then setup an iSCSI initiator in Windows Vista to attach to the FreeNAS drive. After that we configured the drive for use on our Vista machine by formatting it and assigning a drive letter.

While not for everyone, iSCSI definitely has its uses and if it is suitable for your environment and needs, FreeNAS provides a low cost alternative.

More Related Posts

  1. Windows DNS Server 2008: Setup External Internet DNS Server
  2. How to Install IIS 7 and Setup a Static Website in 13 Easy Steps
  3. New Training Release: Windows Vista Training
  4. The Right Way to Perform a Backup in Exchange Server 2007
  5. Configure DHCP on Windows Server 2008

Discussion

33 comments and trackbacks for “How to Setup iSCSI Drive Using FreeNAS

Comments

  1. Contributing Writer
    Posted by Gary Sims on January 20, 2009, 6:03 am

    Thanks for an excellent guide, I have blogged about it at http://www.learnfreenas.com/modules/news/article.php?storyid=54

    Thanks, Gary

  2. Posted by Scottt on January 26, 2009, 2:03 pm

    After setting up the system per your recommendation I get an error code 1 when selecting the check mark for the enable in step 12. I look at the log and it says it is failing to start the ISCSI service. Any ideas.

  3. Posted by Bas on February 2, 2009, 9:21 am

    Great guide, I’m a total newby with freenas but this makes it easy.

    @Scotty: I had the same problem, but then I discovered I allready mounted the iSCSI device somewhere else. Deleted this an after that no error code 1 anymore.

  4. Posted by Sam on February 8, 2009, 8:15 am

    Hi Im having the same problem as Scottt. Any ideas ? Thanks

  5. Posted by Giorgio on February 9, 2009, 1:13 pm

    for Scottt problem ‘…error code 1 when selecting the check mark for the enable iSCSI Target…’ you must umount disks then check mark and it works.

  6. Posted by Shankar on April 1, 2009, 3:26 pm

    Thanks for the guide
    it is wonderful

    once again thank u very much

  7. Posted by Iggy on April 3, 2009, 9:08 am

    Very cool and useful guide. I do have one question for you that I can’t figure out.
    Let’s say I get all the way to Step 19 (where the drive is mounted and functioning).

    How do I unmount it gracefully and then disconnect from the target?

    I can’t find this info anywhere on the ‘net. I’ve tried the “mountvol F: /d” command and that ‘unmounts’ F:, but I cannot logoff the session (using the Targets tab of the iSCSI Initiator Properties panel). I get an error: “The session cannot be logged out since a device on that session is currently being used.”

    I’m using Vista Enterprise on my client machine.

    Thanks,
    Iggy

  8. Posted by Emre CAN on September 21, 2009, 6:42 am

    Hello thank you for this excellent tutorial.

    Im hoping to get a solution from experts here,
    My problem is, windows does not start to “New Simple Volume Wizard” because, Windows itself can not find the iSCSI disk no matter how much i clicked tru “rescan disks”

    What would you suggest?

    Sincerely,
    Emre.

  9. Posted by Iceberg Titanic on October 23, 2009, 8:08 am

    Hi folks -

    To unmount the devices, so that you can enable the iSCSI service, go to the Disks menu, and select Mount Point. You can unmount drives there.

  10. Posted by Paul on November 8, 2009, 12:51 pm

    The new version has just been released and I have never used FREENAS before and loved this tutorial. The version 7 has implemented some changes with regards to iSCSI Target and I am a bit confused. Would love to see a revised turorial based on the FreeNAS .7

    Thanks in advance

  11. Posted by Ash on December 2, 2009, 11:47 pm

    Error code 1 is owning me. Tried unmounting, makes absolutely no difference.

  12. Posted by jonthegimp on December 4, 2009, 11:30 am

    Ash
    It depends on what version you have – I was able to fix mine with the following:

    http://sourceforge.net/apps/phpbb/freenas/viewtopic.php?f=53&t=4854

    Hope that helps, it is a frustrating problem.

  13. Posted by Kakunka on December 8, 2009, 7:42 am

    Guys:

    This is for Vanilla XP

    First, go to Control Panel Select Administrative Tools
    Now Select Services
    Make sure Logical Disk Manager and Logical Disk Manager Administrative Services
    are started, right click and select start.
    Now
    Check that Microsoft ISCSI Initiator Service is started (same deal)

    Now make sure ISCSI is up using the MS ISCSI initiator as he specs above
    ( run C:\WINDOWS\system32\iscsicpl.cpl )

    Okay close out Services go back to Admin Tools
    Now select Computer Management
    under Storage select Disk Management
    The disk will appear with a red no go icon
    right click and select initialize
    Now right click and select partition and format and select Drive letter. . .

    “voila” as they say in Frogland. . . Drive should appear in your Win Explorer window
    K.

  14. Posted by vinzzz on January 19, 2010, 3:36 pm

    Hi I have a question regarding iSCSI. I bought a NAS so i can centralize my data. While my data is centralized, i want to index my networkshares on the NAS, so i can quickly find files, metadata etc.
    Windows 7 doesnt allow indexing networkshares.

    Is iSCSI a solution for my situation? Can the data still resist on my NAS, available for all computers in my LAN, and still trick windows that i have a local drive of 1.5TB (actually the disk on the NAS) ?

  15. Posted by powpow on February 4, 2010, 1:28 pm

    Hey Iggy,
    This error is likely being caused by a open file or shared folder pointing to a location on that target.
    Under My Computer | Manage | Shared Folders | Shares, stop any shares that point to that target.

  16. Posted by Dan on February 20, 2010, 2:34 pm

    First I’d like to compliment you on your outstanding tutorials I have just recently started working with iSCSI and FreeNAS and you’ve really given me a good education over the past two days. SO on to my question…Out of personal and business curiosity I’ve been trying to make my FreeNAS drive available through the internet. Is this possible? I can see the target from a remote network however when I try to log on i get a connection failed error. I can connect and transfer data just fine on my local network it’s the WAN part that’s giving me a hard time.

    Thanks,

    -Dan

  17. Posted by Paul on June 28, 2010, 5:45 pm

    Thanks for this guide! I got my Freenas iSCSI target running and windows sees it without problems.

  18. Posted by rick on July 23, 2010, 4:16 pm

    One Question -

    Is it possible to create a mount point smaller than the drive size?

    In my case, I have a 5TB storage device ready to mount to ESX using iSCSI and I like to create mount point smaller than 2TB.

    Thanks if you know the answer.

    Rick

  19. Posted by Prashanth on August 8, 2010, 2:49 pm

    When I try to add the target portal, I get a connection failed error…..

    Any ideas friends ?

    Thanks
    Prashanth

  20. Posted by Kevin on August 19, 2010, 7:24 am

    Hello,

    I configured an iSCSI target using FreeNAS as explained in this tutorial. I have two Windows 2008 R2 servers that can access the disk drive. But when I write a file in it from one server, I can’t see it in the other server.

    Any idea on how to solve this ?

    Thanks.
    Kevin

  21. Posted by anuj on August 21, 2010, 10:55 am

    thanks mate for nice post

  22. Posted by insightrules on August 28, 2010, 8:10 am

    Hi,

    I’m installing oracle RAC in virtual box using freenas to share teh OCR and ASM disks.
    The /ocr01 /ocr2 /ocr3 partitions are mounted on both servers. but when installing Oracle cluster a error message is displayed. Can create a file on /ocr1 on server1 but when tryes to read it from /ocr1 on server2 is not there.

    I create a file on /ocr1 on server 1 and the file is not getting syncronized on server2.

    Any help????

    Thanks in advanced

  23. Posted by Madhurranjan on September 15, 2010, 4:06 am

    I get a “Connection Failed” message. In freenas gui , i can see the status as ONLINE as shown below but i am unable to connect to it from any target. Any thoughts on how this can be fixed ?

    ad4 78534MB iscsi drive PFDB32S7SJSBVM Always on Unknown or unformatted ONLINE

  24. Posted by Seclusion on October 27, 2010, 2:16 am

    I have the same problem. When I try to connect my Iscsi FreeNAS to my initiator ISCSI of Vista I have the same message like Madhurranjan “Connect Failed”. I Actually have the last version of FreeNAS and I work with VMware Workstation. The network connection is by DHCP through VMware (I can acces to my admin FreeNAS). If you have any solutions

  25. Posted by Anuj@systechblog on February 6, 2011, 8:01 am

    Great guide, thanks its help me a lot. :)

  26. Posted by Ali on March 9, 2011, 9:11 am

    Hello,

    I configured an iSCSI target using FreeNAS as explained in this tutorial. When I try to add the target portal on my Windows server 2008, I get a connection failed error.

    Any idea on how to solve this ?

    Thanks.

  27. Posted by Ali on March 9, 2011, 9:14 am

    It was working and both servers were rebooted and it would not reconnect so I deleted the iSCSI portal and tried to re-establish it and I keep getting connection failed error message.

  28. Posted by MarcusMarcus on April 15, 2011, 6:41 pm

    This is a great how to. Any chance of getting an updated one for FreeNAS 8? I know it is only in Release Core at the moment.

  29. Posted by trevor nezar on April 26, 2011, 9:42 am

    Great guide thanks,
    got to work this morning and my iScsi target has lost all partition info – 6 HDD’s wiped. where do I begin ?

  30. Posted by single on May 21, 2011, 11:39 am

    Thanks for your answer & your picture ~ther are useful for me,because i get big trouble. i cann’t set the iscsi,but i can only set nus~~~ha ha…. however,you give me big a favor,thank u very much~

  31. Posted by Leonardo on January 12, 2012, 5:37 am

    Hi,
    I follow the above steps but if I want to add three records which the procedure because I can not, I have to add??

    another portal??

    Initiator Group ?????

    thank you.

Post a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>