Last night I noticed a new version of FreeNAS 9.3 was released. Just two days earlier I built this FreeNAS server, so I wanted everything to be up to date. When I tried to update FreeNAS via the web GUI, it errored out. As I came to find out, this was one of the bugs addressed in the update I was trying to install. It was a catch-22. So, I downloaded the installation disc, burnt it to CD, and booted the FreeNAS server from it. That errored out as well. I had no choice but to blow away the existing installation and do a fresh FreeNAS load. All of my shares and iSCSI targets were stored on a 4 disk RAID-Z array, and FreeNAS itself is installed on an 8GB USB Thumb drive. So, I expected my data to stay in tact.
When I booted the fresh installation for the first time, it automatically imported the zpool stored on the RAID array. I was able to re-create the SMB shares and point them to the /mnt folders those shares pointed to before, everything was going well. Until I got to work trying to bring my iSCSI target volumes back online. In Storage > Volumes, I could see all of the volumes that matched up with my previous ISCSI targets, but I couldn’t import them. I couldn’t figure out how to do anything with them. All of my virtual machines were stored on these volumes so I was desperate to find a solution. I did.
Have you lost your FreeNAS installation? Just recovered from a catastrophe? Recently reinstalled FreeNAS and need to get your iSCSI and other shares back? Going through a FreeNAS recovery? You’ve come to the right place.
How to import an iSCSI target volume from an old FreeNAS installation
First, let’s make sure the volumes that previously correlated to iSCSI targets are visible. Navigate to Storage > View Volumes. Here is what mine looks like.
As you can see, there are many “100gbiSCSI-*” volumes listed. These were mapped to iSCSI targets on the previous FreeNAS installation, which stored virtual machines for my ESXi hosts. I want to create new iSCSI targets, and map each of them to these pre-existing volumes so the data stays intact and is NOT destroyed.
Let’s create our new iSCSI targets
Navigate to Block (iSCSI) > Portals > Add Portal. The defaults are fine, just click ok. Mine looks like this.
Now, navigate to Block (iSCSI) > Initiators > Add Initiator. You can also go with the defaults on this one and just click “OK.”
Next, go to Block (iSCSI) > Targets > Add Target. For the Target Name and Target Alias I suggest using the same name as your previous iSCSI volume name, just to keep things easy and uniform. Then, select Portal Group ID 1 and Initiator Group ID 1. You can leave both authentication options to None.
Navigate to Block (iSCSI) > Extents > Add Extent. This is where we will map that pre-existing iSCSI target volume to a new target. For Extent Name, I suggest using the same name you just used for Target Name and Target Alias. Select the existing volume under Device that was an iSCSI target on your previous FreeNAS installation.
Almost done. All that’s left is to map the Extent we just added, to a Target. Go to Block (iSCSI) > Targets / Extents > Add Target / Extent. If you followed the naming scheme I suggested, you should select the same Target and Extent name. They should match the name of the volume. Then click OK.
If you are working with a brand new installation, ilke I am, iSCSI will be disabled. iSCSI is not enabled by default. So, the last thing you need to do is enable the iSCSI service. Navigate to to Services, at the top nav bar, and slide the iSCSI toggle to “ON.”
Go ahead and add your new FreeNAS server IP to the iSCSI initiator configuration on your hypervisor, server, or workstation, and rescan. You should now see your old iSCSI target with all of your data in tact. I hope this helped get you out of a bind. If you run into any problems feel free to ask for assistance in the comments below. Thanks!