Buffalo LinkStation Mini as an iSCSI target for VMware ESXi

I own a Buffalo LinkStation Mini that does nothing now that the Synology DS409slim owns my files. Because the LS Mini has two 500GB disks, I thought it might do a nice iSCSI target for my ESXi. The thing is: the stock firmware doesn’t offer iSCSI feature.

This is how I turned my LinkStation Mini into a iSCSI target for VMware, using Debian 6.

Restoring stock firmware

I did actually open the LS Mini to put the disks into the Synology. Now that I switched to 1TB disks, I can restore the disks into the LinkStation. The first thing to do is to restore the original system.

To do so, I followed the “Revert Buffalo Linkstation Mini To Stock Firmware” tutorial which worked like a charm.

Short story is:

  • Zero the disks and remount the LS Mini ;
  • Download the TFTPd and Firmware on a Windows machine ;
  • Set the Windows’ workstation IP, prepare the directory and launch the TFTP daemon ;
  • Plug the LS Mini on the network and start the recovery mode ;
  • Wait a bit and connect to the restored system.

Long story: check the source link in the last section.

Installing the Debian system

The tutorial to install Debian worked like a charm. So I won’t duplicate the directions here ; just do as stated.

I did a few different things on my installation. My “root” partition is only 4GB wide ; extra storage will be taken from md14. On step #59, I did a RAID0 volume. I didn’t run steps #60 and #61 as I want to publish md14 as a raw partition through iSCSI.

At the end of the tutorial, the LinkStation did reboot and I could log-in using SSH:

BTW, my LS Mini is LS-WS1.0TGL/R1.

Enabling iSCSI

To provide iSCSI Target role, you need a specific module. And to build this module, you need the kernel sources. Following the “Install Debian 6.0 (Squeeze) On Buffalo Linkstation Mini” tutorial, you end with a kernel that won’t evolve with “apt-get upgrade”. What you have to do is compile your own kernel from the sources and then compile the iscsitarget module for this kernel.

Compile and run a new kernel

There is an automated script available that will compile and install a new kernel for the LS Mini.

Copy/paste the script from this thread. Set it executable and edit it to match the latest kernel revision:

# diff -u2 build_kernel.sh.orig build_kernel.sh --- build_kernel.sh.orig 2012-05-11 15:04:23.000000000 +0200 +++ build_kernel.sh 2012-05-11 15:04:41.000000000 +0200 @@ -307,6 +307,6 @@ export MINI_KERNEL_VERSION_THREE=2.6.32 export MINI_KERNEL_VERSION_FOUR=2.6.32 -export MINI_KERNEL_PACKAGE_VERSION=35 -export MINI_KERNEL_PACKAGE_REPO=http://ftp.debian.org/debian +export MINI_KERNEL_PACKAGE_VERSION=45 +export MINI_KERNEL_PACKAGE_REPO=http://ftp.fr.debian.org/debian CompileKernel @@ -318,4 +318,4 @@ # uncomment this block to change the boot kernel to the last built kernel -# cd /boot -# cp -a ${MINI_KERNEL_BUILD_DIR}/uImage-linux-${MINI_KERNEL_VERSION_FULL}.buffalo /boot/uImage.buffalo +cd /boot +cp -a ${MINI_KERNEL_BUILD_DIR}/uImage-linux-${MINI_KERNEL_VERSION_FULL}.buffalo /boot/uImage.buffalo

Run the script and wait for a while for it to compile. During the “configuration” phase of the kernel, I just left what was configured by default.

When the kernel is installed, reboot the LS Mini to ensure it loads well.

Compile and run the iSCSI Target module

Installing the iscsi module is just a few shell lines from here:

# apt-get install iscsitarget iscsitarget-dkms # m-a prepare # m-a update # m-a a-i iscsitarget

Enable the iSCSI Target

To be able to run the iSCSI Target “daemon” at boot, just enable it:

# /etc/default/iscsitarget ISCSITARGET_ENABLE=true

The daemon is then run via /etc/init.d/iscsitarget.

Publishing a iSCSI Target

Block mode publishing

