Windows iSCSI Initiator with ZFS Deduplication

Now that you have your lightning fast ZFS iSCSI storage target online, lets connect it to Windows 7 64-Bit and do some testing.

First you will need to configure networking so that your iSCSI target will be available.  In my machine, I have 2 network adapters.  One is connected to the Internet via DHCP and the other is manually configured as displayed below and connected to my iSCSI target machine via an Ethernet crossover cable.  The iSCSI target IP is 192.168.2.1 which is on the same subnet as the iSCSI initiator IP 192.168.2.2.

Network Configuration

Next you will need to configure the iSCSI Initiator Service.

Navigate to Control Panel –> System and Security –> Administrative Tools –> iSCSI

iSCSI Initiator Control Panel Screenshot

You will be prompted to start the iSCSI service and to create a Windows Firewall exception, to be successful, you will want to perform both of these actions.

Next you will need to “discover” your iSCSI target.  On the “Discovery” tab, then click “Discover Portal” and enter the IP address of your iSCSI target.

iSCSI discover Targets

Next click on the “Targets” tab, highlight your target and click “Connect”.

Connect to Target

You will be prompted to make this a persistent target.  In my case, I am experimenting so I do not want it to be persistent.  If I was configuring clustering or something else, I might want my target to be persistent.

Persistent Target Prompt

Next, you will need to initialize your newly connected iSCSI disk.  Right Click on “Computer” select “Manage”, then expand “Storage” and click on “Disk Management”.

Disk Management MMC

You will immediately be prompted to initialize the new disk.  In my machine, I decided to use an MBR partition because I will not have a volume larger than 2TB and I would like maximum compatibility.

Initialize LUN

Once the disk is initialized, you will be prompted to format the disk and select a drive letter.  For maximum performance, it is important to choose a 64K “Allocation Unit  Size” when you format the disk.  This “Allocation Unit Size” coincides the with the 64K block size that we used when creating the ZFS volume that backs our iSCSI target.  Aligning the partitions can give a significant performance boost.  Here is a .pdf document that describes why we want to alight the partitions and what kind of performance boost we can expect.  Although this document is written in regards to VMFS, the same holds true for other file systems such as NTFS.

Allocation Unit Size

Now we have a new drive letter.  As we test further, it is important to remember that ZFS properties such as compression=on and dedup=on are not retro-active.  This means that when we turn on ZFS properties, they will apply to new data as it is written to the ZFS volume, but it will not compress data that is already in place on the volume.  In the previous post where we created the iSCSI target, I turned on ZFS compression at the time the volume was created.  This way, all of my data will be compressed.  Unfortunately, my personal data does not compress or dedup very well (not at all).  I guess this makes sense since it is mostly .jpg photos, home videos, and AAC music.  However, your results will vary.  In the office we managed to get a 1.54x dedup ratio.  You will not want to use dedup in all cases because it might not provide an benefit and will create some overhead because it has to calculate a SHA256 hash for every block of data.  On my personal data that doesn’t seem to dedup at all, it also seems that dedup thrashes my disks causing additional slowness on top of the SHA256 hashing.  This is likely because the SHA256 hash is too large to fit into RAM and my machine does not have L2ARC cache. Jeff Bonwick at Oracle/Sun has a great writeup on the inner workings of ZFS deduplication. Depending on your data, you may be able to use compression and dedup together.  Experiment with your own data using the commands below:

admin@opensolaris:/etc# zfs set compression=on pool1/vol1

admin@opensolaris:/etc# zfs set dedup=on pool1/vol1

admin@opensolaris:/etc# zfs get compressratio pool1/vol1

admin@opensolaris:/etc# zfs set compression=on pool1/vol1

admin@opensolaris:/etc# zpool get dedupratio pool1

I hope this has been informative and I would like to thank you for viewing.  Stay tuned for the next experiment which will use the same ZFS iSCSI server as shared storage to cluster Microsoft Hyper-V 2008 R2.

Leave a Reply