Ceph: RBD volumes/images live resize

The below are the steps to live resize of a mounted ext4 file system can then be done as follows:

Steps to shrink/grow the volume size:

Step#1: Unmount the voulme from the VM:

      > umount /dev/vda

Step#2: Run w2fsck on the unmounted file system.

     >  e2fsck -f /dev/vda

Step#3: Run the resize2fs  – to to resize the file system with the resize2fs /dev/device

> resize2fs /dev/vda  1024G       // here 1024G is new size

Now login into ceph storage node and run the below rbd resize commands:

Step#4: Resize the volume using the command.

> rbd resize --size 1048576  rbd/rbd-6196b6bf-f7e9-4935-b92c-9ab602ce2be2 --allow-shrink

   Note: size option will takes in MB, so pass the new size with in MB format.

Step#5: Check if the rbd volume is resized to new size using the below command:

     > rbd info rbd/rbd-6196b6bf-f7e9-4935-b92c-9ab602ce2be2

Step#5: Now run the resize2fs and 2dfsck commands as below:

     > e2fsck -fy /dev/vda
     > resize2fs /dev/vda

  Step#6: Now mount the volume and list the devices.

          > mount -a

Now you could see the resized volume on your VM.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: