We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Create & Delete GlusterFS Volumes

Learn how to – How To Create & Delete GlusterFS Volumes.

A volume is a logical collection of bricks. Most of the Gluster Storage management operations happen on the volume. For those new to GlusterFS, a brick is a basic unit of storage. Brick is represented by an export directory on a server in the trusted storage pool.

In this guide, we will see how you can create various volume types in GlusterFS and how they can be deleted when not needed. You can create and manage Gluster Volumes with the gluster command line tool, or with Heketi. See our previous guide:

Check your GlusterFS trusted storage pool to make sure servers are connected.

# gluster pool list
UUID					                Hostname                           State
6c41bcc9-a419-4dab-bc0b-d93e21d4d9e3	gluster2.example.com               Connected 
4c90da9b-1c2a-419b-b02a-cfc0a013f0c0	gluster3.example.com               Connected 
c989c715-0fe6-4575-a6d9-920117ecd5a5	localhost                          Connected 

You can also see peers from one node:

# gluster peer status
Number of Peers: 2

Hostname: gluster2.example.com
Uuid: 6c41bcc9-a419-4dab-bc0b-d93e21d4d9e3
State: Peer in Cluster (Connected)
Other names: gluster2.example.com

Hostname: gluster3.example.com
Uuid: 4c90da9b-1c2a-419b-b02a-cfc0a013f0c0
State: Peer in Cluster (Connected)
Other names: gluster3.example.com

Create Gluster Volumes using Heketi

I prefer managing Gluster Volumes with Heketi since it will automatically create brick and on the servers matching the replication factor as opposed to doing it manually.

When creating a Gluster Volume with Heketi, the command syntax is:

heketi-cli volume create [options]

Some of the options available are:

--name string: Optional: Name of volume. Only set if really necessary
--size int: Size of volume in GiB
--replica int: Replica value for durability type 'replicate'. (default 3)
--redundancy int: Optional: Redundancy value for durability type 'disperse'. (default 2)
--durability string: Optional: Durability type.  Values are:
		none: No durability.  Distributed volume only.
		replicate: (Default) Distributed-Replica volume.
		disperse: Distributed-Erasure Coded volume. (default "replicate")
--clusters string:  Comma separated list of cluster ids where this volume must be allocated. If omitted, Heketi will allocate the volume on any of the configured clusters which have the available space

For all options, use:

$ heketi-cli volume create --help

Consider an example below which creates a volume of 2GB with a replica of 2 on any cluster.

# heketi-cli volume create --size=2 --replica=2 
Name: vol_21e37ed5fa796e764503fcd7f5ac1d65
Size: 2
Volume Id: 21e37ed5fa796e764503fcd7f5ac1d65
Cluster Id: c200453199923b01cc5409c22e1fa472
Mount: 10.10.1.87:vol_21e37ed5fa796e764503fcd7f5ac1d65
Mount Options: backup-volfile-servers=10.10.1.88,10.10.1.86
Block: false
Free Size: 0
Reserved Size: 0
Block Hosting Restriction: (none)
Block Volumes: []
Durability Type: replicate
Distributed+Replica: 2

Confirm creation by listing the Volumes on GlusterFS.

# gluster volume list
vol_02ff70d8dd163b23a377789220222028
vol_12f7a68bbe7a1dd24646aa49552fff09
vol_21e37ed5fa796e764503fcd7f5ac1d65
vol_5744235f15a02f7fee4da00935180b28
vol_6dd86a7a39eba6421b4a6508d718578a
vol_bfeab3aacd1cb9cb21142b5d90b8fdd8

Same can be seen with heketi-cli command:

# heketi-cli volume list
Id:02ff70d8dd163b23a377789220222028    Cluster:c200453199923b01cc5409c22e1fa472    Name:vol_02ff70d8dd163b23a377789220222028
Id:12f7a68bbe7a1dd24646aa49552fff09    Cluster:c200453199923b01cc5409c22e1fa472    Name:vol_12f7a68bbe7a1dd24646aa49552fff09
Id:21e37ed5fa796e764503fcd7f5ac1d65    Cluster:c200453199923b01cc5409c22e1fa472    Name:vol_21e37ed5fa796e764503fcd7f5ac1d65
Id:5744235f15a02f7fee4da00935180b28    Cluster:c200453199923b01cc5409c22e1fa472    Name:vol_5744235f15a02f7fee4da00935180b28
Id:6dd86a7a39eba6421b4a6508d718578a    Cluster:c200453199923b01cc5409c22e1fa472    Name:vol_6dd86a7a39eba6421b4a6508d718578a
Id:bfeab3aacd1cb9cb21142b5d90b8fdd8    Cluster:c200453199923b01cc5409c22e1fa472    Name:vol_bfeab3aacd1cb9cb21142b5d90b8fdd8

To view volume bricks, use the gluster volume info command.

# gluster volume info vol_21e37ed5fa796e764503fcd7f5ac1d65
Volume Name: vol_21e37ed5fa796e764503fcd7f5ac1d65
Type: Replicate
Volume ID: 66129da3-e6c1-4b8a-9a59-05d8c390d99d
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: 10.10.1.88:/var/lib/heketi/mounts/vg_fc107456200a59cb281297221910acb9/brick_5cc64586a9afd6a5c3e6ae192ef36e50/brick
Brick2: 10.10.1.86:/var/lib/heketi/mounts/vg_c1d0e019f9b7e489c3492c1287fd9833/brick_dab79b7c59011cac54a2d7cb1e753bdf/brick
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off

If you’re using the GlusterFS Client to mount GlusterFS volumes, the command syntax is:

mount -t glusterfs server:brick_path /mountpoint

Delete Gluster Volume

You can use heketi-cli or gluster commands to delete volumes created.

Syntax:

heketi-cli volume delete <volumeid>

Example:

# heketi-cli volume list | grep vol_21e37ed5fa796e764503fcd7f5ac1d65
Id:21e37ed5fa796e764503fcd7f5ac1d65    Cluster:c200453199923b01cc5409c22e1fa472    Name:vol_21e37ed5fa796e764503fcd7f5ac1d65

# heketi-cli volume delete 21e37ed5fa796e764503fcd7f5ac1d65
Volume 21e37ed5fa796e764503fcd7f5ac1d65 deleted

If using gluster command, first stop the volume then delete

# gluster volume stop vol_c8d8e520e64c5c583b8807576a61128c
Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y
volume stop: vol_c8d8e520e64c5c583b8807576a61128c: success

# gluster volume delete vol_c8d8e520e64c5c583b8807576a61128c
Deleting volume will erase all information about the volume. Do you want to continue? (y/n) y
volume delete: vol_c8d8e520e64c5c583b8807576a61128c: success

That’s all for today on how you can create and delete Volumes in GlusterFS. More guides to follow.

Cart

Your Cart is Empty

Back To Shop