All Products
Search
Document Center

Use volumes from a Linux client

Last Updated: Jun 27, 2019

Install software required by the iSCSI initiator

To use a volume from a Linux client, you must connect the client to the target volume.

1、Use the iscsi-initiator-utils RPM package to connect the iSCSI initiator to the target iSCSI volume.

The following example shows how to install the package in CentOS and Red Hat: Run the sudo yum install iscsi-initiator-utils command to install the package. If you have already installed the package, skip this step.

Verify that the iSCSI daemon is running

2、Run the following command to check whether the iSCSI daemon is running.

sudo /etc/init.d/iscsi status //Applicable to RHEL 5 or RHEL 6

sudo service iscsid status //Applicable to RHEL7

If no running status is returned after you run the preceding command, run the following command to start the iSCSI daemon:

sudo /etc/init.d/iscsi start

Mount the volume

1、To discover the volume, you can access port 3260.

Format:

sudo iscsiadm -m discovery -t st –p < GATEWAY_IP >:3260

Example:

iscsiadm -m discovery -t st -p 192.168.0.227:3260

192.168.0.227:the IP address of the gateway. You can obtain the IP address in the Network Information area on the About page in the gateway console.

2、Mount the volume

To mount the volume, run the following command: Replace TargetName with the target name of the volume that you want to mount. You can obtain the target name in step 1. Replace GATEWAY_IP with the IP address of the gateway.

Note: Due to restrictions of the iSCSI protocol, do not mount one volume to multiple clients.

Format:

iscsiadm --mode node --targetname <TargetName> --portal <GATEWAY_IP> -l

Example:

iscsiadm -m node -T iqn.2009-09.com.aliyun.iscsi-sgw:0test-test730 -p 192.168.0.227:3260 –l

The following figure shows the procedure:

1

View the volume

You can run the “fdisk -l” or “lsblk” command to view the volume that you have mounted. In the current state, the volume has become an available raw disk. The following figure shows the output of the “fdisk -l” command:

查看