How to create and attach Elastic Block Storage Volume to a Linux server

Learn how to create, attach, and configure Cherry Servers Elastic Block Storage (EBS) on a Linux server using the Client Portal and a shell-based automation script.

 

Key points to consider ey points to consider

  • Elastic Block Storage volumes are triplicated across nodes to ensure high availability and automatic real-time self-healing.

  • Volumes can be created, deleted, and attached through the Cherry Servers Client Portal.

  • Each volume supports up to 5 TB in size and delivers up to 500 IOPS.

  • Linux configuration is performed using a Bash script that sets up the VLAN interface and iSCSI initiator automatically.

  • No reboot is required during Linux configuration, and the script runs directly from the terminal.

  • After successful execution, the new block storage device (e.g., /dev/sdb) becomes available for use.

  • Final configuration includes:

    • Creating a file system (typically ext4)

    • Mounting the volume to a directory such as /mnt/ebs

    • Making the mount persistent by adding it to /etc/fstab with the _netdev option

  • The volume will then be usable as a standard storage mount point for your applications or data.

Introduction

Elastic Block Storage (EBS) is a high-availability, software-defined block storage solution designed for persistent data workloads. It is well suited for cloud native applications, private or public cloud environments, and Kubernetes clusters.

Each EBS volume uses a shared-nothing architecture that distributes data blocks across multiple physical nodes. To ensure data durability and fault tolerance, each block is stored in triplicate, enabling real-time self-healing and protection against silent data corruption or node failure. 

Volumes are managed through the Cherry Servers Client Portal and can be dynamically attached to any dedicated server in the same region. After attachment, Linux users can configure the volume using an automated Bash script that sets up the necessary network interfaces and iSCSI connectivity. After creating a file system and mounting the volume, it becomes available for use within the Linux environment.

Note: EBS is currently available only in the LT-Siauliai region and is supported only on dedicated servers.

Step-by-Step Instructions

Step 1: Create a new Elastic Block Storage volume

To begin using Elastic Block Storage on your Linux server, you must first create a new volume from the Cherry Servers Client Portal. This volume will later be attached to your server and mounted within the Linux environment.

  1. Log in to your Cherry Servers Client Portal using your account credentials (see Fig. 1).


    Fig. 1. Log in to your Cherry Servers account using your email and password, or a supported social login (Google, GitHub, or Facebook).
  2. In the top navigation menu, click on the Storages tab inside your active project. Then switch to the Elastic Block Storage section. If you have not created any volumes yet, an empty storage view will be shown with an option to order your first volume (see Fig. 2).


    Fig. 2. Navigate to Storages, Elastic Block Storage to view or create block storage volumes. An empty view appears if no volumes exist yet.
  3. Click on the Order button to begin the creation process (see Fig. 3).


    Fig. 3. Click the Order button to begin creating a new Elastic Block Storage volume when no volumes exist yet.
  4. In the form that appears (see Fig. 4):

    • Select the region where your server is located. At the time of writing, Elastic Block Storage is available only in the LT-Siauliai region.

    • Enter a description to help identify your volume. This helps you identify it later, especially when working with multiple storage devices.

    • Specify the volume size in gigabytes (GB). You can allocate any size up to 5000GB (5 TB), depending on your project requirements.


    Fig. 4. Fill in the region, description, and desired size for your new volume.
  5. Once all fields are filled in, click Order to finalize the creation process (see Fig. 5).


    Fig. 5. Once you have set all parameters, click the Order button to create the new Elastic Block Storage volume.

After a few moments, the volume will appear in your storage list (see Fig. 6). You are now ready to proceed with attaching the volume to a dedicated server.

Fig. 6. After successful creation, the new Elastic Block Storage volume appears in the list and is ready to be attached to a server. A confirmation message is shown in the top right corner.

Step 2: Attach the volume to your server

