Linux Beginner-ISCSI article

Source: Internet
Author: User

Linux Beginner-iscsi articlePreviously introduced network file Sharing system NFS and CIFS. In the system, devices can also be shared, which is iSCSI, which can be used to establish and manage the connectivity between IP storage devices, hosts, and clients. This network device sharing system is briefly described below.
1. Installation

Because iSCSI is a device-sharing system, there is a need for a hard drive device between operations. In this article, you use "Fdisk/dev/vdb" to create a new partition device "/DEV/VDB1" as a shared device.

"Yum install Targetcli-y". The server needs to install this software to provide iSCSI services. When you are done, turn off the firewall, turn on the service, and set boot.

2. Service-side configuration

Enter the "targetcli" command to enter the interface and enter "LS" to see if there is a configuration.

The shared device "/DEV/VDB1" is now configured, and the configuration steps are as follows:

A, "/backstores/block create WE:STORAGE1/DEV/VDB1". Create a shared device based on "/DEV/VDB1".

B, "/iscsi Create Iqn.2017-08.com.example:storage1". Establish an "iSCSI" with the name "Iqn.2017-08.com.example:storage1" for the client connection.

C, "/iscsi/iqn.2017-08.com.example:storage1/tpg1/luns create/backstores/block/we:storage1". Connect the established "iSCSI" with the established shared device "We:storage1".

D, "/iscsi/iqn.2017-08.com.example:storage1/tpg1/acls create Iqn.2017-08.com.example:storage1key". Generates an encryption key.

E, "/iscsi/iqn.2017-08.com.example:storage1/tpg1/portals create 172.25.254.202". Open the port of the service.

Enter "Exit" to exit after completion. The configuration on the server side is complete.
3. Client Configuration
After the server configuration is complete, the device needs to be mounted on the client, and if the mount succeeds, the network device sharing is realized. The following configuration is also done on the client:

A, "Yum install Iscsi-initiator-utils.x86_64-y". This is the software that the client needs to install. Then turn off the firewall and turn on the service "iSCSI".

B, "Vim/etc/iscsi/initiatorname.iscsi". In this file, write the encryption key set in the service side and enter "Initiatorname=iqn.2017-08.com.example:storage1key". The Systemctl restart iSCSI Restart Service is required after the configuration is complete.

C, "Iscsiadm-m discovery-t-st-p 172.25.254.202". See what devices are shared on the host as a service side of "172.25.254.202".

D, "Iscsiadm-m node-t iqn.2017-08.com.example:storage1-p 172.25.254.202-l". Load the device "Iqn.2017-08.com.example:storage1" shared by the server.

E, "Fdisk-l". You can see one more device "/DEV/SDA" in the device.

F, "FDISK/DEV/SDA". For this device partition, after completing the input "MKFS.XFS/DEV/SDA1" to format the device.

Once the above steps are complete, the client can mount the device "/DEV/SDA1".

4, the Sharing device uninstall and delete
After the shared device is used, the configuration for the shared device needs to be deleted in order not to consume system resources. The specific steps are as follows:
A, the client's device uninstall
"Umount/mnt". Unmount the shared device that is mounted.
"Iscsiadm-m node-t iqn.2017-08.com.example:storage1-u". The shared device that was loaded before uninstalling.

"Iscsiadm-m node-t iqn.2017-08.com.example:storage1-o Delete". Delete this shared device. Because if you use the uninstall command only, although you cannot see the device using "fdisk-l", the device will reload automatically if you restart the iSCSI service, so you need to remove the device.

B. Configuration removal on the server side
"Targetcli". Enter the shared device configuration interface.

"Clearconfig confirm=true". Enter this command to delete all device shared configurations that were previously made.

To complete the client and server steps, the network shared device "ISCSI" is uninstalled and removed.
5. iSCSI and LVM
Previous LVM has been introduced, LVM is suitable for equipment size is unknown in the case, that can expand and compress disk space, its essence is also a device, so it can also be applied to iSCSI, so that the shared device can be expanded when space is not enough.

The method used is similar to a normal device, first configuring an LVM device "/dev/isvg/islv0".

When you are done, follow the iSCSI service-side configuration steps above to share the configuration for this device.

After the server configuration is complete, the client is configured in the same way as the normal device, that is, the query, loading, completion can be seen through "fdisk-l" the Device "/DEV/SDA", the size of 5364M.

However, in the expansion of the LVM space, the server expands the space, the client can not automatically refresh. As shown, extending this LVM device to "6000M" requires the client to first enter the command "Iscsiadm-m node-t iqn.2017-08.com.example:storage1-u" to unload the loaded device, and then "Systemctl Restart iSCSI "Restart service, re-use" fdisk-l "can see this shared device space has been successfully expanded to 6219M.

Linux Beginner-ISCSI article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.