Red Hat Training

A Red Hat training course is available for Red Hat Gluster Storage

3.4. Setting up Red Hat Gluster Storage in Microsoft Azure

This section provides step-by-step instructions to set up Red Hat Gluster Storage in Microsoft Azure.

3.4.1. Obtaining Red Hat Gluster Storage for Microsoft Azure

To download the Red Hat Gluster Storage Server files using a Red Hat Subscription or a Red Hat Evaluation Subscription:
  1. Visit the Red Hat Customer Service Portal at and enter your user name and password to log in.
  2. Click Downloads to visit the Software & Download Center.
  3. In the Red Hat Gluster Storage Server area, click Download Software to download the latest version of the VHD image.

3.4.2.  Define the Network Topology

By default, deploying an instance into a cloud service will pick up a dynamically assigned, internal IP address. This address may change and vary from site to site. For some configurations, consider defining one or more virtual networks within your account for instances to connect to. That establishes a networking configuration similar to an on-premise environment.
To create a simple network:
  1. Create the cloud service for the Gluster Storage nodes.
    # azure service create --serviceName service_name --location location
    For example,
    # azure service create --serviceName rhgs313-cluster --location "East US"
    info:    Executing command service create
    + Creating cloud service                                                       
    data:    Cloud service name rhgs313-cluster
    info:    service create command OK will be appended to the service name, and the full service name will be exposed directly to the Internet. In this case,
  2. Create a virtual network for the Gluster Storage nodes to connect to. In this example, the network is created within the East US location.
    # azure network vnet create --vnet "rhgs313-vnet" --location "East US" --address-space --cidr 16
    info:    Executing command network vnet create
    info:    Using default subnet start IP:
    info:    Using default subnet cidr: 19
    + Looking up network configuration                                             
    + Looking up locations                                                         
    + Setting network configuration                                                
    info:    network vnet create command OK
This defines a network within a single region.
Features like geo-replication within Gluster Storage require a vnet-to-vnet configuration. A vnet-to-vnet configuration connects virtual networks through VPN gateways. Each virtual network can be within the same region or across regions to address disaster recovery scenarios. Joining VPNs together requires a shared key, and it is not possible to pass a shared key through the Microsoft Azure CLI. To define a vnet-to-vnet configuration, use the Windows Powershell or use the Microsoft Azure REST API.

3.4.3. Resizing Virtual Hard Disks

Virtual Hard Disk (VHD) images on Microsoft Azure must have a virtual size aligned to 1MB. Typically, VHDs created using Hyper-V should already be aligned correctly. If the VHD is not aligned correctly then you may receive an error message similar to the following when you attempt to create an image from your VHD:
"The VHD has an unsupported virtual size of 21475270656 bytes. The size must be a whole number (in MBs).”
To remedy this you can resize the VM using either the Hyper-V Manager console or the Resize-VHD Powershell cmdlet as per the instruction available at: If you are not running in a Windows environment then it is recommended to use qemu-img to convert (if needed) and resize the VHD.


There is a known bug in qemu-img versions >=2.2.1 that results in an improperly formatted VHD. The issue will be fixed in an upcoming release of qemu-img. For now it is recommended to use qemu-img version 2.2.0 or lower. For more information on the bug .
  1. Resizing the VHD directly using tools such as qemu-img or vbox-manage may result in an unbootable VHD. So it is recommended to first convert the VHD to a RAW disk image. If the VM image was already created as RAW disk image (the default for some Hypervisors such as KVM) then you may skip this step:
    # qemu-img convert -f vpc -O raw rhgs313-cluster.vhd rhgs313-cluster.raw 
  2. Calculate the required size of the disk image to ensure that the virtual size is aligned to 1MB. The following bash shell script can assist with this. The script uses qemu-img info to determine the virtual size of the disk image and then calculates the size to the next 1MB:
    size=$(qemu-img info -f raw --output json "$rawdisk" | \
           gawk 'match($0, /"virtual-size": ([0-9]+),/, val) {print val[1]}')
    rounded_size=$((($size/$MB + 1)*$MB))
    echo "Rounded Size = $rounded_size"
  3. Resize the raw disk using $rounded_size as set in the above script:
    # qemu-img resize rhgs31-cluster.raw $rounded_size
  4. Now, convert the RAW disk back to a fixed-size VHD:
    # qemu-img convert -f raw -o subformat=fixed -O rhgs313-cluster.raw  rhgs313-cluster.vhd

3.4.4.  Upload the Disk Image to Microsoft Azure

The disk image has now been prepared and can be uploaded and used as a template for Gluster Storage nodes.


