Skip to content

Need to recover a FreeNAS server? How to import an existing FreeNAS iSCSI target that existed on a prior installation

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.

Screen Shot 2015-05-27 at 3.08.37 PM

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.

Screen Shot 2015-05-27 at 3.11.55 PM

Now, navigate to Block (iSCSI) > Initiators > Add Initiator. You can also go with the defaults on this one and just click “OK.”

Screen Shot 2015-05-27 at 3.12.18 PM

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.

Screen Shot 2015-05-27 at 3.15.32 PM

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.

Screen Shot 2015-05-27 at 3.18.06 PM

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.

Screen Shot 2015-05-27 at 3.19.50 PM

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.”

Screen Shot 2015-05-27 at 3.22.02 PM

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!

Leave a Reply