Several virtual infrastructure features require a storage area network (SAN). As you know, a real iSCSI SAN appliance...
or Fibre Channel (FC) SAN can be very expensive. While iSCSI is becoming more and more affordable for small and medium-sized businesses (SMBs), an iSCSI SAN appliance for testing and for an IT pro's home network is still out of reach -- for most of us. In this article, you will learn how to install an open source iSCSI SAN application inside a Microsoft Hyper-V virtual machine, without having to dedicate an entire physical machine to this task. Once it's installed, you can use it to store your Windows files with the built-in iSCSI initiator or, even more fun, you can use it as a centralized SAN storage for VMware Infrastructure test systems for advanced features like VMotion, Distributed Resource Scheduler (DRS) and VMware High Availability (VMHA).
What is Openfiler?
I won't claim to have reviewed every open source iSCSI option available, because once I found Openfiler, and it worked well, I stopped looking. Openfiler is an open source SAN and network-attached storage (NAS). Not only does it offer options to share files using iSCSI, but also FTP, NFS, HTTP, SMB and more. You can also download the 332 MB ISO installation file or even pre-built VMware images.
Once installed and running, you can create disk volumes, apply security and share your data across a NAS or SAN -- whichever you choose.
I have taken dedicated servers and used Openfiler at companies where it served as an iSCSI SAN to our VMware Infrastructure servers. Later, we moved our production VMware server storage to a more expensive dedicated appliance, but we kept all test servers, virtual desktops and development servers on the Openfiler SAN.
In my home test network, I have run Openfiler on dedicated machines and inside VMware Workstation and ESX Server. Again, I can take ESX Server, point it toward the iSCSI SAN, format it with Virtual Machine File System (VMFS) and use it to test features like VMotion, VMHA and DRS.
Now I run Openfiler inside Microsoft Hyper-V and, ironically, still point my VMware ESX servers to it for storage of VMFS guest systems, and use it for VMotion, VMHA and DRS.
Let me show you how it is done in a few easy steps.
How do you run Openfiler inside Microsoft Hyper-V?
Prior to installing Openfiler, you need to download it. You can download Openfiler here. Many versions of Openfiler are available: 32-bit, 64-bit, ISO, VMware ESX Server virtual appliance and Xen appliance. Make sure you get the latest version, 2.3 (2.4 is on the way). While VMware ESX Server and Xen virtual appliances are available, no Hyper-V virtual appliances are listed.
To install Openfiler inside Hyper-V, download the 64-bit ISO image, as Hyper-V requires a 64-bit CPU.
Next, start the Hyper-V MMC and choose to create a new a new virtual machine, like this:
Figure 1: Creating a new Virtual Machine in Hyper-V
Name your new virtual machine and specify its location,
Figure 2: Specify virtual machine name and location
Assign RAM to the virtual machine.
Figure 3: Assign RAM to the virtual machine
When asked about adding a network interface, there is no need to add the typical integrated network interface as the Linux virtual machine (VM) won't recognize it anyway. For now, say "not connected" and we will add the legacy network adapter soon.
Figure 4: Configuring networking
Add a new virtual IDE disk that will be used by the virtual machine as the Openfiler OS disk. This won't, however, be our shared iSCSI disk where we will put the shared VMFS (we will create that disk later).
Figure 5: Creating a new virtual disk
Now, map the virtual DVD drive to the ISO image that you downloaded.
Figure 6: Mapping the virtual DVD drive
And finally, accept the summary configuration.
Figure 7: Accept the summary configuration
Now you want to edit your configuration for the new virtual machine, so click on Settings.
Figure 8: Change settings for the new Openfiler virtual machine
You want to add two new pieces of hardware:
- A legacy network adapter
- A second IDE virtual hard disk
Let's start with the legacy network adapter. Perhaps there is a way to get the Hyper-V integrations installed in the Openfiler Linux OS, but I haven't figured that out yet. The easiest way to get a working network interface card (NIC) is to install the legacy network adapter. So click on Add Hardware then Legacy Network Adapter.
Figure 9: Adding the virtual network adapter
Connect the legacy network adapter to your physical network adapter.
Figure 10: Connect legacy NIC to physical NIC
Next, you need to add a new integrated development environment (IDE) disk onto the existing IDE controller.
Figure 11: Adding a new virtual IDE hard drive
You will have to click New and go through the new hard disk wizard. I recommend placing the new virtual hard disk in the same place as the other virtual disk for this VM. You can create a new fixed or dynamic virtual hard disk of whatever size you would like to make your iSCSI shared volume. When you are done, your configuration should look something like this:
Figure 12: Results of new virtual hard disk created
With that, the configuration of the new VM for Openfiler is completed.
Installing Openfiler inside Hyper-V
Now that the VM is created, you can start the VM and go to the console. I have found that the graphical installation doesn't work and you need to perform the text installation using the linux text command (see Figure 13, below).
Figure 13: Installing openfiler in text mode
From here, go through the typical Openfiler installation. For the most part, I recommend you take all the default settings. It is very likely that you will want to use a static IP address on the Openfiler server.
Once installed and rebooted, you will need to configure Openfiler to share the second IDE volume we created using iSCSI. I wrote an article, "Use Openfiler as your free VMware ESX SAN Server," at the Petri Knowledgebase that explained how to do this.
In general, the steps are the following:
- Set your time zone and configure your Network Time Protocol Server;
- Configure the authorized network;
- Create a volume group and add the new /dev/hdb;
- Configure the iSCSI target by doing the following:
- naming the IQN
- mapping the logical unit number to the volume
- configuring the network ACL by allowing access to the network we created; and
- configure CHAP if you would like.
Prior to connecting your VMware ESX Server or other server to it, I suggest that you test the configuration by connecting a Windows Server or Windows workstation to the new iSCSI Server. If a Windows workstation cannot connect to the iSCSI server, then a VMware ESX Server will never be able to connect to it. For instructions on how to connect your VMware ESX Server to the Openfiler server, checkout my article "Connect VMware ESX Server to a free iSCSI SAN using Openfiler".
As you can see in Figure 14 (below), I was able to connect my Windows 2008 Server to the new Openfiler iSCSI Server.
Figure 14: Connected Windows 2008 Server to Openfiler iSCSI SAN Server
After that, I wiped out that data when I connected my VMware ESX Server to the same Openfiler volume and formatted that volume with the VMware VMFS. Figure 15 (below) is my VMware ESX Server connected to the Openfiler volume.
Figure 15: VMware ESX Server connected to the Openfiler iSCSI SAN Server
A real iSCSI SAN appliance or Fibre Channel SAN can be costly, but installing an open source iSCSI SAN alternative, such as Openfiler, inside a Hyper-V virtual machine is a good alternative. Openfiler works well, offers numerous storage and file-sharing features, and prevents you from having to dedicate an entire physical machine to a real SAN application.
ABOUT THE AUTHOR: David Davis (CCIE #9369, VCP, CWNA, MCSE, CISSP, Linux+, CEH) is the Director of Infrastructure at Train Signal Inc. He has written hundreds of articles and six video training courses, including the Train Signal VMware ESX Server video training series. His websites are Happy Router.com and VMwareVideos.com.