Howto: Configure your GoFlex Net (should work for Dockstar too) to act as an iSCSI Enterprise Target October 15, 2011 11:17AM |
Registered: 13 years ago Posts: 128 |
nano /etc/apt/preferencespaste this
Package: * Pin: release a=stable Pin-Priority: 900 Package: * Pin: release o=Debian Pin-Priority: -10Then open
nano /etc/apt/apt.confand add this
APT::Default-Release "stable";Finally open
nano /etc/apt/sources.listand add
deb http://ftp.debian.org/debian/ testing main contrib deb-src http://ftp.debian.org/debian/ testing main contribNow we fetch the source for iscsitarget from the testing repo.
apt-get update apt-get source -t testing iscsitarget ls -alYou should see a new folder called "iscsitarget-1.4.20.2". Copy this folder to your Linux box. From there
http://sourceforge.net/projects/iscsitarget/develop -> Patches -> improved kernel version comparision semantics in MakefileFor convenience I attached the patch to this post. Download "iscsi-makefile.patch" and save it to iscsitarget-1.4.20.2. Apply the patch and go to the cross-compie environment
patch < iscsi-makefile.patch codesourcery-arm-2009q3.shWhen you run "make" you must give the path to your kernel sources. For example, if the sources are in "~/Kernel/linux-source-3.0.0/" then you should run
make ARCH=arm CC=arm-none-linux-gnueabi-gcc KSRC=~/Kernel/linux-source-3.0.0/This should compile without any errors. Copy the whole iscsitarget-1.4.20.2 folder back to the GoFlex and cd to the folder on the GoFlex. Then run
ln -s /usr/src/linux-headers-3.0.0-goflex/ /lib/modules/3.0.0-goflex/build make installThis should install iscsi-target on the GoFlex. To uninstall use
make uninstallO.K., let's make sure that the iscsi module works fine
modprobe iscsi_trgtNow we need to tweak the startup scripts a bit. In particular, it's a good idea to replace the content of /etc/init.d/iscsi-target by the script from Debian's iscsitarget package.
nano /etc/init.d/iscsi-targetThe script from Debian's iscsitarget package is also attached to this post.
update-rc.d iscsi-target defaultsAnd of course, we need to take care of the configuration files.
echo 'ISCSITARGET_ENABLE=true' > /etc/default/iscsitarget nano /etc/iet/ietd.confThe relevant part of the file may look like this. Here I use nothing fancy, just one of my SATA HDDs where the path is given via /dev/disk/by-id.
Target iqn-2011-09.mytop.mynet:storage.seagate IncomingUser mylogin mypass Outgoing User Lun 0 Path=/dev/disk/by-id/scsi-SATA_ST9160411ASG_5TG0AX3A,Type=blockioThe placeholder mytop.mynet is for the local domain name of my home network. I'm not sure if you really need real FQDNs with a local DNS server or if something like "ip-adress mygoflex.mynet.mytop mygoflex" in /etc/hosts should be enough. For the record, I have real FQDN via dnsmasq on my Asus WL500GP. "mylogin" and "mypass" stand for login and password, the authentication is handled via CHAP. I also use blockio. Although fileio is supposed to be faster, I couldn't notice any difference.
/etc/init.d/iscsi-target startand the output should be
Starting iSCSI enterprise target service:. .
apt-get install open-iscsiI don't think you really need to configure anything. To acess the target I do the following
sudo -s iscsiadm -m discovery -t st -p 192.168.xx.xx iscsiadm -m node --targetname "iqn-2011-09.mytop.mynet:storage.seagate" --portal "192.168.xx.xx:3260" --op=update --name node.session.auth.authmethod --value=CHAP iscsiadm -m node --targetname "iqn-2011-09.mytop.mynet:storage.seagate" --portal "192.168.xx.xx:3260" --op=update --name node.session.auth.username --value=mylogin iscsiadm -m node --targetname "iqn-2011-09.mytop.mynet:storage.seagate" --portal "192.168.xx.xx:3260" --op=update --name node.session.auth.password --value=mypass iscsiadm -m node --targetname "iqn-2011-09.mytop.mynet:storage.seagate" --portal "192.168.xx.xx:3260" --loginI mostly use it for backups and after the backup has been done I simply disconnect the target.
iscsiadm -m node --targetname "iqn-2011-09.mytop.mynet:storage.seagate" --portal "192.168.xx.xx:3260" -uWhat is cool, is that Clonezilla supports iSCSI out of the box. I got all the infos from this blog
sudo -s dhclient eth0 nano /etc/iscsi/iscsid.confUncomment and set the following values
node.statrtup = automatic node.session.auth.authmethod = CHAP node.session.auth.username = mylogin node.session.auth.password = mypassAfter that
/etc/init.d/open-iscsi start iscsiadm -m discovery -t sendtargets -p 192.168.xx.xx iscsiadm -m node -p 192.168.xx.xx:3260 -lFinally you hit Alt F1 and proceed with the Clonezilla. The iSCSI target drive appears in the list and can be used as a backup/recovery drive.