ResizingVMDisk: Difference between revisions

From T2B Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 26: Line 26:
7. Resize the filesystem of the partition:
7. Resize the filesystem of the partition:
<pre>resize2fs <partition></pre>
<pre>resize2fs <partition></pre>
== raw images on Ceph with standard ext4 partition ==
1. Poweroff the VM
2. To resize the image:
<pre>qemu-img resize rbd:{pool-name}/{image-name} {size}</pre>

Revision as of 13:06, 12 October 2022

Goal

On this page, we will explain how to increase the size of a partition in a VM. The steps are the following:

  1. Increase the size of the image
  2. Increase the size of a partition
  3. Resize the filesystem

The details of the steps of this generic procedure will change depending on:

  • the type of backend storage (ONE datastore) for VM images (NFS share or Ceph);
  • the format of the image (qcow2, raw,...);
  • the type of partition (standard partitioning or LVM);
  • the type of filesystem (xfs, ext3/4,...).

qcow2 images on NFS with a standard partition in ext4

1. Poweroff the VM

2. On the frontend of the ONE cloud, find the full path of the image of the VM with the command:

oneimage show <image_id>

3. Resize the image:

qemu-img resize <path_of_image> +<number>GB

4. Restart the VM and login into it

5. Install the following packages:

yum install cloud-utils-growpart gdisk

6. Resize the partition:

growpart <device> <partition_number> +<number>GB

7. Resize the filesystem of the partition:

resize2fs <partition>

raw images on Ceph with standard ext4 partition

1. Poweroff the VM

2. To resize the image:

qemu-img resize rbd:{pool-name}/{image-name} {size}