ResizingVMDisk: Difference between revisions

From T2B Wiki
Jump to navigation Jump to search
(Created page with "==Goal== On this page, we will explain how to increase the size of a partition in a VM. The steps are the following: # Increase the size of the image # Increase the size of a partition # 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 ty...")
 
No edit summary
Line 19: Line 19:
4. Restart the VM and login into it
4. Restart the VM and login into it


5. Resize the partition:
5. Install the following packages:
<pre>yum install cloud-utils-growpart gdisk</pre>
 
6. Resize the partition:
<pre>growpart <device> <partition_number> +<number>GB</pre>
<pre>growpart <device> <partition_number> +<number>GB</pre>
6. Resize the filesystem of the partition:
7. Resize the filesystem of the partition:
<pre>resize2fs <partition></pre>
<pre>resize2fs <partition></pre>

Revision as of 13:00, 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>