Difference between revisions of "ISCSI"

From Amahi Wiki
Jump to: navigation, search
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Installing the ISCSI server on Fedora 14/Amahi 6 =
+
{{NeedsUpdate}}
  
First of all the usual warnings
 
  
Disclaimer: does not cover misuse, boogars and other bodily excrements, accident, lightning, flood, tornado, tsunami, volcanic eruption, earthquake, hurricanes, or other acts of God, neglect, damage from improper use, incorrect line voltage, unauthorized use, unauthorized repair, improper installation, typos, broken antenna or marred cabinet, missing or altered serial numbers, electromagnetic radiation from nuclear blasts, sonic boom vibrations, customer adjustments that are not covered in this list, and incidents owing to an airplane crash, ship sinking or taking on water, motor vehicle crashing, dropping the item, falling rocks, leaky roof, broken glass, disk failure, accidental file deletions, mud slides, forest fire, hitting of a deer, milk coming out of your nose due to laughing while drinking, or projectiles, which can include, but are not limited to, arrows, bullet shots, BBs, shrapnel, lasers, napalm, torpedoes, emissions of X-rays, Alpha, Beta and Gamma rays, knives, stones, and touching in inappropriate places, etc.
+
Preliminary (manual) suport for [http://en.wikipedia.org/wiki/ISCSI iSCSI] in Amahi 6.
  
This disclaimer may not be copied or reproduced in any form
+
From [http://forums.amahi.org/viewtopic.php?f=5&p=13885#p13885 this forums post].
  
without the expressed written consent of whoever I stole it from.
+
'''WARNING: this page may have some items missing in the setup'''
  
 +
= Server side =
  
now that we have the legal stuff covered , let's get started
+
Set up an iSCSI server on the Amahi box. You can install it using yum. Note that all actions must be done as user root.
  
Installing the ISCSI server
+
yum install scsi-target-utils
  
 +
Set up 1 Logical Volume (LV) that will be exported as an iSCSI LUN. The below output shows my LV created for time machine (hence the name lvtime).
 +
 +
<pre>Code|lvs <nowiki>|</nowiki> grep time
 +
lvtime vg00 -wi-ao 500.00g</pre>
 +
 +
Export the LV: add it to /etc/tgt/targets.conf (note that there's a convention on how to export these!)
 +
<pre><target iqn.2010-08.local.bonabo:galileo.lun1>
 +
      backing-store /dev/vg00/lvtime
 +
</target></pre>
 +
 +
The name convention for iSCSI LUNs is usually as follows but a vendor can change it at will, it's a convention not a requirement.
 +
 +
Below how the name comes together, the parts are connected by dots, the lun name is separated by a colon.
 +
 +
fixed data: iqn -> iqn<br>
 +
date the LUN was created: year-month -> 2012-02<br>
 +
your domainname inverted: domain.your -> com.home<br>
 +
the LUN name: this is what the vendor usually provides -> lun1<br>
 +
 +
so that would make the following target:
 +
iqn.2012-02.com.home:lun1
 +
 +
Start the iSCSI target daemon and make sure it starts at boot time:
 +
 +
service tgtd start
 +
chkconfig tgtd on
 +
 +
Check the exported LUN(s):
 +
 +
tgt-admin -s
 +
 +
= Client side =
 +
 +
''Linux''
 +
 +
quick how-to for connecting to iSCSI storage (implies that iscsi-initiator-utils are installed!):
 +
scan for new LUNs:
 +
iscsiadm -m discovery -t sendtargets -p <NAS IP>
 +
 +
login and make the connection persistent
 +
iscsiadm -m node -T iqn.2012-02.<domain>.<your>:<LUNname> -p <NAS IP> -l
 +
 +
you should see a new device, you can partition it now
 +
fdisk /dev/<new device>
 +
partprobe /dev/<new device>
 +
 +
Create LVM stuff if you want to, otherwise create the filesystem as you would normally do
 +
 +
''Mac OSX''
 +
 +
I installed [http://www.studionetworksolutions.com/products/product_detail.php?pi=11 globalSAN iSCSI Initiator] for OS X by Studio Network Solutions (free community supported) iSCSI client for OS X) on the Mac.
 +
 +
I configured it to "see" the iSCSI lun (just type in the iqn IIRC); since it's presented to the OS as a normal disk you need to partition the drive first (it's a blank disk as far as the Mac is concerned). Then configure Time Machine to use that disk and you're done!
 +
 +
''Windows''
 +
 +
I'll let someone else fill that.
 +
 +
= Installing the ISCSI server on Fedora 14/Amahi 6 semi-automated =
 +
{{NeedsUpdate}}
 
Log into your amahi box via ssh and become root
 
Log into your amahi box via ssh and become root
  
 
NOTE: As i have experienced myself it is a good idea to check if your updates are all done correctly .
 
NOTE: As i have experienced myself it is a good idea to check if your updates are all done correctly .
do this by Typing
+
do this by typing
  
  yum update  
+
Code= yum update  
  
let amahi update whatever is necessary to avoid a kernel module error trying to start the ISCSI server.
 
  
 +
Let amahi update whatever is necessary to avoid a kernel module error trying to start the ISCSI server.
  
then install kernel headers and gcc
 
  
  yum install kernel-headers kernel-devel gcc
+
Then install kernel headers and gcc
  
now we going to download the install script i wrote
+
yum install kernel-headers kernel-devel gcc
  
  wget http://dl.dropbox.com/u/57179706/iscsi/install.sh
+
Now we going to download the install script i wrote
  
then run sh ./install.sh
+
Code=  wget http://dl.dropbox.com/u/57179706/iscsi/install.sh
  
this should have now compiled and installed the ISCSI server on your Amahi box
+
Then run
  
Configuration and creation of an ISCSI disk image
+
Code= sh ./install.sh
  
the easiest way to get an iscsi target is to create an image file
+
This should have now compiled and installed the ISCSI server on your Amahi box.
  
we are doing this by typing :
+
''Configuration and creation of an ISCSI disk image''
  
  mkdir /var/hda/files/iscsi
+
The easiest way to get an ISCSI target is to create an image file.  
  dd if=/dev/zero of=/var/hda/files/iscsi/disk.img bs=1M count=0 seek=2560000
 
  
you can name the disk.img whatever you want and the numbers behind seek is the size of the image disk which in our case is 250 gigs
+
We are doing this by typing:
  
now if we look in /var/hda/files/iscsi/ we will find a file called disk.img
+
Code=  mkdir /var/hda/files/iscsi
 +
dd if=/dev/zero of=/var/hda/files/iscsi/disk.img bs=1M count=0 seek=256000
  
Configuring the ISCSI server to serve your disk image  
+
You can name the disk.img whatever you want and the numbers behind seek is the size of the image disk which in our case is 250 gigs.
  
we have to edit the config file in  /etc/iet/ietd.conf (use your favorite editor)
+
Now if we look in /var/hda/files/iscsi/ we will find a file called disk.img
 +
 
 +
''Configuring the ISCSI server to serve your disk image''
 +
 
 +
We have to edit the config file in  /etc/iet/ietd.conf (use your favorite editor)
  
 
Leave everything as it is exept at the bottom we add
 
Leave everything as it is exept at the bottom we add
  
  Target iqn.2012-02.com.domain:disk.img
+
Code= Target iqn.2012-02.com.domain:disk.img
 
 
 
   Lun 0 Path=/var/hda/files/iscsi/disk.img,Type=fileio
 
   Lun 0 Path=/var/hda/files/iscsi/disk.img,Type=fileio
  
save and exit your editor  
+
Save and exit your editor  
  
start/restart your ISCSI server  
+
''Start/restart your ISCSI server''
  
   service iscsi-target restart
+
   Code= service iscsi-target restart
  
 
done
 
done
  
I will update this page later on how to hook a ISCSI drive using the win7 iscsi-initiator when i finally figured out why i have no toolbar while editing the wiki page
+
= Use Win 7 ISCSI initiator to connect a ISCSI target =
 +
 
 +
Go to Start - Control Panel - click on Administrative tools -
 +
 
 +
From there click on ISCSI initiator
 +
 
 +
 
 +
= Install Using External Repository =
 +
 
 +
'''Disclaimer: '''
 +
The instructions below are for your convenience only. Please note that this is a personal repo/service and as such is not maintained by Amahi. Adding an unknown/untrusted repo may cause security issues.
 +
 
 +
For ease of use I have created a repository which can easily be added.  Download the repo file located at:
 +
 
 +
Code= http://amahirepo.3owl.com/repofile/
 +
 
 +
Download rpmorama.repo (right click and save as)
 +
 +
Copy that file to
 +
/etc/yum.repos.d/
 +
 
 +
Run
 +
 
 +
  Code= yum update
 +
 
 +
Then you can install the iscsi server by typing
 +
 
 +
Code= yum install iscsitarget
 +
 
 +
You still have to create the disk and edit the iet.conf file

Latest revision as of 17:04, 9 January 2021

Msgbox.update.png Update Needed
The contents of this page have become outdated or irrelevant. Please consider updating it.


Preliminary (manual) suport for iSCSI in Amahi 6.

From this forums post.

WARNING: this page may have some items missing in the setup

Server side

Set up an iSCSI server on the Amahi box. You can install it using yum. Note that all actions must be done as user root.

yum install scsi-target-utils

Set up 1 Logical Volume (LV) that will be exported as an iSCSI LUN. The below output shows my LV created for time machine (hence the name lvtime).

Code|lvs | grep time
lvtime vg00 -wi-ao 500.00g

Export the LV: add it to /etc/tgt/targets.conf (note that there's a convention on how to export these!)

<target iqn.2010-08.local.bonabo:galileo.lun1>
      backing-store /dev/vg00/lvtime
</target>

The name convention for iSCSI LUNs is usually as follows but a vendor can change it at will, it's a convention not a requirement.

Below how the name comes together, the parts are connected by dots, the lun name is separated by a colon.

fixed data: iqn -> iqn
date the LUN was created: year-month -> 2012-02
your domainname inverted: domain.your -> com.home
the LUN name: this is what the vendor usually provides -> lun1

so that would make the following target: iqn.2012-02.com.home:lun1

Start the iSCSI target daemon and make sure it starts at boot time:

service tgtd start
chkconfig tgtd on

Check the exported LUN(s):

tgt-admin -s

Client side

Linux

quick how-to for connecting to iSCSI storage (implies that iscsi-initiator-utils are installed!): scan for new LUNs:

iscsiadm -m discovery -t sendtargets -p <NAS IP>

login and make the connection persistent

iscsiadm -m node -T iqn.2012-02.<domain>.<your>:<LUNname> -p <NAS IP> -l

you should see a new device, you can partition it now

fdisk /dev/<new device>
partprobe /dev/<new device>

Create LVM stuff if you want to, otherwise create the filesystem as you would normally do

Mac OSX

I installed globalSAN iSCSI Initiator for OS X by Studio Network Solutions (free community supported) iSCSI client for OS X) on the Mac.

I configured it to "see" the iSCSI lun (just type in the iqn IIRC); since it's presented to the OS as a normal disk you need to partition the drive first (it's a blank disk as far as the Mac is concerned). Then configure Time Machine to use that disk and you're done!

Windows

I'll let someone else fill that.

Installing the ISCSI server on Fedora 14/Amahi 6 semi-automated

Msgbox.update.png Update Needed
The contents of this page have become outdated or irrelevant. Please consider updating it.

Log into your amahi box via ssh and become root

NOTE: As i have experienced myself it is a good idea to check if your updates are all done correctly . do this by typing

Code= yum update 


Let amahi update whatever is necessary to avoid a kernel module error trying to start the ISCSI server.


Then install kernel headers and gcc

yum install kernel-headers kernel-devel gcc

Now we going to download the install script i wrote

Code=  wget http://dl.dropbox.com/u/57179706/iscsi/install.sh

Then run

Code= sh ./install.sh

This should have now compiled and installed the ISCSI server on your Amahi box.

Configuration and creation of an ISCSI disk image

The easiest way to get an ISCSI target is to create an image file.

We are doing this by typing:

Code=  mkdir /var/hda/files/iscsi
dd if=/dev/zero of=/var/hda/files/iscsi/disk.img bs=1M count=0 seek=256000

You can name the disk.img whatever you want and the numbers behind seek is the size of the image disk which in our case is 250 gigs.

Now if we look in /var/hda/files/iscsi/ we will find a file called disk.img

Configuring the ISCSI server to serve your disk image

We have to edit the config file in /etc/iet/ietd.conf (use your favorite editor)

Leave everything as it is exept at the bottom we add

Code= Target iqn.2012-02.com.domain:disk.img
 Lun 0 Path=/var/hda/files/iscsi/disk.img,Type=fileio

Save and exit your editor

Start/restart your ISCSI server

 Code= service iscsi-target restart

done

Use Win 7 ISCSI initiator to connect a ISCSI target

Go to Start - Control Panel - click on Administrative tools -

From there click on ISCSI initiator


Install Using External Repository

Disclaimer: The instructions below are for your convenience only. Please note that this is a personal repo/service and as such is not maintained by Amahi. Adding an unknown/untrusted repo may cause security issues.

For ease of use I have created a repository which can easily be added. Download the repo file located at:

Code= http://amahirepo.3owl.com/repofile/

Download rpmorama.repo (right click and save as)

Copy that file to

/etc/yum.repos.d/

Run

 Code= yum update

Then you can install the iscsi server by typing

Code= yum install iscsitarget

You still have to create the disk and edit the iet.conf file