Once your Elastic Block Storage volume has been successfully created, it will appear in the Elastic Block Storage section of your project in the Client Portal (see Fig. 6). At this point, the volume exists but is not yet associated with any server, so it cannot be used until attached.

  1. In the volume list, locate your newly created volume. Click the Attach button next to the volume entry to begin the attachment process (see Fig. 7).


    Fig. 7. Click the Attach button next to your newly created volume to begin linking it to a server.
  2. A dialog window titled Elastic Block Storage attachment will open. This interface allows you to select the server to which the volume should be attached (see Fig. 8).


    Fig. 8 Elastic Block Storage attachment dialog window where you select the target server instance and confirm the action by clicking Attach.
  3. From the Target instance drop-down menu, select the appropriate dedicated server located in the same region. Only compatible servers will be displayed in the list (see Fig. 9).


    Fig. 9. Target instance selection drop-down within the Elastic Block Storage attachment dialog. Choose the server you want to attach the volume to.
  4. After confirming your selection, click the blue Attach button to initiate the attachment process (see Fig. 10).


    Fig. 10. Final confirmation step of the Elastic Block Storage attachment. Click the Attach button to bind the selected volume to your target server.
  5. Once attached, a success notification will be displayed (see Fig. 11), and a setup instructions popup will automatically appear with configuration details (see Fig. 12).

    Fig. 11. Success notification confirming that the Elastic Block Storage volume has been successfully attached to the selected server.

    Fig. 12. Elastic Block setup instructions window showing the necessary variables for Shell configuration, including VLAN ID, IP addresses, and iSCSI initiator.

This window displays essential variables such as vlan_id, vlan_ip, portal_ip, and initiator, which are required to set up the volume on your Linux server in the next step. You will use these values when executing the Bash automation script.

Step 3: Configure the Elastic Block Storage on Linux server

After successfully attaching the volume to your server, you must configure the storage within your Linux environment. This is done by running a shell script, that handles iSCSI initiator configuration and connects the volume.

  1. Connect to your Linux server via SSH :
    Log in to your Linux server where the volume was attached. You can use SSH from your terminal or any SSH client of your choice. Refer to our step by step guide for connecting to a Linux server: how to connect to a Linux server using SSH.
  2. Download the configuration script:
    Run the following command to download the setup script:
    $ wget -O /usr/local/bin/cherry-elastic-storage "https://raw.githubusercontent.com/cherryservers/cherry-elastic-storage/master/cherry-elastic-storage"
    This will save the script file to /usr/local/bin.
  3. Make the script executable:
    Run the command below to give execution permissions:
    $ chmod +x /usr/local/bin/cherry-elastic-storage
  4. Retrieve required configuration variables:
    After attaching the volume, the Elastic Block setup instructions popup window appears in the Client Portal (see Fig. 12). It contains four variables needed by the script:
    • vlan_id
    • vlan_ip
    • portal_ip
    • initiator
    Make sure to copy them accurately and replace them in the next step.
  5. Run the script with variables:
    Execute the script with the variables you copied from the portal: 
    $ cherry-elastic-storage -v $vlan_id -z $vlan_ip -d $portal_ip -i $initiator -e
    Replace each placeholder with your actual values, for example:
    $ cherry-elastic-storage -v 3269 -z 10.171.217.30 -d 10.171.217.200 -i iqn.2019-03.com.cherryservers:initiator-233130-685044 -e
  6. Wait for the connection to complete:
    The script will perform the necessary configuration and, if successful, output the block device name that you will use for formatting in the next step (see Fig. 13).

    Fig. 13. Script output indicating successful EBS connection. The block device /dev/mapper/cs-volume-233130-685881 is ready to be formatted and mounted.
    Note: The device name will differ depending on your system. Always use the name returned by the script at the end of execution.

Step 4: Format and Mount the EBS Volume on Linux

After successfully configuring and discovering the EBS volume, the script will display the device path assigned to your block storage (see Fig. 13). This path is typically located under /dev/mapper/, such as:

/dev/mapper/cs-volume-233130-685881

