[root@localhost init.d]# iscsiadm --mode discovery --type sendtargets --portal 192.168.221.254
192.168.221.254:3260,1 iqn.2012-05.com.example:ex333server.demo
192.168.221.254:3260,1 iqn.2012-05.com.example:ex333server.target244
[root@localhost init.d]# iscsiadm --mode node --targetname iqn.2012-05.com.example:ex333server.target244 --portal 192.168.221.254:3260 --login
Logging in to [iface: default, target: iqn.2012-05.com.example:ex333server.target244, portal: 192.168.221.254,3260]
Login to [iface: default, target: iqn.2012-05.com.example:ex333server.target244, portal: 192.168.221.254,3260]: successful
[root@localhost init.d]# fdisk -l
Disk /dev/sda: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 1330 10482412+ 83 Linux
/dev/sda3 1331 1591 2096482+ 82 Linux swap / Solaris
Disk /dev/sdb: 4 MB, 4194304 bytes
1 heads, 8 sectors/track, 1024 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/sdb doesn't contain a valid partition table
可以看到4M的sdb已经挂载到本地了。
小贴士:
无论时iscsi客户端还是服务端,包装完后服务都没有启动,在使用前需先启动相关服务;
较长的几个命令可直接在man里找(man tgtd,man iscsiadm);
记不清包的具体名称可通过yum的搜索功能:yum search scsi。