天天看點

fedora 配置iSCSI Target

How to use iSCSI Targets on Linux

From SynologyWiki

Jump to: navigation, search

Overview

This article will guide the administrator into mounting an iSCSI Target from the Synology DiskStation onto a Linux computer. Please make sure that an iSCSI Target has been created on the DiskStation and is ready for use. This article was created with a Fedora 13, and a Synology DiskStation DS508 with DSM 3.0-1354. Please consult with the Linux Distribution website for more specific instructions for each specific version of Linux.

  • Main Article - How to use the iSCSI Target Service on the Synology DiskStation

Adding iSCSI Storage to a Linux Computer

Step 1: Install the iSCSI Initiator Software

[root@Synology-FedoraVM /]# yum install iscsi-initiator-utils
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package iscsi-initiator-utils.i686 0:6.2.0.872-7.fc13 set to be installed
--> Finished Dependency Resolution
...
Installed:
  iscsi-initiator-utils.i686 0:6.2.0.872-7.fc13                                 

Complete!
      

Step 2: Make sure iscsi.conf 'node' parameter is set for Automatic

[root@Synology-FedoraVM /]# vi /etc/iscsi/iscsid.conf


[...]
node.startup = automatic
[...]
      

Step 3: Start Discovery Process

[root@Synology-FedoraVM /]# iscsiadm -m discovery -t st -p 192.168.0.227
Starting iscsid:                                           [  OK  ]
192.168.0.227:3260,0 iqn.2010-10.synology-iscsi:newvirtualdisk.1
169.254.1.2:3260,0 iqn.2010-10.synology-iscsi:newvirtualdisk.1


[root@Synology-FedoraVM /]# iscsiadm -m node
169.254.1.2:3260,0 iqn.2010-10.synology-iscsi:newvirtualdisk.1
192.168.0.227:3260,0 iqn.2010-10.synology-iscsi:newvirtualdisk.1
      

Step 4: Log onto a iSCSI Target

[root@Synology-FedoraVM /]# iscsiadm -m node --targetname "iqn.2010-10.synology-
iscsi:newvirtualdisk.1" --portal "192.168.0.227:3260" --login
Logging in to [iface: default, target: iqn.2010-10.synology-iscsi:newvirtualdis
k.1, portal: 192.168.0.227,3260]
Login to [iface: default, target: iqn.2010-10.synology-iscsi:newvirtualdisk.1,
portal: 192.168.0.227,3260] successful.
      

Step 5: Partition, format and mount the iSCSI Target

How to use iSCSI Targets on Linux
From SynologyWiki
 
Jump to: navigation, search



 

        

Overview

This article will guide the administrator into mounting an iSCSI Target from the Synology DiskStation onto a Linux computer. Please make sure that an iSCSI Target has been created on the DiskStation and is ready for use. This article was created with a Fedora 13, and a Synology DiskStation DS508 with DSM 3.0-1354. Please consult with the Linux Distribution website for more specific instructions for each specific version of Linux.  

[root@Synology-FedoraVM /]# yum install iscsi-initiator-utils
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package iscsi-initiator-utils.i686 0:6.2.0.872-7.fc13 set to be installed
--> Finished Dependency Resolution
...
Installed:
  iscsi-initiator-utils.i686 0:6.2.0.872-7.fc13                                 

Complete!
      

[root@Synology-FedoraVM /]# vi /etc/iscsi/iscsid.conf


[...]
node.startup = automatic
[...]
      

[root@Synology-FedoraVM /]# iscsiadm -m discovery -t st -p 192.168.0.227
Starting iscsid:                                           [  OK  ]
192.168.0.227:3260,0 iqn.2010-10.synology-iscsi:newvirtualdisk.1
169.254.1.2:3260,0 iqn.2010-10.synology-iscsi:newvirtualdisk.1


[root@Synology-FedoraVM /]# iscsiadm -m node
169.254.1.2:3260,0 iqn.2010-10.synology-iscsi:newvirtualdisk.1
192.168.0.227:3260,0 iqn.2010-10.synology-iscsi:newvirtualdisk.1
      

[root@Synology-FedoraVM /]# iscsiadm -m node --targetname "iqn.2010-10.synology-
iscsi:newvirtualdisk.1" --portal "192.168.0.227:3260" --login
Logging in to [iface: default, target: iqn.2010-10.synology-iscsi:newvirtualdis
k.1, portal: 192.168.0.227,3260]
Login to [iface: default, target: iqn.2010-10.synology-iscsi:newvirtualdisk.1,
portal: 192.168.0.227,3260] successful.
      

[root@Synology-FedoraVM /]# fdisk -l


Disk /dev/sdb: 161.1 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

[root@Synology-FedoraVM /]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x6eae1b66.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19581, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-19581, default 19581): 
Using default value 19581

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


[root@Synology-FedoraVM /]# mkfs.ext3 /dev/sdb1
mke2fs 1.41.10 (10-Feb-2009)
Filesystem label=
OS type: Linux
...
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


[root@Synology-FedoraVM /]# mount /dev/sdb1 /mnt
[root@Synology-FedoraVM /]# cd /mnt
[root@Synology-FedoraVM mnt]# ls -l
total 16
drwx------. 2 root root 16384 Oct 29 12:16 lost+found
      

How to unmount the iSCSI Target and stop iSCSI discovery of the DiskStation

[root@Synology-FedoraVM mnt]# cd /
[root@Synology-FedoraVM /]# umount /mnt

[root@Synology-FedoraVM /]# iscsiadm -m node --targetname" "iqn.2010-10.synolog
y-iscsi:newvirtualdisk.1" --portal" "192.168.0.227:3260" --logout
Logging out of session [sid: 1, target: iqn.2010-10.synology-iscsi:newvirtualdi
sk.1, portal: 192.168.0.227,3260]
Logout of [sid: 1, target: iqn.2010-10.synology-iscsi:newvirtualdisk.1, portal:
 192.168.0.227,3260] successful.

[root@Synology-FedoraVM /]# iscsiadm -m discovery --portal "192.168.0.227:3260"
 --op=delete
      

[root@Synology-FedoraVM mnt]# cd /
[root@Synology-FedoraVM /]# umount /mnt

[root@Synology-FedoraVM /]# iscsiadm -m node --targetname" "iqn.2010-10.synolog
y-iscsi:newvirtualdisk.1" --portal" "192.168.0.227:3260" --logout
Logging out of session [sid: 1, target: iqn.2010-10.synology-iscsi:newvirtualdi
sk.1, portal: 192.168.0.227,3260]
Logout of [sid: 1, target: iqn.2010-10.synology-iscsi:newvirtualdisk.1, portal:
 192.168.0.227,3260] successful.

[root@Synology-FedoraVM /]# iscsiadm -m discovery --portal "192.168.0.227:3260"
 --op=delete
      

繼續閱讀