Did you know  45Drives offers free  public and private  webinars ? Click here to learn more  & register! Build & Price

KB450255 – Petasan – Re-Sizing an Online / In Production RBD (iSCSI LUN)

You are here:
  • KB Home
  • PetaSAN
  • KB450255 – Petasan – Re-Sizing an Online / In Production RBD (iSCSI LUN)

Scope/Description

This article will demonstrate the steps to re-size an in-use RBD (iSCSI LUN) in Petasan without taking it offline. This must be done via the command line, as it cannot be done via the GUI without first taking it offline.

The changes discussed in this document are:

  1. The increasing/decreasing of RBD size (iSCSI LUN) and then ensuring those changes are reflected in the dashboard UI

Prerequisites

  • A deployed Petasan cluster.
    • Refer to this guide to build a Petasan cluster
  • Terminal (SSH) access to any of the monitor nodes.

Steps

  • Petasan does not allow you to change the disk size of an RBD from the dashboard without first taking it offline. Some situations call for having the ability to make changes to LUN’s that are in production, and so this must instead be done from the command line by using Ceph commands and then in order for the dashboard to accept this update, a custom Petasan script must be run.

Note: Be extremely careful if you want to decrease the size of an RBD with data already on it. Do not decrease the size below the amount of data used on the RBD or you WILL lose data. If you want to decrease, you will have to add –allow-shrink flag to the rbd resize command as an extra safety check in place to guard against accidental data loss.

  • Petasan uses a script called disk_meta.py to scrape all of the RBD metadata and output it to a file that outputs the data in json format. From there, you can open this file, make the required changes, and then output that change back to Petasan so the changes are reflected in the dashboard and take effect for iSCSI.

Finding RBD to Resize

  • Navigate to the iSCSI Disks page in the Petasan dashboard.
  • Note the Disk ID of the iSCSI Disk you are looking to change the size of. This can be found in the furthest left most column.
  • SSH into one of the nodes that is running the monitor service. In a 3-node cluster, any node will work.
  • Run the command “rbd ls” This will output a list of all of the RBD disks connected in the cluster. Note that the name of the RBD is the word image- followed by the disk ID
[root@petasan01~]# rbd ls

  • To increase the size of the RBD, run the rbd resize command on the image you want to resize. For sizing, you can use M/G/T for mebibytes all the way to tebibytes. You will also need to reference the name of the pool the image was built on. In the example below the pool name is rbd and the size is 2 tebibytes.

Note: If you are decreasing the size, this is where you will use the additional flag –allow-shrink

[root@petasan01~]# rbd resize rbd/image-00011 –size 1T
Resizing image: 100% complete...done.

Resize the RBD

  • Change directories to the folder with the disk_meta.py script
[root@petasan01~]# cd /opt/petasan/scripts/util
  • First, we need to output the metadata of this disk to a temporary file so we can make the necessary changes.
[root@petasan01:/opt/petasan/scripts/util]# ./disk_meta.py read –image image-00002 –pool rbd > /tmp/image02
  • The metadata for this disk has now been output in json format to a file at /tmp/image02 The next step is to open that file with a text editor, and make the necessary changes. In this instance, the size needs to be changed. Open the file, and edit the size. This can be found near the bottom of the file. The number is in Gigabytes so for 2TB, enter the number 2000, and 3000 for 3TB and so on. Then, save and quit.
[root@petasan01:/opt/petasan/scripts/util]# vim /tmp/image02

Before:

After:

  • The final step is to take the json metadata file and update the cluster with those changes. To do this, we use the same script, only with different commands. Rather than the read flag, we use the write flag, to write the changes permanently.
[root@petasan01:/opt/petasan/scripts/util]# ./disk_meta.py write –image image-00002 –pool rbd –file /tmp/image02
  • The changes will now be reflected in the Petasan dashboard.

Verification

  • To verify any RBD size changes have been made, use the rbd info command
[root@petasan01~}# rbd info rbd/image-00002

  • To verify these RBD size changes are being reflected in the Petasan dashboard, navigate to the iSCSI Disks page in the Petasan dashboard, and click on the iSCSI Disk the changes have been made on. If this page has been updated, the changes have propagated through the system.

 

Troubleshooting

  • Make sure to refresh your browser to ensure the updates show up in the configuration.
Was this article helpful?
Dislike 0
Views: 763
Unboxing Racking Storage Drives Cable Setup Power UPS Sizing Remote Access