.. _volume_resize_card: Volume: resize ============== Resize a volume --------------- - We recommend shutting down the instance before performing the operation. .. image:: /cloud/_img/op_volume_resize_img1.jpg - Make sure that the volume you want to resize is not attached to any instance. If it is attached, detach it following the steps in :ref:`cloud/operative/storage_ops/volume_create:Attach/Detach a volume`. .. image:: /cloud/_img/op_volume_resize_img2.jpg - And select the volume you want to resize from the list. .. image:: /cloud/_img/op_volume_resize_img3.jpg - Now you can proceed to resize the volume by selecting the action *"Extend Volume"*. .. image:: /cloud/_img/op_volume_resize_img4.jpg - In the pop-up window that opens, you can select the New Size. .. image:: /cloud/_img/op_volume_resize_img5.jpg .. important:: It is not possible to decrease the size of the volume (the volume can only be extended). - After entering the new size, click on *"Extend Volume"* button. - Once the volume has been resized, you can re-attach it to the instance using the Manage Attachments option. .. image:: /cloud/_img/op_volume_resize_img6.jpg .. image:: /cloud/_img/op_volume_resize_img7.jpg After this, you can restart the instance. Once these operations are done, OpenStack will assume the volume has the new size and it will appear to the machine as a device of a different size. .. important:: It is necessary to update the device partitions and then the filesystem must be extended to occupy all the free space that has been created. These operations depend on the operating system and the type of filesystem. For example, on a Rocky Linux system, you can resize an ext4 filesystem using the tools ``fdisk``, ``e2fsck``, and ``resize2fs``. During these operations, all precautions must be taken to avoid data loss; therefore, we suggest you perform the necessary checks and ensure you use the specific tools depending on the volume's filesystem. Refer to your operating system documentation for more details on resizing partitions and filesystems. Using the CLI ------------- You can perform the same operations using the :ref:`cloud/os_overview/management_tools/command_line:Command Line Interface`. - First, list the servers and the volumes to identify the IDs of the resources. .. code:: bash $ openstack server list +----------------+------------------+--------+-----+------------------+ | ID | Name | Status | ... | Flavor | +----------------+------------------+--------+-----+------------------+ | | | ACTIVE | | | | | | ACTIVE | | | | | | ACTIVE | | | ... | | | ACTIVE | | | +----------------+------------------+--------+-----+------------------+ .. code:: bash $ openstack volume list +----------------+------------------+----------+---------------------------------------+ | ID | Name | Status | Attached to | +----------------+------------------+----------+---------------------------------------+ | | | | | | | | | Attached to on /dev/vdX | | | | | | ... | | | | Attached to on /dev/vdX | +----------------+------------------+----------+---------------------------------------+ - Detach the volume from the instance (if it is attached): .. code:: bash $ openstack server remove volume - Resize the volume: .. code:: bash $ openstack volume set --set - Finally, you can re-attach the volume to the instance: .. code:: bash $ openstack server add volume +-----------------------+-------------+ | Field | Value | +-----------------------+-------------+ | ID | | | Server ID | | | Volume ID | | | Device | /dev/vdX | | Tag | None | | Delete On Termination | False | +-----------------------+-------------+