Expanding a block device image with nvmeof-cli
A block device image can be expanded at any time. Use this information to expand a namespace.
About this task
Important: A block device image can be expanded but not reduced.
Procedure
-
List all namespaces configured on a subsystem.
Use the NSID output to specify the subsystem to be resized, in step 2.
nvmeof-cli --server-address GATEWAY_IP --server-port SERVER_PORT namespace list --subsystem SUBSYSTEM_NQNFor example,[root@host01 ~]# nvmeof-cli --server-address 10.172.19.01 --server-port 5500 namespace list --subsystem nqn.2016-06.io.spdk:cnode1.group1 Namespaces in subsystem nqn.2016-06.io.spdk:cnode1.group1 : NSID| Bdev | RBD | RBD | Image | Block | UUID | Load | R/W IOs | R/W MB | Read MBs | Write MBs | Name | Pool | Image | Size | Size | | Balancing Group | per second | per second | per second | per second ============================================================================================================================================================== 1 | bdev-32c94dd8-8754- | pool1 | image1 | 1024 MiB | 512 B | 32c94dd8-8754-442f- | 2 | unlimited | unlimited | unlimited | unlimited | 442f-a12c-123abc456789 | | | | | a12c-123abc456789 | | | | | -------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 | bdev-45c94ee8-ab56- | pool1 | image2 | 1024 MiB | 512 B | 45c94ee8-ab56-332f- | 1 | unlimited | unlimited | unlimited | unlimited | 332f-a24c-abc123ae7890 | | | | | a24c-abc123ae7890 | | | | | -
Expand the block device image.
To use the namespace resize command, include the --nsid (namespace ID) parameter indicate the new --size.
The size is indicated in bytes, by default. To indicate a different size type, specify the unit. The supported size units are: K, KB, M, MB, G, GB, T, TB.
nvmeof-cli --server-address GATEWAY_IP --server-port SERVER_PORT namespace resize --subsystem SUBSYSTEM_NQN --nsid NSID --size SIZEFor example,[root@host01 ~]# nvmeof-cli --server-address 10.172.19.01 --server-port 5500 namespace resize --subsystem nqn.2016-06.io.spdk:cnode1.group1 --nsid 2 --size 1536
In this example, the size of NSID 2 on thenqn.2016-06.io.spdk:cnode1.group1subsystem is being increased to 1536 bytes.