pxctl volume update
pxctl volume update
is used to update a specific parameter of the volume
It has the following options.
sudo /opt/pwx/bin/pxctl volume update --help
NAME:
pxctl volume update - Update volume settings
USAGE:
pxctl volume update [command options] [arguments...]
OPTIONS:
--shared value, -s value set shared setting to on/off
--sticky on/off set sticky setting to on/off
--scale factor New scale factor [1...1024] (default: 0)
--size value New size for the volume (GiB)
Change Shared Option
Using the --shared
flag, the volume namespace sharing across multiple volumes can be turned on or off.
For e.g., for the volume clitest, here is the output of volume inpsect.
sudo /opt/pwx/bin/pxctl volume inspect clitest
Volume : 970758537931791410
Name : clitest
Size : 1.0 GiB
Format : ext4
HA : 1
IO Priority : LOW
Shared : no
Status : up
State : detached
Reads : 0
Reads MS : 0
Bytes Read : 0
Writes : 0
Writes MS : 0
Bytes Written : 0
IOs in progress : 0
Bytes used : 33 MiB
Replica sets on nodes:
Set 0
Node : 10.99.117.133
The shared
field is shown as ‘no’ indicating that this is not a shared volume
sudo /opt/pwx/bin/pxctl volume update clitest --shared=on
Let’s do a pxctl volume inspect
on the volume again.
sudo /opt/pwx/bin/pxctl volume inspect clitest
Volume : 970758537931791410
Name : clitest
Size : 1.0 GiB
Format : ext4
HA : 1
IO Priority : LOW
Shared : yes
Status : up
State : detached
Reads : 0
Reads MS : 0
Bytes Read : 0
Writes : 0
Writes MS : 0
Bytes Written : 0
IOs in progress : 0
Bytes used : 33 MiB
Replica sets on nodes:
Set 0
Node : 10.99.117.133
As shown above, the volume is shown as shared=yes
indicating that this is a shared volume
For adding the --sticky
attribute to a volume, use the following command.
Change Volume Sticky Option
sudo /opt/pwx/bin/pxctl volume update clitest --sticky=on
Doing a subsequent inspect on the volume shows the attributes
field set to sticky
sudo /opt/pwx/bin/pxctl volume inspect clitest
Volume : 970758537931791410
Name : clitest
Size : 1.0 GiB
Format : ext4
HA : 1
IO Priority : LOW
Creation time : Feb 26 08:17:20 UTC 2017
Shared : yes
Status : up
State : detached
Attributes : sticky
Reads : 0
Reads MS : 0
Bytes Read : 0
Writes : 0
Writes MS : 0
Bytes Written : 0
IOs in progress : 0
Bytes used : 33 MiB
Replica sets on nodes:
Set 0
Node : 10.99.117.133
Increase Volume Size
Here is an example of how to update size of an existing volume. Let’s create a volume with default parameters. This will create a volume of size 1 GB. We can verify this with volume inspect.
sudo /opt/pwx/bin/pxctl volume create vol_resize_test
Volume successfully created: 485002114762355071
sudo /opt/pwx/bin/pxctl volume inspect vol_resize_test
Volume : 485002114762355071
Name : vol_resize_test
Size : 1.0 GiB
Format : ext4
HA : 1
IO Priority : LOW
Creation time : Apr 10 18:53:11 UTC 2017
Shared : no
Status : up
State : detached
Reads : 0
Reads MS : 0
Bytes Read : 0
Writes : 0
Writes MS : 0
Bytes Written : 0
IOs in progress : 0
Bytes used : 32 MiB
Replica sets on nodes:
Set 0
Node : 172.31.55.104
In order to update the size of the volume, a non-shared volume needs to be mounted on one of PX nodes. If it’s a shared volume, then this operation can be done from any of the nodes where the volume is attached.
/opt/pwx/bin/pxctl host attach vol_resize_test
Volume successfully attached at: /dev/pxd/pxd485002114762355071
sudo mkdir /var/lib/osd/mounts/voldir
/opt/pwx/bin/pxctl host mount vol_resize_test /var/lib/osd/mounts/voldir
Volume vol_resize_test successfully mounted at /var/lib/osd/mounts/voldir
Let’s update size of this volume to 5 GB.
/opt/pwx/bin/pxctl volume update vol_resize_test --size=5
Update Volume: Volume update successful for volume vol_resize_test
We can verify this with volume inspect command.
/opt/pwx/bin/pxctl volume inspect vol_resize_test
Volume : 485002114762355071
Name : vol_resize_test
Size : 5.0 GiB
Format : ext4
HA : 1
IO Priority : LOW
Creation time : Apr 10 18:53:11 UTC 2017
Shared : no
Status : up
State : Attached: 43109685-e98a-448f-9805-293128e2d78b
Device Path : /dev/pxd/pxd485002114762355071
Reads : 138
Reads MS : 108
Bytes Read : 974848
Writes : 161
Writes MS : 1667
Bytes Written : 68653056
IOs in progress : 0
Bytes used : 97 MiB
Replica sets on nodes:
Set 0
Node : 172.31.55.104
Update the Volume Replication Level
pxctl volume ha-update
can be used to increase or decrease the replication factor for a given portworx volume.
The volume clitest
shown in the previous example is a volume with replication factor set to 1.
Here are the nodes in the cluster.
sudo /opt/pwx/bin/pxctl cluster list
Cluster ID: MY_CLUSTER_ID
Status: OK
Nodes in the cluster:
ID DATA IP CPU MEM TOTAL MEM FREE CONTAINERS VERSION STATUS
fa18451d-9091-45b4-a241-d816357f634b 10.99.117.133 0.5 8.4 GB 7.9 GB N/A 1.1.6-a879596 Online
b1aa39df-9cfd-4c21-b5d4-0dc1c09781d8 10.99.117.137 0.250313 8.4 GB 7.9 GB N/A 1.1.6-a879596 Online
bb605ca6-c014-4e6c-8a23-55c967d1a963 10.99.117.135 0.625782 8.4 GB 7.9 GB N/A 1.1.6-a879596 Online
Using pxctl volume ha-update
, here is how to increase the replication factor. Note, the command below sets the volume to replicate to the node with NodeID b1aa39df-9cfd-4c21-b5d4-0dc1c09781d8
sudo /opt/pwx/bin/pxctl volume ha-update --repl=2 --node b1aa39df-9cfd-4c21-b5d4-0dc1c09781d8 clitest
Once the replication completes and the new node is added to the replication set, the pxctl volume inspect
shows both the nodes.
sudo /opt/pwx/bin/pxctl volume inspect clitest
Volume : 970758537931791410
Name : clitest
Size : 1.0 GiB
Format : ext4
HA : 2
IO Priority : LOW
Creation time : Feb 26 08:17:20 UTC 2017
Shared : yes
Status : up
State : detached
Attributes : sticky
Reads : 0
Reads MS : 0
Bytes Read : 0
Writes : 0
Writes MS : 0
Bytes Written : 0
IOs in progress : 0
Bytes used : 33 MiB
Replica sets on nodes:
Set 0
Node : 10.99.117.133
Node : 10.99.117.137
pxctl volume alerts
will show when the replication is complete
sudo /opt/pwx/bin/pxctl volume alerts
AlertID VolumeID Timestamp Severity AlertType Description
25 970758537931791410 Feb 26 22:02:04 UTC 2017 NOTIFY Volume operation success Volume (Id: 970758537931791410 Name: clitest) HA updated from 1 to 2
The ha-update command can also be used to reduce the replication factor as well.
sudo /opt/pwx/bin/pxctl volume ha-update --repl=1 --node b1aa39df-9cfd-4c21-b5d4-0dc1c09781d8 clitest
Update Volume Replication: Replication update started successfully for volume clitest
Here is the output of the volume inspect command after the replication factor has been reduced to 1
sudo /opt/pwx/bin/pxctl volume inspect clitest
Volume : 970758537931791410
Name : clitest
Size : 1.0 GiB
Format : ext4
HA : 1
IO Priority : LOW
Creation time : Feb 26 08:17:20 UTC 2017
Shared : yes
Status : up
State : detached
Attributes : sticky
Reads : 0
Reads MS : 0
Bytes Read : 0
Writes : 0
Writes MS : 0
Bytes Written : 0
IOs in progress : 0
Bytes used : 33 MiB
Replica sets on nodes:
Set 0
Node : 10.99.117.133
Here is the output of the volume alerts.
25 970758537931791410 Feb 26 22:02:04 UTC 2017 NOTIFY Volume operation success Volume (Id: 970758537931791410 Name: clitest) HA updated from 1 to 2
26 970758537931791410 Feb 26 22:58:17 UTC 2017 NOTIFY Volume operation success Volume (Id: 970758537931791410 Name: clitest) HA updated