7.4. Managing iSCSI volumes¶
This section describes how to create and manage volumes to be exported via iSCSI.
7.4.1. Creating iSCSI volumes¶
To create a volume, use the vstorage-target vol-create
command. For example:
# vstorage-target vol-create -name vol1 -size 1G \
-vstorage-attr "replicas=3:2 failure-domain=host tier=0"
{
"Id": "3277153b-5296-49c5-9b66-4c200ddb343d"
}
This command creates a 1 GB volume named vol1
on storage tier 0 with 3:2 replication and host as failure domain.
7.4.2. Listing and printing details of iSCSI volumes¶
To list volumes, use the vstorage-target vol-list
command. For example:
# vstorage-target vol-list
[
"3277153b-5296-49c5-9b66-4c200ddb343d",
"a12110d5-cbbc-498a-acdd-a8567286f927",
"d5cc3c13-cfb4-4890-a20d-fb80e2a56278"
]
Use vstorage-target vol-stat -all
to print details of all volumes. To print details of a specific volume, run vstorage-target vol-stat -id <vol_ID>
.
7.4.3. Attaching iSCSI volumes to target groups¶
To attach a volume to a target group, use the vstorage-target tg-attach
command. A volume cannot be attached to multiple target groups at the same time. For example:
# vstorage-target tg-attach -id 3d8364f5-b830-4211-85af-3a19d30ebac4 \
-volume 3277153b-5296-49c5-9b66-4c200ddb343d -lun 0 -node bbfd0e7a26b1406d
This command attaches the volume with the ID 3277153b-5296-49c5-9b66-4c200ddb343d
to a target group with the ID 3d8364f5-b830-4211-85af-3a19d30ebac4
as LUN 0. LUN ID numbering must start with 0. The same command sets the PREFERRED
bit to the node with the ID bbfd0e7a26b1406d
. The default Active/Optimized path will go via this node.
7.4.4. Setting the Active/Optimized path for iSCSI volumes¶
To set an Active/Optimized path for an iSCSI volume, use the vstorage-target vol-set
command. It will only work if the specified node is STABLE
.
Note
Make sure the new preferred node is reachable by the initiator.
# vstorage-target vol-set -id 3d8364f5-b830-4211-85af-3a19d30ebac4 \
-pref-node bbfd0e7a26b1406d
This command sets the Active/Optimized path for the volume with the ID 3d8364f5-b830-4211-85af-3a19d30ebac4
to the node with the ID bbfd0e7a26b1406d
.
7.4.5. Viewing iSCSI volume ALUA information¶
To view the ALUA information for an iSCSI volume, use the vstorage-target vol-info
command. For example:
# vstorage-target vol-info -id 3d8364f5-b830-4211-85af-3a19d30ebac4
Volume ID: 3d8364f5-b830-4211-85af-3a19d30ebac4
Name: vol1
Size: 1073741824
Used: 1073152
Serial: d2be0e84fd7f
Attrs: map[]
TG: 4708b908-8c2d-444c-91b1-a1e18a96d4fc
LUN: 0
*** Node #0 ***
-------------------------
NodeId: bbfd0e7a26b1406d
State: synced
TPGs: vstorage_tpg_0
ALUA: active
Preferred: 1
WWNs: iqn.2014-06.com.vstorage:target1 [2]
Portals: 10.37.130.61
This command shows the ALUA details for the volume with the ID 3d8364f5-b830-4211-85af-3a19d30ebac4
.
7.4.6. Viewing and setting iSCSI volume parameters¶
To view and set volume parameters, for example, redundancy mode, failure domain, or tier, use the commands vstorage-target vol-attr get
and vstorage-target vol-attr set
. For example:
# vstorage-target vol-attr get -id d5cc3c13-cfb4-4890-a20d-fb80e2a56278
{
"chunk-size": "268435456",
"client-ssd-cache": "1",
"failure-domain": "host",
"replicas": "3:2",
"tier": "0"
}
# vstorage-target vol-attr set -id d5cc3c13-cfb4-4890-a20d-fb80e2a56278 \
-vstorage-attr "replicas=2:1 tier=1"
The first command shows the parameters of the volume with the ID d5cc3c13-cfb4-4890-a20d-fb80e2a56278
. The second command sets the redundancy mode to 2 replicas and the tier to 1 for this volume.
7.4.7. Increasing iSCSI volume size¶
To increase the size of a volume, use the vstorage-target vol-grow
command. For example:
# vstorage-target vol-grow -id d5cc3c13-cfb4-4890-a20d-fb80e2a56278 -size 2G
This command expands the volume with the ID d5cc3c13-cfb4-4890-a20d-fb80e2a56278
to 2 GB.
7.4.8. Setting iSCSI volume limits¶
To set read/write limits for a volume, use the vstorage-target vol-limits
command. For example:
# vstorage-target vol-limits -id d5cc3c13-cfb4-4890-a20d-fb80e2a56278 -read-bps 10485760 \
-write-bps 10485760
This command sets read/write speed for the volume with the ID d5cc3c13-cfb4-4890-a20d-fb80e2a56278
to 10485760 bytes per second.
7.4.9. Detaching iSCSI volumes from target groups¶
To detach a volume from a target group, use the vstorage-target tg-detach
command. LUN 0 must be detached last. For example:
# vstorage-target tg-detach -id 3d8364f5-b830-4211-85af-3a19d30ebac4 \
-volume d5cc3c13-cfb4-4890-a20d-fb80e2a56278
This command detaches the volume with the ID d5cc3c13-cfb4-4890-a20d-fb80e2a56278
from the target group with the ID 3d8364f5-b830-4211-85af-3a19d30ebac4
.
7.4.10. Deleting iSCSI volumes¶
To delete a volume, use the vstorage-target vol-delete
command. You cannot delete volumes attached to target groups. For example:
# vstorage-target vol-delete -id d5cc3c13-cfb4-4890-a20d-fb80e2a56278
This command deletes the volume with the ID d5cc3c13-cfb4-4890-a20d-fb80e2a56278
.