Microsoft Azure commands must be issued from the local account configured to use the xplat-cli.
To upload the image to Microsoft Azure, navigate to the directory where the VHD image is stored and run the following command:
# azure vm image create image_name --location location --os linux VHD_image_name
For example,
 # azure vm image create rhgs-3.1.3 --location "East US" --os linux rhgs313.vhd
 info:    Executing command vm image create
+ Retrieving storage accounts
info:    VHD size : 20 GB
info:    Uploading 20973568.5 KB
Requested:100.0% Completed:100.0% Running:   0 Time: 7m50s Speed:  3876 KB/s
info: was uploaded successfully
info:    vm image create command OK
Once complete, confirm the image is available:
# azure vm image list | awk '$3 == "User" {print $2;}'


The output of an instance image list will show public images as well as images specific to your account (User), so awk is used to display only the images added under the Microsoft Azure account.

3.4.5.  Deploy the Gluster Storage Instances

Individual Gluster Storage instances in Microsoft Azure can be configured into a cluster. You must first create the instances from the prepared image and then attach the data disks.
  1. To create instances from the prepared image
    # azure vm create --vm-name vm_name --availability-set name_of_the_availability_set --vm-size size --virtual-network-name vnet_name --ssh port_number --connect cluster_name username_and_password
    For example,
    # azure vm create --vm-name rhgs313-1 --availability-set AS1 -S --vm-size Medium --virtual-network-name rhgs313-vnet --ssh 50001 --connect rhgs313-cluster rhgs-3.1.3  rhgsuser 'AzureAdm1n!'
     info:    Executing command vm create
    + Looking up image rhgs-313                                                    
    + Looking up virtual network                                                   
    + Looking up cloud service                                                     
    + Getting cloud service properties                                             
     + Looking up deployment                                                        
    + Creating VM                                                                  
    info:    OK
    info:    vm create command OK
  2. Adding 1023 GB data disk to each of the instances.
    # azure vm disk attach-new VM_name 1023
    For example
    # azure vm disk attach-new rhgs313-1 1023
    info:    Executing command vm disk attach-new
    + Getting virtual machines                                                     
    + Adding Data-Disk                                                             
    info:    vm disk attach-new command OK
  3. Perform the above steps of creating instances and attaching disks for all the instances
  4. Confirm that the instances have been properly created:
    # azure vm list
    # azure vm show vm-name
  • A Microsoft Azure availability set provides a level of fault tolerance to the instances it holds, protecting against system failure or planned outages. This is achieved by ensuring instances within the same availability set are deployed across different fault and upgrade domains within a Microsoft Azure datacenter.
  • When Gluster Storage replicates data between bricks, associate the replica sets to a specific availability set. By using availability sets in the replication design, incidents within the Microsoft Azure infrastructure cannot affect all members of a replica set simultaneously.
  • Each instance is assigned a static IP (-S) within the rhgs-- virtual network and an endpoint added to the cloud service to allow SSH access (--ssh port).
  • There are single quotation marks (') around the password to prevent bash interpretation issues.

Following is the example for creating four instances from the prepared image.

  • They are named rhgs31-n .
  • Their IP address are to
As the instances are created (azure vm create), they can be added to the same availability set (--availability-set).
for i in 1 2 3 4; do as=$((i/3)); azure vm create --vm-name rhgs31-$i --availability-set AS$as -S$i --vm-size Medium --virtual-network-name rhgs-vnet --ssh 5000$i --connect rhgs-cluster rhgs3.1 rhgsuser 'AzureAdm1n!'; done
Add four 1023 GB data disks to each of the instances.
for node in 1 2 3 4; do for disk in 1 2 3 4; do azure vm disk attach-new rhgs31-$node 1023; done ; done
Confirm that the instances have been properly created:
# azure vm list
# azure vm show vm-name


This example uses static IP addresses, but this is not required. If you’re creating a single Gluster Storage cluster and do not need features like geo-replication, it is possible to use the dynamic IPs automatically assigned by Microsoft Azure. The only important thing is that the Gluster Storage cluster is defined by name.

3.4.6.  Configure the Gluster Storage Cluster

Configure these instances to form a trusted storage pool (cluster).


If you are using Red Hat Enterprise Linux 7 machines, log in to the Azure portal and reset the password for the VMs and also restart the VMs. On Red Hat Enterprise Linux 6 machines, password reset is not required.
  1. Log into each node.
    # ssh -p 50001
  2. Register each node to Red Hat Network using the subscription-manager command, and attach the relevant Red Hat Storage subscriptions.
  3. Update each node to ensure the latest enhancements and patches are in place.
    # yum update
  4. Follow the instructions in the Red Hat Gluster Storage Administration Guide to create the trusted storage pool: