iSCSI initiator (netbsd-iscsi-initiator) for OS X Mountain Lion (10.8.2)

I am playing around with iSCSI for my macbook pro. Looked around and the used to be free SNS globalSAN iSCSI is no longer free. ATO is too expensive to play with. Saw that macport has a netbsd-iscsi, so went that route.


$ sudo port install netbsd-iscsi-initiator
---> Computing dependencies for netbsd-iscsi-initiator
---> Dependencies to be installed: netbsd-iscsi-lib
---> Building netbsd-iscsi-lib
Error: org.macports.build for port netbsd-iscsi-lib returned: command execution failed
Error: Failed to install netbsd-iscsi-lib
Please see the log file for port netbsd-iscsi-lib for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_netbsd-iscsi-lib/netbsd-iscsi-lib/main.log
Error: The following dependencies were not installed: netbsd-iscsi-lib
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: Processing of port netbsd-iscsi-initiator failed

Poking in main.log show the error at compiling disk.c.


:info:build /bin/sh ../../libtool --tag=CC --mode=compile /usr/bin/clang -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/opt/local/include -pipe -O2 -arch x86_64 -MT libiscsi_la-disk.lo -MD -MP -MF .deps/libiscsi_la-disk.Tpo -c -o libiscsi_la-disk.lo `test -f 'disk.c' || echo './'`disk.c
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/opt/local/include -pipe -O2 -arch x86_64 -MT libiscsi_la-disk.lo -MD -MP -MF .deps/libiscsi_la-disk.Tpo -c disk.c -fno-common -DPIC -o .libs/libiscsi_la-disk.o
:info:build disk.c:811:40: error: assignment to cast is illegal, lvalue casts are not supported
:info:build *((uint64_t *) ((void *)data + 8)) = (uint64_t) ISCSI_HTONLL(key);
:info:build ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build 1 error generated.
:info:build make: *** [libiscsi_la-disk.lo] Error 1

So I patched that line.


- *((uint64_t *) (void *)data + 8) = (uint64_t) ISCSI_HTONLL(key);
+ *((uint64_t *) ((void *)data + 8)) = (uint64_t) (ISCSI_HTONLL(key));

and now it builds. I just got to play with this to see if it works. More to report later.

ReadyNAS PSU replacement

I had a heart stopping moment today. My SO told me that she “smelled” something funny in my office. I went in there and sure enough, smelled like burnt plastic…. I thought no problem, I have backups…. on my NAS’es (two of them).

Heh! Murphy’s Law and all that. One of them (ReadyNAS NV+) PSU was the source of the burnt plastic smell, ah fresh odor of melted circuits. The other one had (thankfully) shutdown because of the heat.

The ReadyNAS is my main NAS (4x2TB), the other one (4x1TB) is my media server, stuffs that I don’t mind losing because they are copied from the ReadyNAS.   Yes, in another word, bad backup scheme.  There is no backup for the ReadyNAS.  I’ll fix that soon enough now.

Anyway, firing up my laptop, manually set IP, DNS, etc. since my server NFS mounted most everything on the ReadyNAS…  google, google and ah ha!  Reports of failed PSU in ReadyNAS NV and NV+.  I am hoping that it’s just the PSU and nothing the main board.

http://www.readynas.com/forum/viewtopic.php?t=13492

Took my ReadyNAS apart, sniff test (smell around the various pieces) to isolate where it is coming from.   Seem to be the PSU.  Got dressed, run to Central Computer near by.  It’s closed, crap!  Head to Frys in Santa Clara…. it’s already 8:20pm on a Tuesday eve…. In luck!  Frys is still open.  Run to the parts aisle, lots of options, big PSU (500W, 650W, 1000W, 1400w….) I don’t need monster PSU, I just need something small and around 220W as that is the original NV+ PSU.

Saw a microATX PSU from Coolmax (300W) CM-300.  Look small, hope it’ll fit in the case.  Only 26 bucks (29.22 w/tax).  Grabbed it, run home.  Followed the wiki above to get the two yellow cables onto the connector.  Lucky for me, the molex connector already has two empty holes where the two yellow cables has to be inserted.  So I just had to find the yellow cables from one of the other connectors.  After some fiddling, got it.   Eventhough its a microATX PSU, it is still too big for the ReadyNAS, won’t fit in the bottom tray (arg!).  Oh well, thread the power cable through the original 3 prong power hole, plug the molex onto the board.

Leaving everything open, I plug the power cord in, then into the AC receptacle and press the power button on the ReadyNAS….. and IT TURNED ON!  Wheeee!  The LCD say “Booting up…. please wait.”   Pulled the plug, now I can put everything back in, put the screws on.  Taped the hole in the bottom tray since the new PSU is going to be sitting outside and I want things airtight for cooling.

My ReadyNAS is now going through its fsck, going to be a loooong time w/6.5TB fs.   But at least I am now back in business.

P.S. Actually, the dead PSU did cause screwed up fs.  I had to manually ssh into my ReadyNAS (thank god I had set up a root ssh login) and fix the MBR on drive 4 (/dev/hdi).  Turns out the simplest way was:

# dd if=/dev/hdg of=/dev/hdi bs=512 count=1