You must now format this device, mount it to a directory, and ensure it persists after reboot.

  1. Create a file system on the block device:

    Use the mkfs utility to format the new volume. We recommend using the ext4 file system unless you have specific requirements (see Fig. 14).

    $ sudo mkfs.ext4 /dev/mapper/cs-volume-233130-685881
    Replace the device name (cs-volume-233130-685881) with the one shown in your script output.

    Fig. 14. Formatting the discovered EBS device with the ext4 file system using the mkfs.ext4 command. A unique UUID is assigned for persistent mounting.
  2. Create a mount point:
    Choose a directory where you want to mount the volume, such as /mnt/ebs-volume, and create it if it does not exist:
    $ sudo mkdir -p /mnt/ebs-volume
  3. Mount the volume:
    Mount the formatted device to the mount point using the following command:
    $ sudo mount /dev/mapper/cs-volume-233130-685881 /mnt/ebs-volume
  4. Verify the mount:
    Confirm that the volume is mounted and accessible (see Fig. 15):
    $ df -h | grep ebs-volume

    Fig. 15. Verifying the mounted EBS volume using df -h. The device is successfully mounted to /mnt/ebs-volume and is ready for use.
  5. Make the mount persistent across reboots:
    To ensure the EBS volume is automatically mounted after a system reboot, add an entry to the /etc/fstab file. Use the UUID of the device to avoid relying on the device path. First, get the UUID (see Fig. 16):
    $ sudo blkid /dev/mapper/cs-volume-233130-685881
    Note: replace cs-volume-233130-685881 with the actual volume name that was returned by the configuration script.

    Fig. 16. Using blkid to retrieve the UUID of your EBS device. Replace the volume name with your actual device path.
    Then edit /etc/fstab:
    $ sudo nano /etc/fstab
    Add the following line at the bottom (replace <UUID> with your actual UUID) (see Fig. 17):
    UUID=<UUID> /mnt/ebs-volume  ext4  defaults,_netdev  0  2
    The _netdev option ensures that the mount is attempted only after network is available, which is essential for iSCSI-based volumes.

    Fig. 17. /etc/fstab configuration with the EBS volume added using its UUID. This ensures the volume is mounted at /mnt/ebs-volume after every reboot.
  6. Test the configuration:
    Test the /etc/fstab entry without rebooting:
    $ sudo mount -a
    If there are no errors, the configuration is valid and will persist across reboots.

Step 5: Detach the Elastic Block Storage Volume (If needed)

If you no longer need the EBS volume on the current server or you want to reattach it to another machine, it must first be cleanly detached. This ensures data integrity and prevents system conflicts.

  1. Unmount the volume from the filesystem:
    Before detaching the volume, you must unmount it from the mount point to ensure that no data is being written.
    $ sudo umount /mnt/ebs-volume
    Note: Ensure that no processes are actively using the mount point. If needed, use lsof | grep ebs-volume to identify any active usage.
  2. Remove the persistent mount from /etc/fstab:
    To avoid boot-time mount errors after the volume is detached, remove or comment out the corresponding entry in /etc/fstab:
    $ sudo nano /etc/fstab
    Locate the line referencing your EBS volume and either delete it or comment it out by adding a # at the beginning..
  3. Run the detachment script:
    Use the same script that was used to configure the EBS volume, but replace the device-specific variables with the ones you used earlier:
    $ sudo cherry-elastic-storage -v $vlan_id -z $vlan_ip -d $portal_ip -i $initiator -q
    The -q flag stands for "quit" and is used to safely disconnect the iSCSI session and remove the associated multipath bindings.
    Reminder: Be sure to use the same variable values that were used initially connecting the volume. If needed, you can retrieve them again from the Client Portal.
  4. Detach the volume in the Client Portal:
    Once the volume has been unmounted and disconnected from the operating system, return to the Cherry Servers Client Portal, locate your volume, open the options menu, and select Detach (see Fig. 18).

    Fig. 18. Detaching an Elastic Block Storage volume from the Client Portal by clicking the gear icon and selecting Detach from the dropdown menu.

Summary

In this tutorial, you learned how to create, attach, configure, and mount an Elastic Block Storage volume on a Linux server using the Cherry Servers Client Portal and an automated configuration script.

We began by provisioning a new volume and attaching it to a dedicated server. After the attachment, a Bash script was used to establish iSCSI connectivity and identify the assigned block storage device. Once the device was discovered, it was formatted with the ext4 file system, mounted to a custom directory, and verified for accessibility. 

To ensure the volume remains available after system reboots, we demonstrated how to retrieve the UUID and add it to the /etc/fstab file with the _netdev option.

Finally, we explained how to cleanly detach the volume by unmounting it, removing persistent configuration entries, executing the detachment script, and then removing the volume from the Client Portal.

If you encounter any issues during script execution or configuration, please contact our support team at support@cherryservers.com with the error messages included, we’ll be happy to assist you.