Menu Close

Linux Mint – Mouting a FreeNAS iSCSI disk

I’m trying to solve a problem of network backuping on our FreeNAS server. I’ve already tried CIFS (where were some issues – Linux Mint – problem to access a FreeNAS CIFS share) however I have there a performance issue, especially working with huge number of files produced by the backup proces (deja-dup backup over the net). As the second alternative I’m going to try iSCSI to map a network disk/file from a freenas server.

Prerequisities and initial state:

I’m using following software versions and I had configured following:

  • a host machine with installed Linux Mint 17.3 Rosa Cinammon 64bit
  • a NAS storage with installed FreeNAS version 9.10STABLE. The FreeNAS should be operational and working, configured with appropriate Storage zvol  (Storage -> Create zvol),  turned on iSCSI service (Service -> iSCSI),  configured Portals (Sharing -> Block (iSCSI) -> Portals), configured Initiators (Sharing -> Block (iSCSI) -> Initiators), Targets Sharing -> Block (iSCSI) -> Targets), Extents (Sharing -> Block (iSCSI) -> Extents) and Associated Targets (Sharing -> Block (iSCSI) -> Associated Targets). Some guides partially describing these iSCSI steps are  at http://thesolving.com/storage/how-to-create-an-iscsi-target-with-freenas/ or http://blogbt.net/index.php/2014/07/vcap-dca-setting-external-storage-iscsi-on-freenas/
  • additionally I have configured and joined the freenas machine into our windows domain managed by AD controller

Mouting iSCSI

1) Using iSCSI terminology we need an iSCSI initiator, to do thath we must install required package, so we will install Open-iSCSI:

# sudo apt-get install open-iscsi open-iscsi-utils
2) then we will configure it. So open
sudo vim /etc/iscsi/iscsid.conf
and comment manual and ucomment automatic startup
# node.startup = manual
node.startup = automatic

3) now we should check if our freenas target is available (my Freenas target is called “targetpalo”, freenas IP address 192.168.10.5). Discovering iSCSI targets we’ll type the isciadm command :

# iscsiadm --mode discovery --type sendtargets --portal <IP-address>

where

  • –mode (or -m): determines the mode that iscsiadm executes in.
  • -type (-t): specifies the type of discovery.
  • -portal (-p): indicates the target IP address.

in my case

sudo iscsiadm -m discovery -t sendtargets -p 192.168.10.5
and the answer is, where i can see my iscsci freenas target (the targetname iqn.2005-10.org.freenas.ctl:targetpalo))
192.168.10.5:3260,257 iqn.2005-10.org.freenas.ctl:targetpalo

 

4) Finding a target, we should be able to connect and log into it, of course depending on our target setup (you may require to enter user credentials.). Login to the iSCSI node:

# iscsiadm --mode node --targetname IQN --portal IP_ADDRESS --login

in my case

sudo iscsiadm -m node --targetname iqn.2005-10.org.freenas.ctl:targetpalo -p 192.168.10.5 --login
where we may observe the answer
Logging in to [iface: default, target: iqn.2005-10.org.freenas.ctl:targetpalo, portal: 192.168.10.5,3260] (multiple)
Login to [iface: default, target: iqn.2005-10.org.freenas.ctl:targetpalo, portal: 192.168.10.5,3260] successful.
or typing
dmesg | grep sd
[1176867.785410] sd 7:0:0:0: Attached scsi generic sg3 type 0
[1176867.786252] sd 7:0:0:0: [sdc] 314572800 512-byte logical blocks: (161 GB/150 GiB)
[1176867.786253] sd 7:0:0:0: [sdc] 16384-byte physical blocks
[1176867.788167] sd 7:0:0:0: [sdc] Write Protect is off
[1176867.788170] sd 7:0:0:0: [sdc] Mode Sense: 73 00 10 08
[1176867.788690] sd 7:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
[1176867.794430]  sdc: unknown partition table
[1176867.800728] sd 7:0:0:0: [sdc] Attached SCSI disk
or
fdisk -l
...
Disk /dev/sdc: 161.1 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders, total 314572800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 16384 bytes
I/O size (minimum/optimal): 16384 bytes / 1048576 bytes
Disk identifier: 0x00000000

Disk /dev/sdc doesn't contain a valid partition table
or
lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 xxx,1G  0 disk 
└─sda1   8:1    0 xxx,1G  0 part /
sdb      8:16   0   xxxT  0 disk 
└─sdb1   8:17   0   xxxT  0 part /home
sdc      8:32   0   150G  0 disk 
sr0     11:0    1  1024M  0 rom
Note: The output example above shows my iSCSI disk as a sdc drive, your output may be different.

 

5) Now we have to format the device (using GNU parted, fdisk or gnome-disk-utility). The disk will appear in my case as a new “/dev/sdc hard drive.

 

6) Finally, add an entry to /etc/fstab to mount the iSCSI drive during boot:

/dev/sdc       /home/palo/Backup        ext4    defaults,auto,_netdev 0 0

and run

sudo mount -a

That is it!

Other sources

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.