ISCSI Installed Debian Jessie

TurnToJPG -->

FreeNAS Installation And Configuration

Install Procedure ignored, because it’s simple.
Following steps are used for adding iscsi partition.

Manually setup the volumn and now you could add your volumn into the FreeNAS System.

Configure iscsi:
Add the name of iqn.onecloud.iscsi, next we add portal:
Add Authorized Access Now:
Add Initator:
Create target:
Add extent:
LUM RPMs could also be spcified:
Associate Targets:

Enable the iscsi service:

Better you change the IP Address into static IP address.

Install Debian Jessie Onto ISCSI Disk:

On a installed Ubuntu, I choose Ubuntu14.04, do following for connecting the exising created iscsi partition:

$ sudo apt-get install -y open-iscsi gdisk
[root:~]# iscsiadm -m discovery -t sendtargets -p,-1 iqn.onecloud.iscsi:iscsidisk1

Login and listed the device :

[root:~]# iscsiadm -m node -T 'iqn.onecloud.iscsi:iscsidisk1' -p -l
Logging in to [iface: default, target: iqn.onecloud.iscsi:iscsidisk1, portal:,3260] (multiple)
Login to [iface: default, target: iqn.onecloud.iscsi:iscsidisk1, portal:,3260] successful.
[root:~]# ls -l /dev/disk/by-path
total 0
lrwxrwxrwx 1 root root 9 Jul 17 05:39 ip- -> ../../sda

Use gdisk for partition the /dev/sda, and creating the filesystem on them:

# gdisk -l /dev/sda

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            8191   3.0 MiB     EF02  BIOS boot partition
   2            8192         1056767   512.0 MiB   8200  Linux swap
   3         1056768        40959966   19.0 GiB    8300  Linux filesystem
# mkfs.ext4 /dev/sda3
# mkswap /dev/sda2 

Now install system, first mount usable systems:

# mkdir /mnt/chroot
# mount /dev/sda3 /mnt/chroot
# debootstrap wheezy /mnt/chroot
# debootstrap jessie /mnt/chroot 

chroot into the newly install jessie:

root@Ubuntu-14:~# mount -t proc none /mnt/chroot/proc
root@Ubuntu-14:~# mount -t sysfs none /mnt/chroot/sys
root@Ubuntu-14:~# mount --bind /dev /mnt/chroot/dev
root@Ubuntu-14:~# chroot /mnt/chroot /bin/bash

Disk configuration:

root@Ubuntu-14:/# cp /proc/mounts /etc/mtab
root@Ubuntu-14:/# sed -i '\|^/dev/sda3|,$!d' /etc/mtab
root@Ubuntu-14:/# blkid /dev/sda2 /dev/sda3
/dev/sda2: UUID="0c570265-543a-41ec-9edb-65bc55d677cd" TYPE="swap" PARTLABEL="Linux swap" PARTUUID="bfb7c1b1-c6cd-4302-9cb4-d6c1de43a0ad"
/dev/sda3: UUID="c1c5f995-e3f7-48c7-b5d5-4963a77d9b7b" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="00ccaf63-b3b3-46c4-92ab-1933d31cbcb7"
root@Ubuntu-14:/# echo 'UUID=c1c5f995-e3f7-48c7-b5d5-4963a77d9b7b / ext4 errors=remount-ro 0 1' >> /etc/fstab
root@Ubuntu-14:/# echo 'UUID=0c570265-543a-41ec-9edb-65bc55d677cd none swap sw 0 0' >> /etc/fstab
root@Ubuntu-14:/# cat /etc/fstab
UUID=c1c5f995-e3f7-48c7-b5d5-4963a77d9b7b / ext4 errors=remount-ro 0 1
UUID=0c570265-543a-41ec-9edb-65bc55d677cd none swap sw 0 0

Install some packages, be sure to make grub2 installed to /dev/sda:

# apt-get install vim less openssh-server locales
# apt-get install linux-image-amd64 grub2 initramfs-tools

Configure the Grub:

# apt-get install open-iscsi
# vim /etc/default/grub
GRUB_CMDLINE_LINUX=""ISCSI_INITIATOR=iqn.onecloud.iscsi.client:client ISCSI_TARGET_NAME=iqn.onecloud.iscsi:iscsidisk1 ISCSI_TARGET_IP= ISCSI_TARGET_PORT=3260 root=UUID=c1c5f995-e3f7-48c7-b5d5-4963a77d9b7b ip=""
# touch /etc/iscsi/iscsi.initramfs
# echo "InitiatorName=iqn.onecloud.iscsi.client:client" > /etc/iscsi/initiatorname.iscsi
# update-grub
# update-initramfs -u
# passwd

Configure the network interfaces:

root@Ubuntu-14:/etc/network# cat interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
#source-directory /etc/network/interfaces.d
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
#iface eth0 inet manual

Now exit and umount all of the mounted partitions.

# exit
# umount /mnt/chroot/{dev,proc,sys,}
root@Ubuntu-14:~# iscsiadm -m node -T 'iqn.onecloud.iscsi:iscsidisk1' -p -u
# echo "InitiatorName=iqn.onecloud.iscsi.client:client" > /etc/iscsi/initiatorname.iscsi
set initiator-iqn