Create and mount a shared scsi disk on centos 7
Lab device:
Use a virtual machine to virtualize two centos6.3-64bit systems and configure yum
IP settings:
Scsi server: 10.1.1.222
Scsi client (Mount end): 10.1.1.1
Lab started:
1. Install software on the server and configure the shared disk. First, add a new hard disk to the virtual machine. (Add 100 GB here)
[root
@localhost
~]
#fdisk-l
Disk/dev/sda:21.5GB,21474836480bytes
255heads,63sectors/track,2610cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x0005bb6c
DeviceBootStart
End
BlocksIdSystem
/dev/sda1*12620480083Linux
Partition1doesnot
end
oncylinderboundary.
/dev/sda226281204800082Linuxswap/Solaris
Partition2doesnot
end
oncylinderboundary.
/dev/sda328126111871769683Linux
Disk/dev/sdb:107.4GB,107374182400bytes
255heads,63sectors/track,13054cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x00077087
DeviceBootStart
End
BlocksIdSystem
2. Install the scsi server software
yuminstallscsi-target-utils-y
Shared disk (Add the following code to the configuration file)
vim/etc/tgt/targets.conf
<targetiqn.2008-09.com.example:server.target1>
backing-store/dev/sdb
</target>
Start the service
servicetgtdrestart
Disable firewall and selinux
3. Install the client software on the client and set the mounting
Install client software
yuminstalliscsi-initiator-utils-y
Check whether a shared disk exists.
iscsiadm--modediscoverydb--typesendtargets--portal10.1.1.222--discover
A shared disk 10.1.1.222: 3260, 1iqn.2008-09.com. example: server.tar get1 appears.
Attach Disk
iscsiadm--modenode--targetnameiqn.2008-09.com.example:server.target1--portal10.1.1.222:3260--login
Note: In the middle of-09, enter the disk name queried above.
The following prompt is displayed after the mounting is successful:
[root
@localhost
~]
#iscsiadm--modenode--targetnameiqn.2008-09.com.example:server.target1--portal10.1.1.222:3260--login
Logging
in
to[iface:
default
,target:iqn.2008-09.com.example:server.target1,portal:10.1.1.222,3260](multiple)
Loginto[iface:
default
,target:iqn.2008-09.com.example:server.target1,portal:10.1.1.222,3260]successful.
Check whether the following mounting is successful
[root
@localhost
~]
#fdisk-l
Disk/dev/sda:21.5GB,21474836480bytes
255heads,63sectors/track,2610cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x00036380
DeviceBootStart
End
BlocksIdSystem
/dev/sda1*12620480083Linux
Partition1doesnot
end
oncylinderboundary.
/dev/sda226281204800082Linuxswap/Solaris
Partition2doesnot
end
oncylinderboundary.
/dev/sda328126111871769683Linux
Disk/dev/sdb:107.4GB,107374182400bytes
255heads,63sectors/track,13054cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x00077087
DeviceBootStart
End
BlocksIdSystem
The GB hard disk is mounted successfully.
Lab ended