# \[SOLVED\] Confused about VM Disk resize feature

**URL:** <https://forum.opennebula.io/t/solved-confused-about-vm-disk-resize-feature/4448>\
**Category:** Integration Support\
**Created:** [June 13, 2017, 6:12pm UTC](https://forum.opennebula.io/t/solved-confused-about-vm-disk-resize-feature/4448 "2017-06-13T18:12:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamdev12](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jamdev12](https://forum.opennebula.io/u/jamdev12)\
**Post date:** [June 13, 2017, 6:12pm UTC](https://forum.opennebula.io/t/solved-confused-about-vm-disk-resize-feature/4448/1 "2017-06-13T18:12:55Z")

</div>

Hi Devs,

Sorry for asking this question, but I’m a bit confused as to the features with the beta version of OpenNebula 5.4. In the following document, it is stated that for vCenter VM disk resizing is possible:

[http://docs.opennebula.org/5.4/intro\_release\_notes/release\_notes/whats\_new.html](http://docs.opennebula.org/5.4/intro_release_notes/release_notes/whats_new.html)

But when you click on the link here:

[http://docs.opennebula.org/5.4/operation/vm\_management/vm\_instances.html#vm-guide2-resize-disk](http://docs.opennebula.org/5.4/operation/vm_management/vm_instances.html#vm-guide2-resize-disk)

It states that “This is only available for Linux guests in KVM.”

So I’m confused, is this a typo or is the feature not available for vCenter and VMs in vSphere clusters?

Please elaborate.  
Jesus

---

<div class="post-metadata">

**Author:** ![mcabrerizo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/mcabrerizo/32/4829_2.png) [@mcabrerizo](https://forum.opennebula.io/u/mcabrerizo)\
**Post date:** [June 14, 2017, 4:04pm UTC](https://forum.opennebula.io/t/solved-confused-about-vm-disk-resize-feature/4448/2 "2017-06-14T16:04:29Z")

</div>

Don’t be sorry Jesus,  
community’s comments are more than welcomed.

In 5.4, vCenter VM disks can be resized (increased) at boot time or when the VM is in poweroff and you resume the VM. The VM will see that its hard disks are bigger however it will be the responsability of the Guest OS to expand its filesystem to get the new space. So the documentation is still not updated ( I’d like to confirm if current vCenter contextualization packages support resize for both Linux and Windows).

Cheers!

---

<div class="post-metadata">

**Author:** ![jamdev12](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jamdev12](https://forum.opennebula.io/u/jamdev12)\
**Post date:** [July 16, 2017, 7:06pm UTC](https://forum.opennebula.io/t/solved-confused-about-vm-disk-resize-feature/4448/3 "2017-07-16T19:06:58Z")

</div>

Hi Miguel,

Thanks for the reply. Now that RC1 is out and I have upgraded to it, I see the following change in the docs:

[http://docs.opennebula.org/5.4/operation/vm\_management/vm\_instances.html#vm-guide2-resize-disk](http://docs.opennebula.org/5.4/operation/vm_management/vm_instances.html#vm-guide2-resize-disk)

\*Increase the size of the disk container prior to launching the VM.  
\*Using the contextualization packages, at boot time the VM will grow the filesystem to adjust to the new size. This is only available for Linux guests in KVM and vCenter.

I have built a brand new VM with minimal requirements in vcenter, configured it to all the necessary specs for a template, installed the latest contextualization rpm as well as the dracut-modules-growroot package (it’s a CentOS 6.9 template) and if I instantiate a machine with a bigger disk, the disk is grown, but the filesystem is not adjusted accordingly so I’m wondering what am I missing from the instructions to make this work in vCenter?

As an added note, I thought the issue was that I was using LVM as the partition manager, so I recreated a template with just an ext4 partition as the root partition and the partition and filesystem is not resized accordingly, only the physical disk is and fdisk sees the new size.

---

<div class="post-metadata">

**Author:** ![jfontan](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/jfontan/32/18_2.png) [@jfontan](https://forum.opennebula.io/u/jfontan)\
**Post date:** [July 17, 2017, 10:46am UTC](https://forum.opennebula.io/t/solved-confused-about-vm-disk-resize-feature/4448/4 "2017-07-17T10:46:57Z")

</div>

Can you check that the root partition is the latest one? growroot is only able to grow the last partition.

---

<div class="post-metadata">

**Author:** ![jamdev12](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jamdev12](https://forum.opennebula.io/u/jamdev12)\
**Post date:** [July 17, 2017, 6:28pm UTC](https://forum.opennebula.io/t/solved-confused-about-vm-disk-resize-feature/4448/5 "2017-07-17T18:28:07Z")

</div>

Hi Javi,

Thanks for the response. Yes the root partition is the last partition in the list. Below I have included all the relavent information for both types of systems which I have been able to instantiate, but fail to expand the disk according to the documentation.

# LVM System (CentOS 6.8 x86\_64)

Template Data

```
User template
DESCRIPTION = "expanddisklvm server"
HYPERVISOR = "vcenter"
LOGO = "images/logos/centos.png"
SIZE = "102400"
VCENTER_CCR_REF = "domain-c7"
VCENTER_INSTANCE_ID = "29b2c991-32bb-40b4-be9a-ab287a230cfc"
VCENTER_TEMPLATE_REF = "vm-610"

Template

AUTOMATIC_DS_REQUIREMENTS = "\"CLUSTERS/ID\" @> 100"
AUTOMATIC_REQUIREMENTS = "(CLUSTER_ID = 100) & !(PUBLIC_CLOUD = YES)"
CONTEXT = [
  DISK_ID = "1",
  DNS_HOSTNAME = "YES",
  ETH0_CONTEXT_FORCE_IPV4 = "",
  ETH0_DNS = "172.26.1.235 172.26.1.236",
  ETH0_GATEWAY = "172.20.64.1",
  ETH0_GATEWAY6 = "",
  ETH0_IP = "172.20.64.145",
  ETH0_IP6 = "",
  ETH0_IP6_PREFIX_LENGTH = "",
  ETH0_IP6_ULA = "",
  ETH0_MAC = "02:00:ac:14:40:91",
  ETH0_MASK = "255.255.254.0",
  ETH0_MTU = "",
  ETH0_NETWORK = "",
  ETH0_SEARCH_DOMAIN = "",
  ETH0_VLAN_ID = "",
  ETH0_VROUTER_IP = "",
  ETH0_VROUTER_IP6 = "",
  ETH0_VROUTER_MANAGEMENT = "",
  NETWORK = "YES",
  SET_HOSTNAME = "expanddisklvm01",
  SSH_PUBLIC_KEY = "ssh-rsa blah",
  TARGET = "hda" ]
CPU = "2"
DISK = [
  CLONE = "YES",
  CLONE_TARGET = "NONE",
  CLUSTER_ID = "100",
  DATASTORE = "[vcenter65 - -01] pure01_vm_datastore_1 - CLUSTER01 (IMG)",
  DATASTORE_ID = "100",
  DEV_PREFIX = "sd",
  DISK_ID = "0",
  DISK_SNAPSHOT_TOTAL_SIZE = "0",
  DISK_TYPE = "FILE",
  IMAGE = "centos68min_mergedisk_1 - pure01_vm_datastore_1",
  IMAGE_ID = "2",
  IMAGE_STATE = "2",
  IMAGE_UNAME = "oneadmin",
  LN_TARGET = "NONE",
  OPENNEBULA_MANAGED = "NO",
  ORIGINAL_SIZE = "40960",
  READONLY = "NO",
  SAVE = "NO",
  SIZE = "102400",
  SOURCE = "centos68min_mergedisk/centos68min_mergedisk_1.vmdk",
  TARGET = "sda",
  TM_MAD = "vcenter",
  TYPE = "FILE",
  VCENTER_DS_REF = "datastore-32",
  VCENTER_INSTANCE_ID = "29b2c991-32bb-40b4-be9a-ab287a230cfc" ]
GRAPHICS = [
  LISTEN = "0.0.0.0",
  PORT = "5918",
  TYPE = "vnc" ]
MEMORY = "4096"
NIC = [
  AR_ID = "0",
  BRIDGE = "VLAN_2064_172_20_64_0-23_SHAREB",
  CLUSTER_ID = "100",
  DNS = "172.26.1.235 172.26.1.236",
  GATEWAY = "172.20.64.1",
  IP = "172.20.64.145",
  MAC = "02:00:ac:14:40:91", 
  MODEL = "virtualvmxnet3",
  NETWORK = "[sjcvcenter65 - -01] VLAN_2064_172_20_64_0-23_SHAREB - CLUSTER01",
  NETWORK_ID = "1",
  NETWORK_MASK = "255.255.254.0",
  NETWORK_UNAME = "oneadmin",
  NIC_ID = "0",
  SEARCH_DOMAIN = "",
  SECURITY_GROUPS = "0",
  TARGET = "one-18-0",
  VCENTER_CCR_REF = "domain-c7",
  VCENTER_INSTANCE_ID = "29b2c991-32bb-40b4-be9a-ab287a230cfc",
  VCENTER_NET_REF = "dvportgroup-69",
  VCENTER_PORTGROUP_TYPE = "Distributed Port Group",
  VN_MAD = "dummy" ]
SECURITY_GROUP_RULE = [
  PROTOCOL = "ALL",
  RULE_TYPE = "OUTBOUND",
  SECURITY_GROUP_ID = "0",
  SECURITY_GROUP_NAME = "default" ]
SECURITY_GROUP_RULE = [
   PROTOCOL = "ALL",
   RULE_TYPE = "INBOUND",
  SECURITY_GROUP_ID = "0",
  SECURITY_GROUP_NAME = "default" ]
VCPU = "2" 
VMID = "18"

```

Login into system providess the following data:

```
[root@expanddisklvm01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       39G 1.1G 36G 3% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 477M 54M 398M 12% /boot

[root@expanddisklvm01 ~]# fdisk -luc

Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00088a3d

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 209712509 104343231 8e Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 42.4 GB, 42421190656 bytes
255 heads, 63 sectors/track, 5157 cylinders, total 82853888 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@expanddisklvm01 ~]# yum install dracut-modules-growroot
Loaded plugins: fastestmirror
Setting up Install Process
Determining fastest mirrors
epel/metalink | 13 kB 00:00     
 * base: mirror.keystealth.org
 * epel: mirror.sjc02.svwh.net
 * extras: centos.host-engine.com
 * updates: mirrors.sonic.net
base | 3.7 kB 00:00     
epel | 4.3 kB 00:00     
epel/primary_db | 5.9 MB 00:00     
extras | 3.4 kB 00:00     
updates | 3.4 kB 00:00     
updates/primary_db | 2.5 MB 00:00     
Package dracut-modules-growroot-0.20-2.el6.noarch already installed and latest version
Nothing to do
[root@expanddisklvm01 one-context]# rpm -qa | grep context
one-context-5.3.80-1.el6.noarch
[root@expanddisklvm01 one-context]#

```

# Regular Partition System (CentOS 6.9 x86\_64)

Template Data

```
User template

DESCRIPTION = "expanddisk server"
HYPERVISOR = "vcenter"
LOGO = "images/logos/centos.png"
VCENTER_CCR_REF = "domain-c7"
VCENTER_TEMPLATE_REF = "vm-1041"
VM_TEMPLATE = "29b2c991-32bb-40b4-be9a-ab287a230cfc"

Template

AUTOMATIC_DS_REQUIREMENTS = "\"CLUSTERS/ID\" @> 100"
AUTOMATIC_REQUIREMENTS = "(CLUSTER_ID = 100) & !(PUBLIC_CLOUD = YES)"
CONTEXT = [
  DISK_ID = "1",
  DNS_HOSTNAME = "YES",
  ETH0_CONTEXT_FORCE_IPV4 = "",
  ETH0_DNS = "172.26.1.235 172.26.1.236",
  ETH0_GATEWAY = "172.20.64.1",
  ETH0_GATEWAY6 = "",
  ETH0_IP = "172.20.64.144",
  ETH0_IP6 = "",
  ETH0_IP6_PREFIX_LENGTH = "",
  ETH0_IP6_ULA = "",
  ETH0_MAC = "02:00:ac:14:40:90",
  ETH0_MASK = "255.255.254.0",
  ETH0_MTU = "",
  ETH0_NETWORK = "",
  ETH0_SEARCH_DOMAIN = "",
  ETH0_VLAN_ID = "",
  ETH0_VROUTER_IP = "",
  ETH0_VROUTER_IP6 = "",
  ETH0_VROUTER_MANAGEMENT = "",
  NETWORK = "YES",
  SET_HOSTNAME = "expanddisk01.",
  SSH_PUBLIC_KEY = "ssh-rsa blah",
  TARGET = "hda" ]
CPU = "2"
DISK = [
  ALLOW_ORPHANS = "NO",
  CLONE = "YES",
  CLONE_TARGET = "SYSTEM",
  CLUSTER_ID = "100",
  DATASTORE = "pure01_vm_datastore_3 [vcenter65. - -01] (IMG)",
  DATASTORE_ID = "106",
  DEV_PREFIX = "sd",
  DISK_ID = "0",
  DISK_SNAPSHOT_TOTAL_SIZE = "0",
  DISK_TYPE = "FILE",
  IMAGE = "centos69min_oneext4 - pure01_vm_datastore_3 [Template 7]",
  IMAGE_ID = "4",
  IMAGE_STATE = "2",
  LN_TARGET = "NONE",
  OPENNEBULA_MANAGED = "NO",
  ORIGINAL_SIZE = "16384",
  READONLY = "NO",
  SAVE = "NO",
  SIZE = "102400",
  SOURCE = "centos69min_oneext4/centos69min_oneext4.vmdk",
  TARGET = "sda",
  TM_MAD = "vcenter",
  TYPE = "FILE",
  VCENTER_DS_REF = "datastore-517",
  VCENTER_INSTANCE_ID = "29b2c991-32bb-40b4-be9a-ab287a230cfc" ]
GRAPHICS = [
  LISTEN = "0.0.0.0",
  PORT = "5916",
  TYPE = "vnc" ]
MEMORY = "4096"
NIC = [
  AR_ID = "0",
  BRIDGE = "VLAN_2064_172_20_64_0-23_SHAREB",
  CLUSTER_ID = "100",
  DNS = "172.26.1.235 172.26.1.236",
  GATEWAY = "172.20.64.1",
  IP = "172.20.64.144",
  MAC = "02:00:ac:14:40:90",
  MODEL = "virtualvmxnet3",
  NETWORK = "[vcenter65. - -01] VLAN_2064_172_20_64_0-23_SHAREB - CLUSTER01",
  NETWORK_ID = "1",
  NETWORK_MASK = "255.255.254.0",
  NETWORK_UNAME = "oneadmin",
  NIC_ID = "0",
  SEARCH_DOMAIN = "",
  SECURITY_GROUPS = "0",
  TARGET = "one-16-0",
  VCENTER_CCR_REF = "domain-c7",
  VCENTER_INSTANCE_ID = "29b2c991-32bb-40b4-be9a-ab287a230cfc",
  VCENTER_NET_REF = "dvportgroup-69",
  VCENTER_PORTGROUP_TYPE = "Distributed Port Group",
  VN_MAD = "dummy" ]
SECURITY_GROUP_RULE = [
  PROTOCOL = "ALL",
  RULE_TYPE = "OUTBOUND",
  SECURITY_GROUP_ID = "0",
  SECURITY_GROUP_NAME = "default" ]
SECURITY_GROUP_RULE = [
  PROTOCOL = "ALL",
  RULE_TYPE = "INBOUND",
  SECURITY_GROUP_ID = "0",
  SECURITY_GROUP_NAME = "default" ]
VCPU = "2"
VMID = "16"

```

Login into system provides the following data:

```
[root@expanddisk01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 16G 1.1G 14G 8% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 477M 52M 400M 12% /boot
[root@expanddisk01 ~]# fdisk -luc

Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000918ed

   Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 209712509 104343231 83 Linux
[root@expanddisk01 ~]# yum install dracut-modules-growroot
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink | 13 kB 00:00     
 * base: mirror.linuxfix.com
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: centos-distro.cavecreek.net
 * updates: mirrors.kernel.org
base | 3.7 kB 00:00     
epel | 4.3 kB 00:00     
epel/primary_db | 5.9 MB 00:00     
extras | 3.4 kB 00:00     
updates | 3.4 kB 00:00     
Package dracut-modules-growroot-0.20-2.el6.noarch already installed and latest version
Nothing to do
[root@expanddisk01 ~]# rpm -qa | grep context
one-context-5.3.80-1.el6.noarch
[root@expanddisk01 ~]# 

```

Hopefully this provides sufficient information about this problem. If not let me know what additional information you wouild like me to provide.

Thanks,  
Jesus

---

<div class="post-metadata">

**Author:** ![jamdev12](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jamdev12](https://forum.opennebula.io/u/jamdev12)\
**Post date:** [July 26, 2017, 6:27am UTC](https://forum.opennebula.io/t/solved-confused-about-vm-disk-resize-feature/4448/6 "2017-07-26T06:27:21Z")

</div>

It seems the new contextualization packages have solved the expanding partition issue I was running into. Just wanted to point that out in case someone else runs into the same issue in the future.

---

<div class="post-metadata">

**Author:** ![jamdev12](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jamdev12](https://forum.opennebula.io/u/jamdev12)\
**Post date:** [July 31, 2017, 5:53am UTC](https://forum.opennebula.io/t/solved-confused-about-vm-disk-resize-feature/4448/7 "2017-07-31T05:53:37Z")

</div>

An additional caveat for those wondering in case you see that your filesystem has not expanded.

1. If you are not using LVM, just straight partitioning, your disk will expand on first boot.
2. If you are using LVM, your disk will expand on the next reboot.

I have not tried other partitioning types.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![paulmarc](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/paulmarc/32/4784_2.png) [@paulmarc](https://forum.opennebula.io/u/paulmarc)\
**Post date:** [October 14, 2017, 9:50pm UTC](https://forum.opennebula.io/t/solved-confused-about-vm-disk-resize-feature/4448/8 "2017-10-14T21:50:14Z")

</div>

> [@jamdev12](#):
>
> If you are not using LVM, just straight partitioning, your disk will expand on first boot.  
> If you are using LVM, your disk will expand on the next reboot.

Thanks!

I have noticed that the disk of my VM (using LVM) on resize does change immediately, but not the partition itself…  
I’m still running some tests (maybe contextualization package issue?), and will share if I get anything.

---

<div class="post-metadata">

**Author:** ![FrancJP](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/francjp/32/7690_2.png) [@FrancJP](https://forum.opennebula.io/u/FrancJP)\
**Post date:** [June 25, 2025, 4:05pm UTC](https://forum.opennebula.io/t/solved-confused-about-vm-disk-resize-feature/4448/9 "2025-06-25T16:05:58Z")

</div>


