Aware that my aging PATA drives will slowly but surely descent toward an inevitable death along with the data contained on them, I decided to revive an old forsaken Soyo motherboard (free after rebate, if Soyo wasn’t in the business of fraud…) as a SAN. It’s previous incarnation as a dvr failed miserably, since it just wasn’t powerful enough. Somehow, I had lost the CMOS battery, and it wouldn’t boot, but once I stole an even older one it eventually booted. Now, I just needed to set up a SAN and I would be all set. Once again disenchanted by Ubuntu and not having considered something like FreeNAS, I decided to install Debian Squeeze. A few hours later I figured out that the squeeze installer is broken and installed Lenny instead as a base system. Everything went well, except for the installing grub. Maybe I didn’t read what it said carefully enough, but I really wanted it to install stage 1 on the mbr of my install drive, not the primary master IDE drive. As it turned out, my primary master happened to be my newest, and least reliable PATA drive that I bought in 2005 and now reports SMART errors. I have to press F1 every time I boot to ignore the SMART errors and usually it doesn’t actually boot until the second try, and only when I use the boot selection menu. On a side now, the Debian installer is a pleasure to work with for installing an lvm-based system. It’s a nightmare and completely manual on Ubuntu. lvm over dmraid was also seamless, just with one addition to special boot parameters:
At this point everything was up and running. Admittedly, the bottom of my coffee table is not the best location for a server, but it’s temporary and mostly out the way. It’s quite nice to work with too, having lots of space to spread everything out over. I broke two SATA power connectors trying to move drives around in my primary PC’s case.
Configuring an iSCSI Target on Debian Lenny
Setting up the server only requires a few steps for the installation of iSCSI Enterprise Target. Instructions are available on the Debian wiki.
aptitude install iscsitarget
aptitude install iscsitarget-modules
Since I was running a stock Lenny kernel, I didn’t need to compile anything, but you can use module-assistant if you need to for some reason. Next, you need to configure /etc/ietd.conf. Examples are included so it should be fairly self-explanatory. You’ll need to choose an iSCSI qualified name. If you’re on a private network it doesn’t really matter, just choose something that will be unique on your network if you might have another iSCSI target. I included my box’s hostname. I set up my /etc/ietd.conf like this:
Lun 0 Path=/dev/hdd,Type=fileio
Lun 1 Path=/dev/hda,Type=fileio
Lun 2 Path=/dev/hdc,Type=fileio
Lun 3 Path=/dev/hde,Type=fileio
Lun 4 Path=/dev/hdf,Type=fileio
Lun 5 Path=/dev/hdi,Type=fileio
Initially, I had added a an IncomingUser clause to the Target, but it wasn’t immediately obvious to me how to specify a username for CHAP authentication in Windows 7, so I just removed it. I added six LUNs for the six non-Linux drives I had connected and specified the drive itself so I would get the entire drive, rather than individual partitions. You can also specify more targets, but there’s no reason to do so in this case. Be sure to restart the server with /etc/init.d/iscsitarget restart. Apparently you can also say invoke-rc.d iscsitarget restart now. But, so far I’ve had little luck remembering this, and I wonder how I am supposed to be aware of these new features without following development mailing lists in detail… One of the things I’ve always hated about iSCSI is typing in the qualified names and IPs manually. It seems like a lot of wasted effort. Fortunately, the iSNS protocol exists and is equivalent to DNS in the TCP/IP realm. You can install an iSNS server as well on the same host. It doesn’t require any configuration on Debian. Just run:
aptitude install isns
Now, the next step was to connect my Windows 7 box as an iSCSI initiator. You can search for iSCSI in the Control Panel and the first time you run it, it will ask you to enable to iSCSI service and present you with an iSCSI Target dialog. There are a lot of tabs and options to configure, but with iSNS, you should be able to get up and running quickly.
Go to the Discover tab and add your host’s IP address as an iSNS server. After waiting a few moments, or clicking refresh enough times, your target portal at the same IP address should show up in the Target portals list above. Switch to the Targets tab and you should now see the Target name you chose in your /etc/ietd.conf file in the list with hopefully the status Connected.
If you’ve made it this far, everything is working properly. The only step left is to add your volumes so Windows will see them. The easy way to do this is to go to the Volumes and Devices tab and click Auto Configure. It should add a verbose string to the Volume List and when you go to Disk Management you should see your new disks. You’ll be able to tell they are iSCSI targets by looking at the hardware type and seeing that they are IET VIRTUAL-DISK SCSI devices.
Now, I can see all my additional NTFS partitions in explorer!
I decided to purchase a gigabit switch, since I had been planning to for some time, to hopefully increase the throughput to the SAN disks. Unfortunately, all I really got was disappointment.
My transfer rate seems to peak out at around 11MB/s, which is only just over 10% utilization of my gigabit link. It’s clearly gigabit speed, though, since you wouldn’t get such a high transfer rate on 100mbit. I read some complaints about the D-Link DGS-2208 on newegg about it not playing well with a mix of gigabit and 100mbit devices. I figured it was a configuration issue on the user’s part. I doubt there is anything wrong with the router, but I’ll need to do some diagnostic tests and try to isolate the problem. I haven’t yet actually seen gigabit speeds on this router.