Connecting & Disconnecting Volumes Using the CLI

This topic shows how to attach, connect, and disconnect volumes (as well as how to run other volume tasks) using the Windows or the Linux CLI. Before you can run these commands, you must first install either the Windows CLI utility or the Linux CLI utility.

After you install the utility, you can display all available commands by typing cvctl --help.

Note that you can override the default geo setting for most cvctl volume commands by adding --default-geo <geo> to the command.

Important: The following command examples are shown using Linux syntax. To run the commands in Windows, use backslashes (\) instead of forward slashes (/) and do not type sudo on the command line.

Attaching a Volume

To attach a volume to a cloud VM, run the cvctl command with the attach option. The following is the complete syntax for this command:

./cvctl attach cloudvolume --name <cloud_volume_name> --initiator-ip <initiator_ip_address>

Note: The initiator-ip in this command is the internal IP address of the Cloud VM.

Detaching a Volume

To detach a volume from a cloud VM, run the cvctl command with the detach option. The following is the complete syntax for this command:

./cvctl detach cloudvolume --name <cloud_volume_name>

Connecting a Volume

To connect a volume to a cloud VM, run the cvctl command with the connect option. The following is the complete syntax for this command:

./cvctl connect cloudvolume 
--name <cloud_volume_name>
[--initiator-ip <initiator_ip_address> |
--discovery-ip <ip> 
--target-name <iqn> 
--chap-user <chapUsername> 
--chap-secret <chapPassword>]
[--output {json|text}]

Note: The initiator-ip in this command is the internal IP address of the Cloud VM.

If you configured cvctl using --local-mode, run the following command to connect your volume:

./cvctl connect cloudvolume --name <cloud_volume_name> --discovery-ip <ip> --target-name <iqn> --chap-user <chapUsername> --chap-secret <chapPassword>

Example:

sudo ./cvctl connect cloudvolume --name mycloudvolume --discovery-ip 51.0.0.132--target-name iqn.2007-11.com.nimblestorage:1-94-mycloudvolume-v16acd21b51ed837b.00003009.47415160 --chap-user aa55d737-80d8-3faf-8943-2536857824a9 --chap-secret Ws8qAk7IDQ4gB7ee

Otherwise, connect the volume using the following command:

sudo ./cvctl connect cloudvolume --name <cloud_volume_name> --initiator-ip <initiator_ip_address>

Example:

sudo ./cvctl connect cloudvolume --name mycloudvolume

Connecting a Volume with Multiple NICS

If you are connecting a volume in Azure and you have a two network interface, you must add a route to the gateway from the second NIC. You should also check to see if any kernel firewall is blocking any of the NIC ports.

Note: You must provide an initiator IP or else a default IP will be chosen.

Disconnecting a Volume

To disconnect a volume from a cloud VM, run the cvctl command with the disconnect option. The following is the complete syntax for this command:

./cvctl disconnect cloudvolume
--name <cv_name>
[--device <os_disk_info> | 
--target-name <target_cv_name>
--target-id uint32]
[--force] 
[--with-detach] 
[--output {json|text}]

If you configured cvctl using --local-mode, run the following command to disconnect your volume:

./cvctl disconnect cloudvolume --name <cv_name> (--device <os_disk_info> | --target-name <target_CV_name> | --target-id uint32)

Example

sudo ./cvctl disconnect cloudvolume --name mycloudvolume --target-id 3118904195 --force

Otherwise, disconnect the volume using the following command:

./cvctl disconnect cloudvolume --name <cv_name>

Example:

sudo ./cvctl disconnect cloudvolume --name mycloudvolume --force

Note: If you are running Linux, and if there are partitions on the device, you will need to perform the following steps before you can disconnect the volume:

  1. Run the following command to display a list of the devices that are connected to the host:

    ./cvctl list cloudvolumes
    
  2. Run the following command and make note of the partition map name that corresponds to the device (ending with p1/2/3 etc. For example, : mpathb1):

    ls -l /dev/mapper/
    
  3. Run the following umount command:

    umount /mnt/nimble/vol1/
    
  4. Run the following dmsetup command:

    dmsetup remove /dev/mapper/mpathb1
    

Displaying Connected Volumes

To display a list of all the volumes that you own , run the cvctl command with the list option:

./cvctl list cloudvolumes

Tip: To display a list of the volumes that are connected to the VM that you are running the command from, include the --local option:

./cvctl list cloudvolumes --local

To display detailed information about a particular volume, run the cvctl command with the get option:

./cvctl get cloudvolume --name <cloud_volume_name>

Creating a Volume

To create a volume, run the cvctl command with the create option. The following is the complete syntax for this command:

./cvctl create cloudvolume 
--name <cloud_volume_name> 
[--config-file <json-config-file>] 
--size <size_in_GB> 
--iops <IOPS> 
--perf-policy <appType> 
--schedule <snap_schedule> 
--retention <snap_retention> 
--encryption {true | false} 
--volume-tier {GPF | PF} 
--cloud-compute-provider { AWS | AZURE } 
--region <region_name> [--private-cloud-resource-group <cloud_resource_grp_name>] 
--private-cloud <private_cloud_network> 
--existing-cloud-subnet <cloud_subnet> 
[--initiator-ip <initiator_ip_address>] 
[--output {json|text}]

Note that if your parameters are placed in a configuration file, you can pass the name of the configuration file as an argument to the create command rather than entering individual parameters on the command line. For example, suppose you have a configuration file named myconfig.json that contains the following parameters:

{
    "name": "myvolume",
    "size": 1024,
    "iops": 300,
    "volume-tier": "GPF",
    "encryption": true,
    "perf-policy": "Oracle",
    "schedule": "twicedaily",
    "retention": 4,
    "cloud-compute-provider": "Amazon AWS",
    "region": "us-west-1",
    "private-cloud": "vpc-1f354a7b",
    "existing-cloud-subnet": "192.168.0.0/16",
    "automated_connection": true
}

To create a volume with the above parameters, specify myconfig.json on the command line:

./cvctl create --file myconfig.json

You can also override parameters that are in your configuration file by specifying the parameter on the command line. For example, to create a volume named Volume2 (in place of myvolume in myconfig.json) enter:

./cvctl create cloudvolume --name "Volume2" --file myconfig.json

Destroying a Volume

To destroy a volume, run the cvctl command with the destroy option. The following is the complete syntax for this command:

./cvctl destroy cloudvolume
--name <cloud_volume_name> 
[--delete-base-snap]
[--force-disconnect]
[--permanent] 
[--output {json|text}]

Tip: When you delete a volume, the volume is marked for deletion but is not permanently deleted for 24 hours. To permanently delete a volume immediately, use the --permanent option in the command.

Related Information

Performing Replication Tasks using the CLI