Subscribe to the TST RSS Feed

How to Setup iSCSI Drive Using FreeNAS

Dave LawlorI 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.



 

Related Posts:


 

16 Responses to “How to Setup iSCSI Drive Using FreeNAS”

  • Gary Sims Says:

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

    Thanks, Gary

  • Scottt Says:

    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.

  • Bas Says:

    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.

  • Sam Says:

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

  • Giorgio Says:

    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.

  • [...] up my Vista machines and laptop access so I can do quick transfers on the fly when needed.  Here is a good write up on how to setup the iSCSI services within FreeNAS.  I may also setup my VMware [...]

  • Shankar Says:

    Thanks for the guide
    it is wonderful

    once again thank u very much

  • Iggy Says:

    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

  • Emre CAN Says:

    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.

  • Iceberg Titanic Says:

    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.

  • Paul Says:

    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

  • Ash Says:

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

  • jonthegimp Says:

    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.

  • Kakunka Says:

    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.

  • vinzzz Says:

    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) ?

  • powpow Says:

    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.

Leave A Comment: