[root@kvm7 ~]# yum install iscsi-initiator-utils -y
[root@kvm7 ~]# systemctl enable iscsid.service iscsi.service ln -s '/usr/lib/systemd/system/iscsid.service' '/etc/systemd/system/multi-user.target.wants/iscsid.service'
[root@kvm7 ~]# vim /etc/iscsi/initiatorname.iscsi [root@kvm7 ~]# cat /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2015-08.wang.deyu:kvm7
[root@kvm7 ~]# systemctl restart iscsi.service iscsid.service
[root@kvm7 ~]# ll /var/lib/iscsi/nodes/ total 0
[root@kvm7 ~]# iscsiadm -m discovery -t st -p 192.168.122.5 192.168.122.5:3260,1 iqn.2015-08.wang.deyu:kvm5
[root@kvm7 ~]# ll /var/lib/iscsi/nodes/ total 4 drw-------. 3 root root 4096 Jul 10 15:26 iqn.2015-08.wang.deyu:kvm5 [root@kvm7 ~]# cat /var/lib/iscsi/nodes/iqn.2015-08.wang.deyu\:kvm5/192.168.122.5\,3260\,1/default # BEGIN RECORD 6.2.0.874-7 node.name = iqn.2015-08.wang.deyu:kvm5 node.tpgt = 1 node.startup = automatic node.leading_login = No iface.iscsi_ifacename = default iface.transport_name = tcp iface.vlan_id = 0 iface.vlan_priority = 0 iface.iface_num = 0 iface.mtu = 0 iface.port = 0 iface.tos = 0 iface.ttl = 0 iface.tcp_wsf = 0 iface.tcp_timer_scale = 0 iface.def_task_mgmt_timeout = 0 iface.erl = 0 iface.max_receive_data_len = 0 iface.first_burst_len = 0 iface.max_outstanding_r2t = 0 iface.max_burst_len = 0 node.discovery_address = 192.168.122.5 node.discovery_port = 3260 node.discovery_type = send_targets node.session.initial_cmdsn = 0 node.session.initial_login_retry_max = 8 node.session.xmit_thread_priority = -20 node.session.cmds_max = 128 node.session.queue_depth = 32 node.session.nr_sessions = 1 node.session.auth.authmethod = None node.session.timeo.replacement_timeout = 120 node.session.err_timeo.abort_timeout = 15 node.session.err_timeo.lu_reset_timeout = 30 node.session.err_timeo.tgt_reset_timeout = 30 node.session.err_timeo.host_reset_timeout = 60 node.session.iscsi.FastAbort = Yes node.session.iscsi.InitialR2T = No node.session.iscsi.ImmediateData = Yes node.session.iscsi.FirstBurstLength = 262144 node.session.iscsi.MaxBurstLength = 16776192 node.session.iscsi.DefaultTime2Retain = 0 node.session.iscsi.DefaultTime2Wait = 2 node.session.iscsi.MaxConnections = 1 node.session.iscsi.MaxOutstandingR2T = 1 node.session.iscsi.ERL = 0 node.session.scan = auto node.conn[0].address = 192.168.122.5 node.conn[0].port = 3260 node.conn[0].startup = manual node.conn[0].tcp.window_size = 524288 node.conn[0].tcp.type_of_service = 0 node.conn[0].timeo.logout_timeout = 15 node.conn[0].timeo.login_timeout = 15 node.conn[0].timeo.auth_timeout = 45 node.conn[0].timeo.noop_out_interval = 5 node.conn[0].timeo.noop_out_timeout = 5 node.conn[0].iscsi.MaxXmitDataSegmentLength = 0 node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144 node.conn[0].iscsi.HeaderDigest = None node.conn[0].iscsi.IFMarker = No node.conn[0].iscsi.OFMarker = No # END RECORD
[root@kvm7 ~]# iscsiadm -m node -T iqn.2015-08.wang.deyu:kvm5 -p 192.168.122.5 -l Logging in to [iface: default, target: iqn.2015-08.wang.deyu:kvm5, portal: 192.168.122.5,3260] (multiple) Login to [iface: default, target: iqn.2015-08.wang.deyu:kvm5, portal: 192.168.122.5,3260] successful.
[root@kvm7 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 12M 0 disk vda 252:0 0 8G 0 disk ├─vda1 252:1 0 96M 0 part /boot ├─vda2 252:2 0 3.1G 0 part │ ├─vg_kvm7usb-swap 253:0 0 124M 0 lvm [SWAP] │ └─vg_kvm7usb-root 253:1 0 2.8G 0 lvm / └─vda3 252:3 0 130M 0 part └─vg_kvm7home-vo 253:2 0 120M 0 lvm /home
[root@kvm7 ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xc497bbc1.
Command (m for help): p
Disk /dev/sda: 12 MB, 12582912 bytes, 24576 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 4194304 bytes
Disk label type: dos
Disk identifier: 0xc497bbc1
Device Boot Start End Blocks Id System
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (1-24575, default 1):
Using default value 1
Last sector, +sectors or +size{K,M,G} (1-24575, default 24575): +10M
Partition 1 of type Linux and of size 10 MiB is set
Command (m for help): p
Disk /dev/sda: 12 MB, 12582912 bytes, 24576 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 4194304 bytes
Disk label type: dos
Disk identifier: 0xc497bbc1
Device Boot Start End Blocks Id System
/dev/sda1 1 20481 10240+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@kvm7 ~]# partprobe /dev/sda
[root@kvm7 ~]# mkfs.ext4 /dev/sda1
[root@kvm7 ~]# mkdir /mnt/data
_netdev,且 dump 及 fsck 都不執行,也就是設成 0。
[root@kvm7 ~]# vim /etc/fstab [root@kvm7 ~]# tail -1 /etc/fstab /dev/sda1 /mnt/data ext4 _netdev 0 0
[root@kvm7 ~]# mount -a [root@kvm7 ~]# df -Th | grep data /dev/sda1 ext4 8.7M 172K 7.9M 3% /mnt/data