On my LS Mini, I have md14 which is a RAID0 of the two internal disks. Here, I’ll publish the raw device to the ESXi and will format it in VMFS. The data won’t be readable from the LinkStation and it will only deal with iSCSI reads/writes:

# vi /etc/iet/ietd.conf Target iqn.2012-05.net.tumfatig:lsmini.disk.md14 Lun 0 Path=/dev/md14,Type=blockio Alias lsmini.md14 # /etc/init.d/iscsitarget restart Removing iSCSI enterprise target devices: :. Stopping iSCSI enterprise target service: :. Removing iSCSI enterprise target modules: ... (warning). . Starting iSCSI enterprise target service:. . # tail -20 /var/log/messages (...) May 11 15:21:32 lsmini kernel: iSCSI Enterprise Target Software - version 1.4.20.2 May 11 15:21:32 lsmini kernel: iscsi_trgt: Registered io type fileio May 11 15:21:32 lsmini kernel: iscsi_trgt: Registered io type blockio May 11 15:21:32 lsmini kernel: iscsi_trgt: Registered io type nullio

That’s all. The target is ready.

In a real production environment, one may configure ACL, from /etc/iet/initiators.allow, and CHAP authentication. In my configuration, I have no CHAP and allow the whole network to connect.

File mode publishing

The file mode is a way to publish a file, a disk image, that lies on a file system managed by the iSCSI target. This allows to offer several iSCSI target lying on the same file system and to access it from the Target ; if the OS supports it.

In my case, I wanted to check deduplication/compression using ZFS. But the low memory available on the LS Mini makes this difficult. So I’ll do it with ExtFS:

# mkfs.ext4 /dev/md14 # mkdir /export # mkfs.ext4 /dev/md14 # mount /dev/md14 /export

Then, create a sparse file that will be published as the iSCSI target:

# dd if=/dev/zero of=/export/iscsi_vsphere.img bs=1M seek=102400 count=0 0+0 records in 0+0 records out 0 bytes (0 B) copied, 0.000167299 s, 0.0 kB/s # ls -alh /export/iscsi_vsphere.img -rw-r--r-- 1 root root 100G May 11 21:09 /export/iscsi_vsphere.img # df -h Filesystem Size Used Avail Use% Mounted on (...) /dev/md14 902G 200M 856G 1% /export

Publishing the file requires editing the ietd configuration file:

# vi /etc/iet/ietd.conf Target iqn.2012-05.net.tumfatig:lsmini.file.md14 Lun 0 Path=/export/iscsi_vsphere.img,Type=fileio Alias lsmini.md14 # /etc/init.d/iscsitarget restart Removing iSCSI enterprise target devices: :. Starting iSCSI enterprise target service:. .

That’s done!

Using the iSCSI Target from VMware

From a vSphere client, select the ESXi that will be the iSCSI initiator.

From the “Configuration” tab, select the “Storage Adapters” section. If there is no initiator, create one using the “Add…” button. Edit the initiator properties and, from the “Static Discovery” tab, click the “Add…” button. Fill-in the iSCSI server IP, port and Target. Acknoledge the rescan of the adapter.

From the “Configuration” tab, select the “Storage” section. Click the “Add Storage…” link and select the “Disk/LUN” storage type. Select the LUN that appears ; use the “Path ID” to verify the LUN is the LS Mini’s one. Select the VMFS-5 file system version. Enter a name for the new datastore. Follow the wizard to complete the operation.

If all went well, you now have iSCSI storage for you ESXi on the LinkStation Mini!

One test I did was cloning 3 of the powered on/off virtual machines onto the iSCSI datastore. While processing the copy, I’ve check the datastore statistics from vSphere and system stats from the LS Mini.

iSCSI quick bench – blockio

Access to an iSCSI Target in blockio mode

Looking at the dstat output, I saw a load average of 1.40-2.01, a recv/send ratio of about 12MBps/198kBps and an identical split of I/O on both disks with a rate of 172 writes/seconds.

iSCSI quick bench – fileio

Looking at the dstat output, I saw a load average of 2.50-3.16, a recv/send ratio of about 8MBps/136kBps and an identical split of I/O on both disks with a rate of 125 writes/seconds.

As expected, the performance is a bit lower using files…

Sources

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*

%d bloggers like this: