Adding iSCSI Storage to Fedora 16

I recently purchased a 120GB SSD drive for my laptop. I figured the SSD and a fresh install of Fedora 16 could speed up my laptop a bit and help me squeeze another year or so out of it. The only problem was available space as I was previously using a 500GB drive, and my laptop only allows for one drive.

I own a Synology DS411 and have gigabit networking thanks to a few Cisco 2960 switches. This makes a great situation for use of iSCSI to add a bit more storage for my laptop.

On the Synology side, the setup of the iSCSI LUN/Target was fairly painless.

  1. Open up the Storage Manager
  2. Click on iSCSI LUN, then click Create
  3. Choose the LUN type you would like. I went with iSCSI LUN (Regular Files)
  4. Add the name, and how much space you would like to allocate. I kept it was LUN-1 and gave it 100GB. You’re also going to want to keep the mapping to: Create a new iSCSI target
  5. Again, enter a name. You can keep the iqn the same. I would also advise enabling CHAP. This will make the NAS need to authenticate your PC before allowing access.
  6. After you’re done, the Service status should say Ready.

– On a side note, I would also suggest you edit your iSCSI target and configure masking. Set the default privileges to No Access. Then you can click create and enter in the iqn of your Fedora workstation and allow Read/Write. The iqn can be found by using the following:

[root@LPTP ~]# cat /etc/iscsi/initiatorname.iscsi

This will also ensure that the NAS will only allow a machine to connect and use the storage if it is using the correct iqn.

Time for the Fedora side of things. If you don’t have it already, don’t forget to install the following:

[root@LPTP ~]# yum install iscsi-initiator-utils

Lets start with editing the iscsid.conf to add the CHAP user/password if you opted to create one. Open up the config file: /etc/iscsi/iscsid.conf

Find and uncomment the following lines, then fill in the username and password fields:

node.session.auth.authmethod = CHAP

node.session.auth.username = iscsiuser
node.session.auth.password = iscsipass

Then we move to connecting to the NAS. Start up the iscsi service:

[root@LPTP ~]# service iscsi start

Using iscsiadm, enter the target you would like to connect to, then restart the iscsi service:

[root@LPTP ~]# iscsiadm -m discovery -t sendtargets -p

[root@LPTP ~]# service iscsi restart

With any luck, you should now see Service Status: IPADDRESS connected on the NAS.

You can also check the status on the Fedora side by using the following:

[root@LPTP ~]# iscsiadm -m session -P 3
iSCSI Transport Class version 2.0-870
version 2.0-872.15.f16
Current Portal:,0
Persistent Portal:,0
Iface Name: default
Iface Transport: tcp
Iface Initiatorname:
Iface IPaddress:
Iface HWaddress: <empty>
Iface Netdev: <empty>
SID: 4
iSCSI Connection State: LOGGED IN
iSCSI Session State: LOGGED_IN
Internal iscsid Session State: NO CHANGE
Recovery Timeout: 120
Target Reset Timeout: 30
LUN Reset Timeout: 30
Abort Timeout: 15
username: iscsiuser
password: ********
username_in: <empty>
password_in: ********
Negotiated iSCSI params:
HeaderDigest: None
DataDigest: None
MaxRecvDataSegmentLength: 262144
MaxXmitDataSegmentLength: 262144
FirstBurstLength: 65536
MaxBurstLength: 262144
ImmediateData: Yes
InitialR2T: Yes
MaxOutstandingR2T: 1
Attached SCSI devices:
Host Number: 9 State: running
scsi9 Channel 00 Id 0 Lun: 0
Attached scsi disk sdb State: running

The above shows that you’re now connected and logged in! As you might notice the last line shows that the device is mounted at /dev/sdb. This info could also be obtained by checking fdisk -l and looking for the new 100GB disk.

Note that when I perform this command, I get an error:

[root@LPTP ~]# fdisk -l /dev/sdb

WARNING: GPT (GUID Partition Table) detected on ‘/dev/sdb’! The util fdisk doesn’t support GPT. Use GNU Parted.

Easy enough, to set up the new disk, we just need to use parted rather than fdisk.

[root@LPTP ~]# parted
(parted) select /dev/sdb
Using /dev/sdb
(parted) mkpart primary ext4 1 -1

Once that completes, we can create the filesystem:

[root@LPTP ~]# mkfs.ext4 /dev/sdb1

Now we create a place to mount the new storage:

[root@LPTP ~]# mkdir /mnt/iscsi

Add the following line to /etc/fstab so it mounts next time we reboot:

/dev/sdb1 /mnt/iscsi ext4 _netdev 0 0

Also enable the isci service to auto start:

[root@LPTP ~]# chkconfig iscsi on

And finally, lets see if it works…

[root@LPTP ~]# mount -a

That should mount anything new in /etc/fstab. With any luck, the volume will mount with no issues. You can verify that it completed by checking with df.

[root@LPTP ~]# df -h /dev/sdb1
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 100G 0.0G 100G 0% /mnt/iscsi

And that about completes it. I now have more free space on my SSD, and just toss less used files(pictures, music, etc.) over to the iSCSI storage.


~ by msxnetworks on March 17, 2012.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: