Bobcares

OpenStack Attach Volume to Instance: How to Setup?

by | Nov 7, 2022

Let us take a closer look at the OpenStack Attach volume to the Instance. At Bobcares our Server management support services can give you detailed a note on the whole process.

Create a volume to OpenStack Attach it to Instance

openstack attach volume to instance

1: First, as a non-administrative project, we are sourcing the demo credentials to conduct the following steps:

$ . demo-openrc

2: Make a 1GB volume:

$ openstack volume create --size 1 volume1

| Field | Value |
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2016-03-08T14:30:48.391027 |
| description | None |
| encrypted | False |
| id | a1e8be72-a395-4a6f-8e07-856a57c39524 |
| multiattach | False |
| name | volume1 |
| properties | |
| replication_status | disabled |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | None |
| updated_at | None |
| user_id | 684286a9079845359882afc3aa5011fb |

3: The next step to set up the OpenStack attach volume to instance is that the volume status should change from reating to available  after a short period of time:

openstack volume list


ID | Display Name | Status | Size | Attached to |
a1e8be72-a395-4a6f-8e07-856a57c39524 | volume1 | available | 1 | |

Attach the volume to an instance: Openstack

This is the next step to ‘attach volume to instance’. Follow the steps given below to attach the volume to an instance:

  1. Use the command line given below to Associate a volume with an instance:

    openstack server add volume INSTANCE_NAME VOLUME_NAME

    Replace INSTANCE_NAME with the name of the instance and VOLUME_NAME with the name of the volume to which it should be attached.

    Example

    Connect the volume1 volume to the provider-instance instance as follows:

    $ openstack server add volume provider-instance volume1

    It should be noted that this command produces no output in attach the volume to instance process.

  2. Use the command line to List volumes:

    $ openstack volume list
    ID | Display Name | Status | Size | Attached to |
    a1e8be72-a395-4a6f-8e07-856a57c39524 | volume1 | in-use | 1 | Attached to provider-instance on /dev/vdb |

  3. Log in to the instance via SSH and use the fdisk command to confirm the volume’s existence as the /dev/vdb block storage device. This step will conclude the openstack attach to instance setup.

    $ sudo fdisk -l

    Disk /dev/vda: 1073 MB, 1073741824 bytes
    255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    Device Boot Start End Blocks Id System
    /dev/vda1 * 16065 2088449 1036192+ 83 Linux

    Disk /dev/vdb: 1073 MB, 1073741824 bytes
    16 heads, 63 sectors/track, 2080 cylinders, total 2097152 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    The disk /dev/vdb does not have a proper partition table. Note that We must create a file system on the device and mount it to use the volume.

 

[Need assistance with similar queries? We are here to help]

Conclusion

To conclude we have now learned how to carry out the OpenStack attach the volume to the instance. With the support of our Server management support services, we have learned to set up and manage the process easily.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

     

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.